Skip to content

Terraform Control repository to manage cloud components infra-as-code

License

Notifications You must be signed in to change notification settings

emrecosar/terraformcontrol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terragrunt apply

terraformcontrol

Emre Cosar's Terraform Control repository to manage cloud components infra-as-code

Current Projects

  • polarissquad.fun

AWS accounts

Account Number Account Name
ACCOUNT_ID ACCOUNT_NAME

-- To start working, please update account.yaml's aws_account_id and aws_region based on your configurations.

Project layout

Folder Description
.github Contains default github Pull-Request template and workflows
terraform Contains terraform and terragrunt files needed for automation deployment
.pre-commit-config.yaml Git hook testing scripts

System requirements (macOS)

Install dependencies via Homebrew and setup terraform and terragrunt respectively:

# Install packages
brew install awsume awscli pre-commit tflint tfenv tgenv

# Install terraform and terragrunt from inside terraform folder
cd terraform
tfenv install
tgenv install

You can uninstall terraform and terragrunt from your system, they will be managed by tfenv & tgenv tools.

Please run the following command regularly to ensure the installed tools are up to date:
brew update && brew upgrade && brew cleanup

Tools used

  • tfenv Terraform version manager.
  • tgenv Terragrunt version manager.
  • tflint TFLint is a Terraform linter focused on possible errors, best practices, etc.

Run the test across all files in repo

pre-commit run --all-files

# or you can use a short one:
pre-commit run -a

Available Hooks

There are several pre-commit hooks to keep Terraform configurations (both tf and tfvars) and Terragrunt configurations (hcl) along with others (json, yaml, sh) in a good shape:

  • terraform_fmt - Rewrites all Terraform configuration files to a canonical format.
  • terraform_validate - Validates all Terraform configuration files.
  • terraform_tflint - Validates all Terraform configuration files with TFLint.
  • terraform_docs - Runs terraform-docs and inserts input and output documentation into README.md.
  • terraform_docs_without_aggregate_type_defaults - Sames as above without aggregate type defaults.
  • terraform_docs_replace - Runs terraform-docs and pipes the output directly to README.md
  • terragrunt_fmt - Rewrites all Terragrunt configuration files (*.hcl) to a canonical format.

Branching strategy

Gitflow is a branching strategy model for Git but currently is not being used. Please read this doc to understand it in more details.

Merging PRs

We are using git sqush and merge for getting the PRs merged into the taget branch. It’s simple – before you merge a feature branch back into your main branch (often main or develop), your feature branch should be squashed down to a single buildable commit, and then rebased from the up-to-date main branch.

Please watch this small video (1:27min) to understand the benefit of git squash:

Useful links

About

Terraform Control repository to manage cloud components infra-as-code

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published