How to ignore_body_changes for nested properties
I want to setup an vm gallery, however I would like to ignore properties inside a list:
~ resource "azapi_resource" "gallery_application_version_linux" {
~ body = jsonencode(
~ {
~ properties = {
~ publishingProfile = {
~ targetRegions = [
~ {
~ name = "West Europe" -> "westeurope"
# (2 unchanged attributes hidden)
},
]
# (8 unchanged attributes hidden)
}
# (1 unchanged attribute hidden)
}
}
)
id = "/subscriptions/***/resourceGroups/rg-dev-opsstack-westeurope-001/providers/Microsoft.Compute/galleries/DEV_GAL_OPSSTACK_WESTEUROPE_001/applications/opsstack-agent-linux/versions/1.1.0"
ignore_body_changes = [
"properties.publishingProfile.source.media_link",
"properties.publishingProfile.targetRegions.*.name",
]
name = "1.1.0"
# (9 unchanged attributes hidden)
}
I tired properties.publishingProfile.targetRegions.*.name, however it seems like it has not affect.
I quickly read the the code and the provider does not seem to support the override of specific item in list.
Hi @jkroepke ,
Thank you for taking time to report this issue and apologize for late response.
Thanks @gianrubio for answering the question, and yes, the provider doesn't support the override of specific item in the list.
More details: https://github.com/Azure/terraform-provider-azapi/issues/315#issuecomment-1716943998
Also would like ability to ignore specific item + property in a list. We are deploying Azure Container Apps via AzApi. Terraform creates the container app resource for us with the latest image tag. Once the app is created, we use Azure DevOps to apply image updates to the container app.
Ideally, we can use "ignore_body_changes" to ignore "properties.template.containers[0].image"
My from point of view, this can be archived by using json path at the ignore property.
Adding the following snippet to the azapi_resource doesn't work as intented. Just like @jsheetzmt pointed out.
ignore_body_changes = ["properties.template.containers[0].image"]
I was doing something wrong. It works as expected for me @jsheetzmt
I was doing something wrong. It works as expected for me
Could you please provide some example of working config? @mvanhil It seems it should not work: https://github.com/Azure/terraform-provider-azapi/issues/315
For me it does not work either, have tried following:
ignore_body_changes = ["properties.template.containers[0].image"]
ignore_body_changes = ["properties.template.containers[\"job_name\"].image"]
ignore_body_changes = ["properties.template.containers"]
I am also trying to achieve same thing. For me it did not work with ignore_body_changes = ["properties.template.containers"]
Getting the error as below.
Error: ignoring specific item in list is not supported
@mvanhil : Can u please share configuration if it is working for you.
In the meanwhile I migrated all the azapi stuff to the modified TF resources. I was missing the workload profile feature, but since that has been added, I migrated everything over. A lot easier now. :-)
@mvanhil: Thanks for your quick response.