GoogleCloudPlatform / terraform-google-managed-instance-group

Modular Google Compute Engine managed instance group for Terraform.
Apache License 2.0
63 stars 139 forks source link

compute_image forces re-creation of compute_instance_template on every terraform plan/apply #28

Closed idsvandermolen closed 5 years ago

idsvandermolen commented 6 years ago

I have to specify

module "nat-zone1" {
  ...
  compute_image = "projects/debian-cloud/global/images/family/debian-9"
  ...
}

to override default debian-cloud/debian-9 compute_image, because otherwise terraform thinks the compute instance template has changed and needs to be recreated every terraform plan or apply:

-/+ module.main.module.nat-zone-1.module.nat-gateway.google_compute_instance_template.default (new resource required)
      id:                                                  "default-20180919081152445300000003" => <computed> (forces new resource)
      can_ip_forward:                                      "true" => "true"
      disk.#:                                              "1" => "1"
      disk.0.auto_delete:                                  "true" => "true"
      disk.0.boot:                                         "true" => "true"
      disk.0.device_name:                                  "persistent-disk-0" => <computed>
      disk.0.disk_size_gb:                                 "0" => "0"
      disk.0.disk_type:                                    "pd-ssd" => "pd-ssd"
      disk.0.interface:                                    "SCSI" => <computed>
      disk.0.mode:                                         "READ_WRITE" => <computed>
      disk.0.source_image:                                 "projects/debian-cloud/global/images/family/debian-9" => "debian-cloud/debian-9" (forces new resource)
      disk.0.type:                                         "PERSISTENT" => "PERSISTENT"
      machine_type:                                        "f1-micro" => "f1-micro"

Terraform version used:

terraform --version
Terraform v0.11.8
+ provider.google v1.18.0
+ provider.null v1.0.0
+ provider.random v2.0.0
+ provider.template v1.0.0
danisla commented 6 years ago

Thanks for reporting this. Unfortunately this is an upstream provider bug, see: https://github.com/terraform-providers/terraform-provider-google/pull/1995

I'll see if there is some workaround in the meantime.

danisla commented 5 years ago

We fixed this in the nat gw module with https://github.com/GoogleCloudPlatform/terraform-google-nat-gateway/pull/93

I'll create a similar patch for this module.

idsvandermolen commented 5 years ago

thanks