> 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…
Oh interesting. Note to self: see if there's an option to disable `terraform apply` without a plan. I always refresh when running the pre-apply plan, but while iterating I use that. Do you always run your `tffreshplan` command before applying?
Terraform Gotchas and How We Work Around Them
21–30 of 82 posts
Re: Terraform Gotchas and How We Work Around Them
#22Re: Terraform Gotchas and How We Work Around Them
#23Earlier quoted context omitted.
Oh interesting. Note to self: see if there's an option to disable `terraform apply` without a plan. I always refresh when running the pre-apply plan, but while iterating I use that. Do you always run your `tffreshplan` command before applying?
Agree would be nice to add a new option which prevents invoking `apply` without a supplied plan argument. Create an issue in the GitHub, I'll upvote.
Re: Terraform Gotchas and How We Work Around Them
#24Oh, geeze. This is about: terraform.io
Re: Terraform Gotchas and How We Work Around Them
#25Oh, geeze. This is about: terraform.io
Re: Terraform Gotchas and How We Work Around Them
#26Hey author here! Happy to answer any questions etc :-)
Great post. I think the area where things start to go off the rails with Terraform is variables/modules though. There are edge cases and gotchas with modules and not a lot of best practice guides. 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
#27Hey author here! Happy to answer any questions etc :-)
Re: Terraform Gotchas and How We Work Around Them
#28> 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…
https://github.com/hashicorp/terraform/blob/master/website/s...
Re: Terraform Gotchas and How We Work Around Them
#29Hey author here! Happy to answer any questions etc :-)
We're using Terraform for our AWS env and while it worked great for getting stuff out there, we're now scrambling to figure out how to get Terraform to do non-destructive updates to the environment. For instance, I need to update our base OS for the application servers we're running. How do I do this without incurring a downtime? Or I need to now interject a new reverse proxy between our ELB's and app servers, but wa…
1) Update the launch configuration of your un-used ASG ( with the new AMI ID )
2) Apply terraform to deploy the new ASG
3) Make sure it's working ( your local app on your new instances )
4) Connect the ELB to your new ASG
5) Set the old ASG to 0 instances to drain the connections
Re: Terraform Gotchas and How We Work Around Them
#30Hey author here! Happy to answer any questions etc :-)
We're using Terraform for our AWS env and while it worked great for getting stuff out there, we're now scrambling to figure out how to get Terraform to do non-destructive updates to the environment. For instance, I need to update our base OS for the application servers we're running. How do I do this without incurring a downtime? Or I need to now interject a new reverse proxy between our ELB's and app servers, but wa…
[0] https://www.terraform.io/docs/configuration/resources.html#c...