Closed tgoodsell-tempus closed 1 month ago
Confirmed this diff. Working on a fix.
Setting the field as Computed
will fix the issue but not sure about removing the ForceNew
.
This field is under initialize_params
which by name implies that if any parameters are changed the instance will be reinitialized. Not sure if we can even update that without ForceNew
but it would be an out of pattern behavior even if we can.
I can't reproduce the issue and see the permadiff
, but apparently multiple users are having the same issue
Hi @ggtisc, Here is a clean config to recreate this diff. Just to clarify that it exists.
Terraform v1.9.5 on linux_amd64
resource "google_compute_resource_policy" "test-policy" {
name = "test-policy"
snapshot_schedule_policy {
schedule {
hourly_schedule {
hours_in_cycle = 1
start_time = "11:00"
}
}
}
}
resource "google_compute_instance" "test-instance" {
name = "test-instance"
machine_type = "n1-standard-1"
zone = var.zone
boot_disk {
initialize_params {
image = "debian-cloud/debian-11"
}
}
network_interface {
network = "default"
}
}
resource "google_compute_disk_resource_policy_attachment" "this" {
name = google_compute_resource_policy.test-policy.name
disk = google_compute_instance.test-instance.name
zone = google_compute_instance.test-instance.zone
project = google_compute_instance.test-instance.project
}
You can get rid of this diff by setting boot_disk.initialize_params.resource_policies
to the same value as in the attachment hence it needs to be Computed: true,
boot_disk {
initialize_params {
resource_policies = [ google_compute_resource_policy.test-policy.id ]
image = "debian-cloud/debian-11"
}
}
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Community Note
Terraform Version & Provider Version(s)
https://github.com/hashicorp/terraform-provider-google/releases/tag/v6.3.0 causes the breaking change
Affected Resource(s)
google_compute_instance
Terraform Configuration
Debug Output
Expected Behavior
Prior to this release, using the
google_compute_disk_resource_policy_attachment
policy was the main tool we could use for adding a snapshot policy to the bootdisk of an instance.We would expect that the use of that pattern would not break with the release of a new field.
Actual Behavior
Per the debug, this causes a conflict between the config for
google_compute_instance
and the state of the GCE resource when used withgoogle_compute_disk_resource_policy_attachment
.I would have expected to have that field be both a:
forceNew
, since clearly we can add in the resource policy and destroy it without affecting the instance itselfcomputed
field (or other mechanism) since this value can be set by this resourceSteps to reproduce
google_compute_disk_resource_policy_attachment
resource.Important Factoids
No response
References
Change which caused this: https://github.com/GoogleCloudPlatform/magic-modules/pull/11527
b/369404586