/terragrunt-atlantis-config

Generate Atlantis config for Terragrunt projects.

Primary LanguageGoMIT LicenseMIT

Terragrunt Atlantis Config by Transcend

Terragrunt Atlantis Config

Generate Atlantis Config for Terragrunt projects.


What is this?

Atlantis is an awesome tool for Terraform pull request automation. Each repo can have a YAML config file that defines Terraform module dependendcies, so that PRs that affect dependent modules will automatically generate terraform plans for those modules.

Terragrunt is a Terraform wrapper, which has the concept of dependencies built into its configuration.

This tool creates Atlantis YAML configurations for Terragrunt projects by:

  • Finding all terragrunt.hcl in a repo
  • Evaluating their "dependency" and "terraform" source blocks to find their dependencies
  • Creating a Directed Acyclic Graph of all dependencies
  • Constructing and logging YAML in Atlantis' config spec that reflects the graph

This is especially useful for organizations that use monorepos for their Terragrunt config (as we do at Transcend), and have thousands of lines of config.

Installation and Usage

Recommended: Install any version via go get:

cd && GO111MODULE=on go get github.com/transcend-io/terragrunt-atlantis-config@master && cd -

Alternative: Install a stable versions via Homebrew:

brew install transcend-io/tap/terragrunt-atlantis-config

Usage:

# From the root of your repo
terragrunt-atlantis-config generate

# or from anywhere
terragrunt-atlantis-config generate --root /some/path/to/your/repo/root

# output to a file
terragrunt-atlantis-config generate --autoplan --output ./atlantis.yaml

# enable auto plan
terragrunt-atlantis-config generate --autoplan

# define the workflow
terragrunt-atlantis-config generate --workflow web --output ./atlantis.yaml

# ignore parent terragrunt configs (those which don't reference a terraform module)
terragrunt-atlantis-config generate --ignore-parent-terragrunt

Finally, check the log output (or your output file) for the YAML.

Contributing

To test any changes you've made, run make test.

Once all your changes are passing and your PR is reviewed, a merge into master will trigger a CircleCI job to build the new binary, test it, and deploy it's artifacts to an S3 bucket.

You can then open a PR on our homebrew tap similar to transcend-io/homebrew-tap#4, and as soon as that merges your code will be released.

License

FOSSA Status