-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New data-source: azurerm_kubernetes_service_versions #3382
Conversation
Tests still pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, should probably have @katbyte or @tombuildsstuff take a peek prior to merging though.
I'd prefer that they do as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments inline
azurerm/data_source_azurerm_container_orchestrator_versions_test.go
Outdated
Show resolved
Hide resolved
azurerm/data_source_azurerm_container_orchestrator_versions_test.go
Outdated
Show resolved
Hide resolved
azurerm/data_source_azurerm_container_orchestrator_versions_test.go
Outdated
Show resolved
Hide resolved
azurerm/data_source_azurerm_container_orchestrator_versions_test.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the revisions @alexsomesan, LGTM now
however I think @tombuildsstuff had a comment on the resource's name so I will hold off merging until he comments
I am unconvinced myself about the name. It's rather unwieldy, TBH. For lack of a better option I went with what the convention dictated and composed it from the name of the API resource. I'm open to any other suggestions. |
@alexsomesan, discussed with @ tombuildsstuff, and as much as orchestrator is a fantastic word i'd like to use as much as possible we think renaming it to |
That sounds fine by me. I'll make the necessary adaptations. I guess we do still want to filter the output of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @alexsomesan
Thanks for pushing those changes - as discussed IRL can we make this azurerm_kubernetes_service_versions
rather than container_orchestrator_versions
?
Thanks!
listResp, err := client.ListOrchestrators(ctx, location, "managedClusters") | ||
if err != nil { | ||
if utils.ResponseWasNotFound(listResp.Response) { | ||
return fmt.Errorf("Error: Container Orchestrators not found for location %q", location) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the use-case for this, when AKS isn't supported in that region?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say yes, but I'm not 100% sure this is the right error to check for that case. Any idea how to confirm it?
The API docs only mention positive responses. Does that mean there can be no errors returned?
https://docs.microsoft.com/en-us/rest/api/container-service/container%20service%20client/listorchestrators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 99% sure that'll come through as a 404; it's generally something along the lines of the API version '2019-01-01' was not found for the Resource Provider 'Microsoft.ContainerService'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @alexsomesan
Thanks for pushing those changes - I've left some comments inline (mostly) around the renaming but this is otherwise looking good to me; so that we can get this released in the v1.28 release I'm going to push some commits to fix that, I hope you don't mind!
Thanks!
client := meta.(*ArmClient).containerServicesClient | ||
ctx := meta.(*ArmClient).StopContext | ||
|
||
location := d.Get("location").(string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably want to run this through azurermNormalizeLocation(location)
to ensure this value's normalized?
versions := []string{} | ||
for _, rawV := range *listResp.Orchestrators { | ||
if rawV.OrchestratorType != nil && rawV.OrchestratorVersion != nil { | ||
if *rawV.OrchestratorType == "Kubernetes" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given the history with some of the API's, we probably want to be doing this case insensitively:
if *rawV.OrchestratorType == "Kubernetes" { | |
if strings.EqualsFold(*rawV.OrchestratorType, "Kubernetes") { |
website/azurerm.erb
Outdated
@@ -131,6 +131,10 @@ | |||
<a href="/docs/providers/azurerm/d/client_config.html">azurerm_client_config</a> | |||
</li> | |||
|
|||
<li<%= sidebar_current("docs-azurerm-datasource-container-orchestrator-versions") %>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<li<%= sidebar_current("docs-azurerm-datasource-container-orchestrator-versions") %>> | |
<li<%= sidebar_current("docs-azurerm-datasource-kubernetes-service-versions") %>> |
website/azurerm.erb
Outdated
@@ -131,6 +131,10 @@ | |||
<a href="/docs/providers/azurerm/d/client_config.html">azurerm_client_config</a> | |||
</li> | |||
|
|||
<li<%= sidebar_current("docs-azurerm-datasource-container-orchestrator-versions") %>> | |||
<a href="/docs/providers/azurerm/d/container_orchestrator_versions.html">container_orchestrator_versions</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<a href="/docs/providers/azurerm/d/container_orchestrator_versions.html">container_orchestrator_versions</a> | |
<a href="/docs/providers/azurerm/d/kubernetes_service_versions.html"> azurerm_kubernetes_service_versions</a> |
} | ||
|
||
output "latest_version" { | ||
value = "${data.azurerm_container_orchestrator_versions.current.latest_version}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value = "${data.azurerm_container_orchestrator_versions.current.latest_version}" | |
value = "${data.azurerm_kubernetes_service_versions.current.latest_version}" |
|
||
# Data Source: azurerm_container_orchestrator_versions | ||
|
||
Use this data source to access information about available versions of orchestrators supported by the Azure Container services. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this data source to access information about available versions of orchestrators supported by the Azure Container services. | |
Use this data source to access information about the available versions of Kubernetes supported by the Azure Kubernetes Service. |
@@ -0,0 +1,38 @@ | |||
--- | |||
layout: "azurerm" | |||
page_title: "Azure Resource Manager: azurerm_container_orchestrator_versions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
page_title: "Azure Resource Manager: azurerm_container_orchestrator_versions" | |
page_title: "Azure Resource Manager: azurerm_kubernetes_service_versions" |
## Argument Reference | ||
|
||
* `location` - (Required) Specifies the location in which to query for versions. | ||
* `orchestrator_type` - (Optional) The type of orchestrator for which to fetch versions. Right now the only supported value is `Kubernetes`. If omitted, defaults to `Kubernetes`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has been removed so:
* `orchestrator_type` - (Optional) The type of orchestrator for which to fetch versions. Right now the only supported value is `Kubernetes`. If omitted, defaults to `Kubernetes`. |
|
||
* `location` - (Required) Specifies the location in which to query for versions. | ||
* `orchestrator_type` - (Optional) The type of orchestrator for which to fetch versions. Right now the only supported value is `Kubernetes`. If omitted, defaults to `Kubernetes`. | ||
* `version_prefix` - (Optional) A string prefix used to filter the versions retrieved by the query. When this argument is specified, only the versions which match this prefix are returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `version_prefix` - (Optional) A string prefix used to filter the versions retrieved by the query. When this argument is specified, only the versions which match this prefix are returned. | |
* `version_prefix` - (Optional) A prefix filter for the versions of Kubernetes which should be returned; for example `1.x` will return `1.9` to `1.14`, whereas `1.12` will return `1.12.2. |
Retrieves available versions of container orchestrators.
Link documentation page into sidebar template.
Co-Authored-By: alexsomesan <alex.somesan@gmail.com>
…st.go Co-Authored-By: alexsomesan <alex.somesan@gmail.com>
…st.go Co-Authored-By: alexsomesan <alex.somesan@gmail.com>
Co-Authored-By: alexsomesan <alex.somesan@gmail.com>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
Co-Authored-By: Tom Harvey <tombuildsstuff@users.noreply.github.com>
cfdb7fa
to
a53f6d7
Compare
Tests pass:
|
Thanks for pushing those changes, Tom! |
This has been released in version 1.28.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 1.28.0"
}
# ... other configuration ... |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
This datasource retrieves available versions of container orchestrators.
It enables users to dynamically select one of the supported Kubernetes versions when provisioning
AKS clusters, for example.
Tested locally