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

Better DiffSuppressFunc for disk image field #884

Merged
merged 2 commits into from
Dec 21, 2017

Conversation

rosbo
Copy link
Contributor

@rosbo rosbo commented Dec 20, 2017

Fixes #861

Resizing disk while the instance is running is already supported. The problem came from a diff in the image field causing a ForceNew.

image:                      "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-8-jessie-v20171213" => "debian-cloud/debian-8" (forces new resource)

This PR adds a better DiffSuppressFunc for the disk image field which allows to resize the disk without causing a force new.

@rosbo
Copy link
Contributor Author

rosbo commented Dec 20, 2017

--- PASS: TestAccComputeDisk_timeout (0.09s)
--- PASS: TestAccComputeDisk_encryption (23.44s)
--- PASS: TestAccComputeDisk_basic (24.17s)
--- PASS: TestAccComputeDisk_update (45.20s)
--- PASS: TestAccComputeDisk_deleteDetach (62.05s)
--- PASS: TestAccComputeDisk_fromSnapshot (107.61s)

Copy link
Contributor

@danawillow danawillow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work for that particular shorthand case, but it's not comprehensive. I'm fine with fixing it this way with the assumption that the majority of users are either specifying full URLs or this particular shorthand, but technically there are other cases that aren't handled (basically any of the "family" ones from https://github.com/terraform-providers/terraform-provider-google/blob/master/google/image.go)

@rosbo
Copy link
Contributor Author

rosbo commented Dec 20, 2017

I wasn't aware of the family case. I will update this PR to handle it.

@rosbo
Copy link
Contributor Author

rosbo commented Dec 21, 2017

@danawillow I handle more cases now. Could you re-review it? Thanks

@rosbo rosbo merged commit bded8d1 into hashicorp:master Dec 21, 2017
@rosbo rosbo deleted the resize-disk branch December 21, 2017 18:00
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this pull request Sep 27, 2019
Signed-off-by: Modular Magician <magic-modules@google.com>
@chandan-rapido
Copy link

chandan-rapido commented Oct 11, 2019

when I try to resize disk it is still replacing the instance. My Terraform version is v0.12.9.

terraform plan output:

      ~ initialize_params {
          ~ image  = "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20190816" -> "ubuntu-1604-xenial-v20190816"
          ~ labels = {} -> (known after apply)
          ~ size   = 200 -> 250 # forces replacement
            type   = "pd-ssd"
        }
    }

@ghost
Copy link

ghost commented Oct 11, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Oct 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resize disk destroy and recreate vm
3 participants