fix(azure/aks): make ACR attach plan-stable for greenfield applies#448
Merged
Conversation
jcastiarena
force-pushed
the
fix/azure-aks-acr-attach-greenfield
branch
from
July 22, 2026 21:01
f7b13e7 to
808b60d
Compare
jcastiarena
force-pushed
the
fix/azure-aks-acr-attach-greenfield
branch
from
July 24, 2026 13:32
808b60d to
442bc11
Compare
attached_acr_id_map gated on `var.acr_id != null`, whose condition is unknown at plan time when the ACR is created in the same run, leaving the for_each key set unknown and failing the plan with "Invalid for_each argument". Add an optional `attach_acr` bool (default null). When null it preserves the legacy "attach iff acr_id is non-null" behaviour, so existing consumers are unaffected. Setting attach_acr=true fixes the for_each key set at plan time even when acr_id is only known after apply, enabling a single-apply greenfield; false force-disables.
jcastiarena
force-pushed
the
fix/azure-aks-acr-attach-greenfield
branch
from
July 24, 2026 16:14
442bc11 to
f43ddfb
Compare
davidf-null
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix a greenfield single-apply failure in the Azure
aksmodule.attached_acr_id_mapgated onvar.acr_id != null, whose condition is unknown at plan time when the ACR is created in the same run — leaving thefor_eachkey set unknown and failing the plan withInvalid for_each argument.Change
Add an optional
attach_acrbool (defaultnull) and gate on it, falling back to the legacy behaviour when unset:Backward compatible
The default (
null) reproduces the current behaviour exactly — no existing consumer changes:attach_acracr_idnull(default)null(default)null(default)truefalseGreenfield single-apply is fixed by opting in with
attach_acr = true; settingfalseforce-disables.Verification
pre-commit runon the changed files: OpenTofu fmt / validate / tofu test → Passedterraform-docs