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

autoplan not working for .hcl files with default auto plan #803

Closed
JoshiiSinfield opened this issue Oct 11, 2019 · 1 comment · Fixed by #858
Closed

autoplan not working for .hcl files with default auto plan #803

JoshiiSinfield opened this issue Oct 11, 2019 · 1 comment · Fixed by #858
Labels
bug Something isn't working

Comments

@JoshiiSinfield
Copy link
Contributor

JoshiiSinfield commented Oct 11, 2019

Hi,

I'm seeing an issue where autoplan is not detecting changes in a directory where terragrunt.hcl file is updated.

I'm using the "latest" version of the docker container..

We have repos.yaml setup with the following:

---
repos:
  - id: /.*/
    allow_custom_workflows: true
    allowed_overrides:
      - workflow
    apply_requirements: [approved, mergeable]
    workflow: terragrunt


# workflows lists server-side custom workflows
workflows:
  terraform:
    plan:
      steps:
        - init
        - plan
    apply:
      steps:
        - run: echo Running Terraform Apply
        - apply
  terragrunt:
    plan:
      steps:
        - run: terragrunt plan --terragrunt-non-interactive -no-color -out $PLANFILE
    apply:
      steps:
        - run: terragrunt apply --terragrunt-non-interactive -no-color $PLANFILE

  terragrunt-tf-11:
    plan:
      steps:
        - run: terragrunt-0.18.7 plan --terragrunt-non-interactive --terragrunt-tfpath /usr/local/bin/tf/versions/0.11.14/terraform -no-color -out $PLANFILE
    apply:
      steps:
        - run: terragrunt-0.18.7 apply --terragrunt-non-interactive --terragrunt-tfpath /usr/local/bin/tf/versions/0.11.14/terraform -no-color $PLANFILE

  terragrunt-all:
    plan:
      steps:
        - run: terragrunt plan-all --terragrunt-source-update --terragrunt-non-interactive -no-color -out $PLANFILE
    apply:
      steps:
        - run: terragrunt apply-all --terragrunt-source-update --terragrunt-non-interactive -no-color

the repo also has atlantis.yaml configured as below(small snippet):

- name: josh-test1
  dir: josh/test1
  workspace: josh-test1
  workflow: terragrunt-tf-11
  terraform_version: v0.11.14
- name: josh-test2-tf12
  dir: josh/test2/tf12
  workspace: josh-test2-tf12
  workflow: terragrunt

Both of these configurations work together for a new folder added, however when modifying files that already exist it doesn't pick them up by default.

I've seen #748 and have traced through code and comments and believe

const DefaultAutoPlanWhenModified = "**/*.tf*"

is causing the issue. I think it should be updated to allow "**/terragrunt.hcl" too.

Output in the logs shows looping through every project configured in the atlantis.yaml, but ending with: "0 projects are to be planned based on their when_modified config".
we don't specify a when_modified anywhere as can be seen, which is what got me searching for a default and hence the above suggestion.

Cheers,
Josh

@JoshiiSinfield JoshiiSinfield changed the title autoplan not working for .hcl files autoplan not working for .hcl files with default auto plan Oct 11, 2019
@lkysow lkysow added the bug Something isn't working label Oct 11, 2019
@lkysow
Copy link
Member

lkysow commented Oct 11, 2019

Yes this should be **/*.tf* and **/terragrunt.hcl

lkysow pushed a commit that referenced this issue Jan 20, 2020
Update defaultwhenmodified to include **/terragrunt.hcl

This allows a pre-existing TG 0.19+ project to autoplan if no when_modified is set

Closes #803
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants