Skip to content

fix(namespace): set location as top-level attribute on azapi_resource#179

Merged
matt-FFFFFF merged 3 commits intomainfrom
copilot/fix-managed-namespace-creation
Apr 22, 2026
Merged

fix(namespace): set location as top-level attribute on azapi_resource#179
matt-FFFFFF merged 3 commits intomainfrom
copilot/fix-managed-namespace-creation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

Creating a managed namespace via the module failed with 400 LocationRequired because the namespace sub-module only embedded location inside the request body of azapi_resource, which the provider does not forward as the resource's location.

Changes

  • modules/namespace/main.tf: set location = var.location as a top-level attribute on azapi_resource.this, matching the pattern used by the parent cluster in main.tf.
  • modules/namespace/locals.tf: drop the now-redundant location key from local.resource_body.
resource "azapi_resource" "this" {
  location  = var.location   # <-- added
  name      = var.name
  parent_id = var.parent_id
  type      = "Microsoft.ContainerService/managedClusters/managedNamespaces@2025-10-01"
  body      = local.resource_body
  ...
}

The user-reported config (namespace = { ns1 = { name = "...", location = "germanywestcentral", annotations = {...} } }) already plumbs location through main.namespace.tf into the sub-module, so no caller-side changes are needed.

@microsoft-github-policy-service
Copy link
Copy Markdown

Important

The "Needs: Triage 🔍" label must be removed once the triage process is complete!

Tip

For additional guidance on how to triage this issue/PR, see the Terraform Issue Triage documentation.

Copilot AI changed the title [WIP] Fix managed namespace creation issue in AVM module fix(namespace): set location as top-level attribute on azapi_resource Apr 20, 2026
Copilot AI requested a review from matt-FFFFFF April 20, 2026 12:47
@matt-FFFFFF
Copy link
Copy Markdown
Member

@copilot run PORCH_NO_TUI=1 ./avm pre-commit and commit changes so the tests pass

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 21, 2026

@copilot run PORCH_NO_TUI=1 ./avm pre-commit and commit changes so the tests pass

Ran PORCH_NO_TUI=1 ./avm pre-commit, all steps passed (avmfix, generate docs, grept). Committed the resulting governance-sync changes (avm script update, AVM skill folder rename to avm-terraform-module-development, AGENTS.md reference update) in a938690.

Copilot AI requested a review from matt-FFFFFF April 21, 2026 09:01
Copilot AI temporarily deployed to empty-no-approval April 21, 2026 09:10 Inactive
Copilot AI temporarily deployed to test-no-approval April 21, 2026 09:10 Inactive
Copilot AI temporarily deployed to empty-no-approval April 21, 2026 09:10 Inactive
Copilot AI deployed to empty-no-approval April 21, 2026 13:02 Active
Copilot AI deployed to pr-check April 22, 2026 08:35 Active
@matt-FFFFFF matt-FFFFFF marked this pull request as ready for review April 22, 2026 08:49
@matt-FFFFFF matt-FFFFFF merged commit 02177a1 into main Apr 22, 2026
18 of 29 checks passed
@matt-FFFFFF matt-FFFFFF deleted the copilot/fix-managed-namespace-creation branch April 22, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Triage 🔍 Maintainers need to triage still

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AVM Module Issue]: Unable to create managed namespace using the module

2 participants