Skip to content

monterail/terraform-bootstrap-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Bootstrap example

Example solution for 🥚 vs 🐔 problem - how to create infrastructure for remote Terraform backend with Terraform?

Assumptions

  • Terraform installed (approach tested against v0.12.24)
  • AWS S3 backend with DynamoDB table for locking will be used
  • operator should have AWS credentials in profile - for the purpose of this repo we use terraform profile
  • backend will be created and maintained under base workspace

Development

Before applying you should update backend.tfvars with backend configuration. You should also update list of operators AWS usernames in the setup/variables.tf file.

If you want to use workspaces per environment (as we and Hashicorp recommends) it might be convenient to name basic one base or leave default for backend infrastructure only.

Explanation

When you run setup.sh the script will create required S3 bucket and DynamoDB table with local backend and then it will initialize remote backend where it will migrate the local state. Terraform will ask for confirmation during creation of required resources and if operator wants to migrate the state.

Problems not solved

  • AWS S3 policies doesn't support groups so each operator must be added explicit to the policy file

Questions and/or suggestions

Please open an issue if something is not clear or you can suggest a better solution.

About

Template repo for new projects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •