So... ahem what other idiots came here expecting a post about troubleshooting Martian habitability? ::Sulks off dejectedly::
At least one :)
Terraform Gotchas and How We Work Around Them
11–20 of 82 posts
Re: Terraform Gotchas and How We Work Around Them
#12So... ahem what other idiots came here expecting a post about troubleshooting Martian habitability? ::Sulks off dejectedly::
Re: Terraform Gotchas and How We Work Around Them
#13Did you try to use `terraform state mv`? I've found that command useful (albeit for much less than thousands of resources).
Re: Terraform Gotchas and How We Work Around Them
#14So... ahem what other idiots came here expecting a post about troubleshooting Martian habitability? ::Sulks off dejectedly::
Re: Terraform Gotchas and How We Work Around Them
#15Earlier quoted context omitted.
Great post! I too had the issue with AWS volume attachments and the need to separate them out. Luckily it happened early during some of my first provisioning and we realized it before standing up more databases. I now have a policy where each server has a separate EBS volume, using a volume attachment Terraform resource, for any data. Inline EBS volumes are just used for the OS. I've run into another similar type iss…
We ran into similar issues. From there I went one step further and wrote a tool to do the attachments for me (instead of using Terraform's aws_volume_attachment): https://github.com/sevagh/goat This way in Terraform I provision a group of volumes, a group of instances, and rely on `goat` to do the rest.
(Btw I think I know people you know... also in Montreal and I know a couple folks at AdGear!)
Re: Terraform Gotchas and How We Work Around Them
#16I have in my dotfiles:
alias tfplan='terraform plan -out=.tfplan -refresh=false'
alias tffreshplan='terraform plan -out=.tfplan'
alias tfapply='terraform apply .tfplan; rm .tfplan'
That way I never accidentally `terraform apply` without creating a plan first. I also have it not refresh the state by default, which is mostly unnecessary and speeds up the planning significantly.Re: Terraform Gotchas and How We Work Around Them
#17>Terraform state surgery Did you try to use `terraform state mv`? I've found that command useful (albeit for much less than thousands of resources).
An alternative to doing this was `terraform import` on all the volumes, then defining attachments, and hoping it all worked when you run `terraform plan`. I don't 100% remember now why we didn't do that.
Re: Terraform Gotchas and How We Work Around Them
#18Hey author here! Happy to answer any questions etc :-)
Shameless plug, if anybody is looking for a guide on getting started with Terraform and Google Cloud Platform, I wrote a short blog post:
https://blog.elasticbyte.net/getting-started-with-terraform-...
Re: Terraform Gotchas and How We Work Around Them
#19Re: Terraform Gotchas and How We Work Around Them
#20> Always write your plan -out, and apply that plan I have in my dotfiles: alias tfplan='terraform plan -out=.tfplan -refresh=false' alias tffreshplan='terraform plan -out=.tfplan' alias tfapply='terraform apply .tfplan; rm .tfplan' That way I never accidentally `terraform apply` without creating a plan first. I also have it not refresh the state by default, which is mostly unnecessary and speeds up the planning signi…
I always refresh when running the pre-apply plan, but while iterating I use that. Do you always run your `tffreshplan` command before applying?