-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Disk downsize triggers recreate #8597
Comments
@przsab Can you share your Terraform config you are using and the steps to repro the error? |
Absolutely, same results are reproduced on v0.12.29, v0.13.4 and v0.14.7 using latest plugin 3.58.0.
Disk is scaled to 5 from 10:
Same attempt with gcloud yields expected error:
|
And from competition:
|
@przsab below is the plan I got in my test and it seems fine (note: dose not say recreate on disk). I also see the resize call without tearing down the disk in the log. There is also a specific test in the provider.
|
@przsab downsizing disk is different and does trigger recreation which works as intended as GCP only allows upsizing through the API. Below is what I got. If you want to prevent destroy, you may add
|
This is not the correct behavior, downsizing disk should cause an error not replace disk with smaller, empty one. Prevent destroy is static feature and can't be parameterized, thus breaks any attempts to automate via pipelines (no, we can't consider sed or awk a solution to this). Maybe disk replacement is useful for hello-world examples where you serve welcome page from nginx container, but for anything serious Terraform should follow API behavior and error out, just like AWS provider does. |
Hey @przsab! Terraform is a higher-level tool than something like So in contrast with Our team definitely feels that destroying resources in these resources should be harder than it is, too. See hashicorp/terraform#24658. |
Is the suggestion here to modify CD pipelines to scan for disk destroy operations in I understand you are fully aware of below unaddressed issues: Is there anything else besides backwards-compatibility stopping you from implementing this change? What if solution relied on new lifecycle rule, i.e. |
@przsab as we have explained this behavior is by design. It is not a bug. You may file an enhancement instead so your request will be triaged. I am closing this issue now. |
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! |
Terraform provider recreates
google_compute_disk
during attempt to downscale whereas regular API throws expected error.When somebody misses a 0 in new disk size, all data is gone.
How API works:
How Terraform works:
The text was updated successfully, but these errors were encountered: