Skip to content

Commit

Permalink
Updated readme to include github action example (transcend-io#38)
Browse files Browse the repository at this point in the history
Co-authored-by: dmattia <david@transcend.io>
  • Loading branch information
dmattia and dmattia authored Jul 9, 2020
1 parent 32719c2 commit 0a41ff2
Showing 1 changed file with 64 additions and 31 deletions.
95 changes: 64 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,44 @@ This tool creates Atlantis YAML configurations for Terragrunt projects by:

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:

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

Alternative: Install a stable versions via Homebrew:

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

Usage:

```bash
# 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.

## Extra dependencies

For 99% of cases, this tool can sniff out all dependencies in a module. However, you may have times when you want to add in additional dependencies such as:
Expand Down Expand Up @@ -56,43 +94,38 @@ In your `atlantis.yaml` file, you will end up seeing output like:
dir: example-setup/extra_dependency
```
## Installation and Usage
Recommended: Install any version via go get:
```bash
cd && GO111MODULE=on go get github.com/transcend-io/terragrunt-atlantis-config@master && cd -
```
## Auto Enforcement with Github Actions
Alternative: Install a stable versions via Homebrew:
It's a best practice to require that `atlantis.yaml` stays up to date on each Pull Request.

```bash
brew install transcend-io/tap/terragrunt-atlantis-config
```
To make this easy, there is an open-source Github Action that will fail a status check on your PR if the `atlantis.yaml` file is out of date.

Usage:
To use it, add this yaml to a new github action file in your repo:

```bash
# 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
```yaml
name: terragrunt-atlantis-config
on:
push:
paths:
- '**.hcl'
- '**.tf'
- '**.hcl.json'
jobs:
terragrunt_atlantis_config:
runs-on: ubuntu-latest
name: Validate atlantis.yaml
steps:
- uses: actions/checkout@v2
- name: Ensure atlantis.yaml is up to date using terragrunt-atlantis-config
id: atlantis_validator
uses: transcend-io/terragrunt-atlantis-config-github-action@v0.0.3
with:
version: v0.5.0
extra_args: '--autoplan --parallel=false
```

Finally, check the log output (or your output file) for the YAML.
You can customize the version and flags you typically pass to the `generate` command in those final two lines.

## Contributing

Expand Down

0 comments on commit 0a41ff2

Please sign in to comment.