Closed AndrewFarley closed 6 years ago
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
:memo: Please visit https://cla.developers.google.com/ to sign.
Once you've signed (or fixed any issues), please reply here (e.g. I signed it!
) and we'll verify it.
I signed it!
CLAs look good, thanks!
Thanks for the PR. I've been avoiding this breaking change but I think it's finally time to do it. Sorry but I ended up merging a similar change already, this one also deprecates the random_id resource and updates the README with a note about the version pinning.
@danisla Thanks for that... despite being breaking changes, these are vital changes for an iterable infrastructure. Cheers!
Problem:
When modifying anything in the instance template, for example, the machine type, it is unable to make this modification in terraform because of a duplicate named resource. Using the lifecycle rule "create before destroy" is necessary, but because of this, there can not be two similarly named templates. For example, when changing the machine type of a template you get...
* google_compute_instance_template.default: Error creating instance template: googleapi: Error 409: The resource 'projects/projectname/global/instanceTemplates/default-7850850885292525658' already exists
Solution:
There is a terraform feature called "name_prefix" instead of "name" in most resources which helps fix this use-case. This merge implements it for the google_compute_instance_template
Notes:
Keep in mind, anyone that is using this template hopefully they have version locked (as is best practice for modules) the previous version, because if they did not they will suddenly have a changed name and re-creating of the template the next time they
terraform init
which might cause unexpected downtime. I think it's something worth noting in the release notes, and to consider modifying your Usage Example to include version pinning (which it does not currently)