-1

I'm looking for a solution to replicate my terraform repositories structure that is always identical

  • config (dev/stg/prod - backend.tf + input.tfvars)
  • tests/
  • main.tf / variables.tf / outputs.tf
  • Jenkinsfile / version / CHANGELOG / README / CONTRIBUTING

I'm looking for a solution to reproduce this structure over new repositories by running a command line such as cookiecutter for Python code, for example.

My goal is to avoid copy/paste from one repo to another, and reuse as much as I can a base already coded (having something good from a DevOps perspective) I dont think cookie cutter supports terraform scripts and I dont know any other potential solution to reproduce terraform repos.

Alex
  • 389
  • 4
  • 21
  • I'm not looking for a template for a tool that would reproduce the content of the template with only the need to change the main+ config inforamtions – Alex Oct 02 '20 at 02:42

1 Answers1

1

Check out Terraspace. It builds Terraform projects to achieve DRY.

Here's a also blog article on it: Introducing Terraspace: The Terraform Framework

tongueroo
  • 1,167
  • 10
  • 5
  • Awesome, I'll look into it to see if tht fits! – Alex Oct 05 '20 at 13:16
  • I tried terraspace and terragrunt, both looked nice for DRY but it wasn't letting me create a skeleton for terraform recipes. I couldn't have a Jenkinsfile already set up, the usual versioning/documentation files and create a the structure I wanted for the config. – Alex Oct 15 '20 at 15:55
  • So I finally created the template using cookiecutter https://cookiecutter.readthedocs.io/en/1.7.2/ I used created several variables such as component.name So when I run cookie cutter it creates a terraform-{{cookiecutter.component_name}} folder with everything I need – Alex Oct 15 '20 at 15:57