-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
[improvement] google_compute_disk support for resizing disk #10442
Comments
Hey @JorritSalverda! Thanks for bringing this up. Definitely a great feature that we'd love to add. Looking into it a bit:
As for updating your tfstate, you should be able to just update the config, and refresh should update the state to show the new size. If not, that's a bug, and please let me know! So this is a bit complicated, and has some work that needs to get done before it's feasible. Which isn't to say that it won't happen, but I just want to set expectations accordingly that it may not happen immediately, and if/when it does happen, there may be some caveats around the filesystem. |
Increasing the size of the disk using gcloud and then refreshing the state does not update the size in the state. As for growing the filesystem, that can be done while mounted without a reboot. I suspect it could be implemented in a null_resource using a trigger and a remote-exec, without the need for additional Terraform changes. |
Support for this was added in #15077. However, it does not address the pitfalls noted in this issue, so please be very careful when using it. |
In Terraform 0.9.8 resizing disks works beautifully. Thanks! To resize the filesystem online, I used a null_resource like this:
It gets a little trickier for devices which are partitioned, but doable. |
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. |
Increasing the size of google_compute_disk forces recreation, however it's possible to resize a google cloud disk on the fly, see https://cloud.google.com/compute/docs/disks/add-persistent-disk.
Instead of recreating the resource just modifying the size would be ideal. Now I still have to do that outside of terraform and then update my tf file and the terraform.tfstate file to reflect the new size.
Terraform Version
Terraform v0.7.13
Affected Resource(s)
google_compute_disk
The text was updated successfully, but these errors were encountered: