Open mldmld68 opened 1 month ago
I don't think there's anything we can do on the provider side here. This is just how Terraform works. As new fields are added to Terraform they are tracked by the resource, so Terraform will start to manage them.
You can add ignore_changes to prevent this for specific fields: lifecycle { ignore_changes = [boot_disk.initialize_params.resource_policies] }
Yes, terraform start to manage them, but I would like the resource not being rebuilt for a change of this field
Adding this as an enhancement rather than a bug then
Reopening as not wanting permadiff =/= not wanting a force new
Note from triage: Initially we thought that it's valid to have initialize_params for boot_disk force resources to be recreated when they change, as the initialize params arguments control when a resource is first made. Changing those values implies wanting to recreate a resource using new inputs. However if these values are being impacted by using snapshots with the disk we'd like the service team to investigate further.
Community Note
We deployed since years a Cloud Function to automatically associate a snapshot schedule each time a GCE is started in our GCP organzation. Whatever the way : console or terraform. It appears the associated schedule is setup in the resource_policies field of the GCE.
With this new feature, all our GCE are planed to be rebuilt because our existing code do not manage it (normal, it was not availabled before) and the property is not empty on all our GCEs.
Terraform Version & Provider Version(s)
Terraform v1.7.2 on x86
Affected Resource(s)
google_compute_instance
Terraform Configuration
Debug Output
Expected Behavior
The GCE should not be rebuilt with such parameter change. In particular for a snapshot schedule setting
Actual Behavior
The GCE are rebuilt
Steps to reproduce
terraform apply
Important Factoids
We deployed since year a Cloud Function to automatically associate a snapshot schedule each time a GCE is started in our GCP organzation. Whatever the way : console, gcloud or terraform. It appears the associated schedule is setup in the resource_policies field of the GCE.
With this new feature, all our GCE are planed to be rebuilt because our existing code do not manage it (normal, it was not availabled before) and the property is not empty on all our GCEs.
References
No response
b/372018525