Azure / Azure/terraform-provider-azapi
Update the subnet of a Microsoft.App/managedEnvironments doesn't force a recreation.
- Dominant language
- Go
- Stars
- 244
- Forks
- 97
- Avg merge
- 5d 9h
- Merged PRs (30d)
- 9
Description
If I try to change the subnet of an Microsoft.App/managedEnvironments it says that this is not possible, because the subnet id cannot be changed after the creation. How can I achieve that the managedEnvironment is forced to recreated. Adding replace_triggers_refs and lifecycle doesn't do the trick.
Error: Failed to create/update resource
│
│ with azapi_resource.managedEnvironmentTest,
│ on res-test.tf line 13, in resource "azapi_resource" "managedEnvironmentTest":
│ 13: resource "azapi_resource" "managedEnvironmentTest" {
│
│ creating/updating Resource: (ResourceId "/subscriptions//resourceGroups//providers/Microsoft.App/managedEnvironments/" / Api Version "2024-10-02-preview"): PUT
│ https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.App/managedEnvironments/
│ --------------------------------------------------------------------------------
│ RESPONSE 400: 400 Bad Request
│ ERROR CODE: ManagedEnvironmentInfraSubnetIdCannotBeUpdated
│ --------------------------------------------------------------------------------
│ {
│ "error": {
│ "code": "ManagedEnvironmentInfraSubnetIdCannotBeUpdated",
│ "message": "Infrastructure subnet Id can not be changed after environment creation"
│ }
│ }
│ --------------------------------------------------------------------------------
│
Contributor guide
Research direction
Start with the azapi_resource.managedEnvironmentTest configuration in res-test.tf, especially the subnet setting and the attempted replace_triggers_refs and lifecycle options. Trace how the provider handles changes to immutable Azure managedEnvironment properties and compare that behavior with the ManagedEnvironmentInfraSubnetIdCannotBeUpdated response. Done means changing the subnet plans a recreation instead of an in-place update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, go, terraform
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100