Add AKS Automatic cluster quickstart sample - #487
Add AKS Automatic cluster quickstart sample#487Allen Sudbring (asudbring) wants to merge 4 commits into
Conversation
|
Allen Sudbring (@asudbring) this is no longer accurate. we now support azurerm and azapi for aks automatic: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_automatic_cluster |
azurerm_kubernetes_automatic_cluster shipped in AzureRM 5.0.0, so 101-aks-automatic now uses the native resource. The AzAPI approach is preserved as 101-aks-automatic-azapi for cases needing direct managed cluster API control. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks for the pointer — you're right,
Split into two sibling samples so each is independently deployable and gets its own CI run. The readmes cross-link, and the AzAPI one now explains when you'd reach for it (direct control over the managed cluster API payload, or properties AzureRM hasn't surfaced yet) rather than claiming AzureRM can't do it. The AzureRM sample also drops the now-unnecessary TestingBoth samples were deployed and torn down against a live subscription after this change.
Region:
|
|
Steven Ma (@stevenjma) Thanks! |
Steven (stemaMSFT)
left a comment
There was a problem hiding this comment.
The AzureRM-first direction and separate AzAPI escape hatch look good. I found two issues to address before merge:
- The AzAPI sample accepts
cluster_sku_name = "Base"and forwards it tosku.name. That can successfully create a non-Automatic cluster even though the directory, README, and cross-link promise an AKS Automatic sample. Please hard-codeAutomaticand remove the variable/README row, or rename and broaden the sample. quickstart/101-aks-automatic-azapi/main.tfstill says AzureRM cannot create the Automatic SKU. That now contradicts the new AzureRM sibling and revised AzAPI README. Please update the source comment to the current rationale: direct API payload/version control or properties AzureRM has not surfaced.
The separate runnable directories and provider-native output differences do not seem blocking.
Hard-code the Automatic SKU in the AzAPI sample, correct the stale rationale comment about the AzureRM provider, and default to the validated westus2 region. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks for the review Steven (@stemaMSFT) — both points are addressed in 1. AzAPI sample accepted Hard-coded. 2. Stale rationale comment in Replaced. The comment no longer claims AzureRM can't create the Automatic SKU. It now reads: # Create the AKS Automatic cluster.
# The AzAPI provider is used here to get direct control over the managed cluster
# API payload and API version. Reach for this pattern when you need a property
# or an API version that the AzureRM provider hasn't surfaced yet. For the
# provider-native equivalent, see the 101-aks-automatic sample.That matches the revised README and the new AzureRM sibling. Also changed: default region You raised this on #490, and it applies equally here, so I made the same change rather than leaving these two samples on the known-failing path. Both now default to
|
Steven Ma (stevenjma)
left a comment
There was a problem hiding this comment.
Just a few small changes and then we're good to merge
|
|
||
| This template deploys an AKS Automatic cluster with a system-assigned managed identity into a resource group with a random name beginning with "rg-". | ||
|
|
||
| The cluster is created with the AzureRM provider's [`azurerm_kubernetes_automatic_cluster`](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_automatic_cluster) resource, which is the recommended way to declare an AKS Automatic cluster. This resource requires AzureRM provider `5.0` or later. |
There was a problem hiding this comment.
this should be v4.81 or later
| | `cluster_name_prefix` | Prefix of the AKS Automatic cluster name that's combined with a random ID so the name is unique in your Azure subscription. | aks-automatic | | ||
|
|
||
| > [!NOTE] | ||
| > The default location is `westus2` because that's the region this sample was validated in. At the time of testing, `eastus` returned `AKSCapacityHeavyUsage` for API Server VNet Integration. Set `resource_group_location` to deploy elsewhere. |
There was a problem hiding this comment.
this note is unnecessary as noise for the customer.
Set the azurerm pin to ~>5.0 in the AzAPI sample to match the provider-native one, correct the minimum provider version to v4.81, and remove the tested-region notes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks Steven Ma (@stevenjma) — both inline comments addressed in
Corrected in
Removed from both READMEs in this PR. The Also applied here: consistent provider pin You raised this on #490 and the same mismatch existed here — After |
Steven (stemaMSFT)
left a comment
There was a problem hiding this comment.
Validated both AzureRM and AzAPI quickstarts end to end at commit 0b2b2bb in westus2: format/init/validate/plan/apply succeeded, live AKS Automatic SKU and identity assertions passed, post-apply plans showed no drift, and destroy left no residual managed or node resource groups. Approved.
Summary
Adds a Terraform quickstart sample that deploys an Azure Kubernetes Service (AKS) Automatic cluster with a system-assigned managed identity.
Why AzAPI
The AzureRM provider's
azurerm_kubernetes_clusterresource always sets the managed cluster SKU name toBaseand can't create theAutomaticSKU, so the cluster is declared withazapi_resource. This follows existing AzAPI precedent in the repo (201-aks-clusters-fleet-manager-azapi,101-azapi-eventhub-network-rules).Contents
quickstart/101-aks-automatic/providers.tfmain.tfvariables.tfoutputs.tfreadme.mdTesting
This sample was deployed and torn down against a live Azure subscription before submission.
terraform fmtterraform validateterraform applysku.name = Automatic,sku.tier = Standard,provisioningState = Succeeded,identity = SystemAssigned, Kubernetes 1.35.6terraform destroyRegion:
eastus.TestRecord.mdis intentionally omitted — the CI pipeline generates it.