Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Terragrunt #177

Closed
klub opened this issue Jul 10, 2018 · 9 comments
Closed

Support for Terragrunt #177

klub opened this issue Jul 10, 2018 · 9 comments

Comments

@klub
Copy link

klub commented Jul 10, 2018

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

@lkysow
Copy link
Member

lkysow commented Jul 10, 2018

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.

@lkysow
Copy link
Member

lkysow commented Jul 10, 2018

Let me know if that works?

@lkysow
Copy link
Member

lkysow commented Jul 10, 2018

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.

@lkysow
Copy link
Member

lkysow commented Jul 11, 2018

FYI this is available in the latest release (0.4.1) now.

@lkysow lkysow added the waiting-on-response Waiting for a response from the user label Jul 11, 2018
@bewie
Copy link
Contributor

bewie commented Jul 23, 2018

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 : hashicorp/terraform#14847

@lkysow
Copy link
Member

lkysow commented Jul 23, 2018

Oh interesting. Can you give me an example of your config then so I can document this?

@bewie
Copy link
Contributor

bewie commented Jul 23, 2018

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.

@lkysow
Copy link
Member

lkysow commented Aug 3, 2018

Terragrunt is working in the latest release.

@lkysow lkysow closed this as completed Aug 3, 2018
@lkysow lkysow removed the waiting-on-response Waiting for a response from the user label Aug 3, 2018
@shapeofarchitect
Copy link

@lkysow Did the terrahelp mask worked for you as @bewie shared the spec. ? I want to make sure it works before I implement in our workflow.

meringu pushed a commit to meringu/atlantis that referenced this issue May 29, 2023
* Refactor modified project detector and test

* Test plan_executor

* Unexport fields

* Update modified_projects_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants