I currently have a module which contains a block with many configurable properties
resource "example_resource" "instance1" {
block1 {
property1 = var.variable1 # Should generate a diff if changed
property2 = var.variable2 # Ignore
property3 = var.variable3 # Ignore
....
....
propertyN = var.variableN # Ignore
}
lifecycle {
ignore_changes = [
block1[0].property2, block1[0].property3, ... ,block1[0].propertyN
]
}
}
Once the resource has been generated many of the properties within block1 are likely to change due to interaction with the user. I want to ignore such changes when running a terraform plan apart from a few exceptions which should generate a difference if changed in the future. (For example in the above resource if property1 is changed it should generate a diff but not for the others)
Ignoring such changes can be done using the ignore_changes within lifecycle block. But it seems like to do the above. Adding the entire block1 argument to this will cause all changes within to be ignored, or we have to add all ignored properties within the block one by one to the ignore_changes block as I have mentioned in the example.
Manually doing as such makes things a bit harder to maintain, as you will have to keep adding/removing new properties as a new property is added/removed to the block. So is it possible to configure the ignore_changes block to ignore all changes and specifically add the required exceptions?
P.S.
I do not believe this question is specific to a certain resource, But the resource I am trying to implement this concept to is the Azure App Service Resource, specifically to the site_config block within it.