Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform forces to recreate instance after gcloud compute instances move #20463

Closed
Cib0rg opened this issue Feb 25, 2019 · 2 comments
Closed

Comments

@Cib0rg
Copy link

Cib0rg commented Feb 25, 2019

Hello.

We use terraform. We create large infrastructure with it and now trying to scale it down. Earlier we put instances in three zones and now we need only two zones. So I try to move instances between zones with gcloud compute instance move and terraform always try to recreate instance. Even after manual correction of tfstate i see following:

-/+ google_compute_instance.us1101apn[2] (new resource required)
id: "us1101apn003" => (forces new resource)
allow_stopping_for_update: "true" => "true"
boot_disk.#: "1" => "1"
boot_disk.0.auto_delete: "true" => "true"
boot_disk.0.device_name: "persistent-disk-0" =>
boot_disk.0.disk_encryption_key_sha256: "" =>
boot_disk.0.initialize_params.#: "1" => "1"
boot_disk.0.initialize_params.0.image: "" => "project/some-image" (forces new resource)

But when I try to take a look into state I see following:

terraform state show google_compute_instance.us1101apn[2]
id = us1101apn003
allow_stopping_for_update = true
attached_disk.# = 0
boot_disk.# = 1
boot_disk.0.auto_delete = true
boot_disk.0.device_name = persistent-disk-0
boot_disk.0.disk_encryption_key_raw =
boot_disk.0.disk_encryption_key_sha256 =
boot_disk.0.initialize_params.# = 1
boot_disk.0.initialize_params.0.image = https://www.googleapis.com/compute/v1/projects/project/global/images/some-image

Terraform Version

Terraform v0.11.11

  • provider.google v1.20.0

Expected Behavior

Terraform should correctly pick up data from it state

Actual Behavior

Terraform don't pick up disk image data

Steps to Reproduce

  1. Create some instance
  2. gcloud compute instance move it to another zone
  3. (optional) Correct zones in tfstate
  4. terraform plan

Additional Context

References

@Cib0rg Cib0rg changed the title Terraform fail forces to recreate instance after gcloud compute instances move Terraform forces to recreate instance after gcloud compute instances move Feb 25, 2019
@ghost
Copy link

ghost commented Feb 25, 2019

This issue has been automatically migrated to hashicorp/terraform-provider-google#3117 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-google#3117.

@ghost ghost closed this as completed Feb 25, 2019
@ghost
Copy link

ghost commented Mar 29, 2020

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.

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants