Skip to content

Opinionated patterns for doing everything with Terraform, so you can handle hacky workarounds with confidence

License

Notifications You must be signed in to change notification settings

pacon-vib/tfcando

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to do anything in Terraform

Terraform is a powerful, best-in-breed tool for infrastructure-as-code. But every infracoder is destined to hit that point in their journey where they need to do something that is not supported in Terraform, and the journey comes to abrupt halt.

"I can't do this in Terraform, what now?" Is it necessary to go back and start my IaC again using a different tool? Well, maybe not.

The patterns in this repo will help you understand the trade-offs involved in the various ways to get your job done even if the official provider does not natively support it. If you understand, at least in general terms, how each option works, then you can assess the risk and select the right way forward for your project.

To solve any problem in Terraform, simply follow the list below:

Pattern When to use...
Official or community provider Whenever possible!
Local-exec or other built-in "escape hatches" Simple commands that are unlikely to fail
Shell provider
  • For proofs of concept
  • A command-line tool solves the problem neatly, you just need to manage state
  • You don't know how to Golang and there is insufficient time to learn
  • There is no provider at all, and the task at hand doesn't justify creating a new one
Writing/patching a provider
  • Long-term production use
  • To contribute to the community's IaC capability

Miscellaneous patterns

The following pages contain information about other ways of getting things done in Terraform. I don't recommend them, but the information may prove useful.

  • Cloud platform-specific templating (e.g. ARM templates, CloudFormation)
  • restapi provider
  • Calling cloud platform APIs directly from shell scripts

About

Opinionated patterns for doing everything with Terraform, so you can handle hacky workarounds with confidence

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published