Hi,
I have looked through the documentation and also through the source code and it appears it is not possible to use Terragrunt. Is this correct?
If so, will there be any plans to implement support for Terragrunt? If not, is there particular approach you recommend for implementing Terragrunt compatibility into this project?
Thanks
Hi Bonamy,
I just tried it using the custom commands that Atlantis supports and it seems to work.
I have a repo structure like:
.
โโโ atlantis.yaml
โโโ live
โย ย โโโ prod
โย ย โย ย โโโ terraform.tfvars
โย ย โโโ staging
โย ย โโโ terraform.tfvars
โโโ modules
โโโ null
โโโ main.tf
Where I'm using the local modules/null in my terraform.tfvars:
terragrunt = {
terraform {
source = "../../modules/null"
}
}
And the contents of atlantis.yaml were:
version: 2
projects:
- dir: live/staging
workflow: terragrunt
autoplan:
when_modified: ["*.tf*", "../../modules/null/*.tf"]
- dir: live/prod
workflow: terragrunt
autoplan:
when_modified: ["*.tf*", "../../modules/null/*.tf"]
workflows:
terragrunt:
plan:
steps:
- run: TF_CLI_ARGS='-no-color' terragrunt plan -out $PLANFILE
apply:
steps:
- run: TF_CLI_ARGS='-no-color' terragrunt apply $PLANFILE
When the pull request was opened, it run terragrunt plan successfully and to apply, I ran atlantis apply -d live/staging and atlantis apply -d live/prod.
Let me know if that works?
Oh, you'll have to use the current master branch of Atlantis because the latest release doesn't have the PLANFILE environment variable available yet.
FYI this is available in the latest release (0.4.1) now.
Hi,
It's works well on my side. Just a thing that I had to use the --no-color in terragrunt cli and not in exported env-var due to a bug in terraform : https://github.com/hashicorp/terraform/issues/14847
Oh interesting. Can you give me an example of your config then so I can document this?
Sure, here an example of my atlantis.yaml :
version: 2
projects:
- name: project1
dir: path/project1
workflow: terragrunt
workspace: default
autoplan:
when_modified: ["*.tfvars"]
enabled: true
apply_requirements: [approved]
workflows:
terragrunt:
plan:
steps:
- run: terragrunt plan --no-color -out $PLANFILE | terrahelp mask
apply:
steps:
- run: terragrunt apply --no-color $PLANFILE | terrahelp mask
And I use terrahelp to mask the sensitive data on output.
Terragrunt is working in the latest release.
Most helpful comment
Sure, here an example of my
atlantis.yaml:And I use terrahelp to mask the sensitive data on output.