4 ms·
I think there's a middle ground if you're not sure how to fix a mistake in Terraform but you know how to do it in the console: * Make your changes by hand * R
by kstrauser 6y ago
I think there's a middle ground if you're not sure how to fix a mistake in Terraform but you know how to do it in the console:
* Make your changes by hand
* Right afterward, run "terraform plan" to see how Terraform would undo your changes
* Edit your Terraform config to reflect those changes, and run "terraform plan" again to make sure you caught everything. Repeat until it's a no-op.
Now you've got a log of what you've done in a Git-ready format, and you can repeat it elsewhere, and you've learned how to make that console change in code.
- matwood 6y agoYou can do it that way, but I find the tf docs easier and more concise to use than clicking around the AWS UI.
- kstrauser 6y agoI do too, but that was an invaluable tool when we were first switching over and learning the ropes.
- pm90 6y agoThis. I’m surprised at how many folks don’t realize you can do this and capture your changes in terraform by looking at the plan and making tf code changes until the plan doesn’t show a diff
- te_chris 6y agoYou can also fetch cloud resource state with terraform, without running plan - I can’t remember the exact command. You can use this to import new resources into tf