terragrunt-atlantis-config icon indicating copy to clipboard operation
terragrunt-atlantis-config copied to clipboard

Error when trying to run plan in a directory that does not contain terragrunt.hcl file

Open pantelis-karamolegkos opened this issue 2 years ago • 2 comments

I have the following repoConfig.yaml

    - run: terragrunt-atlantis-config generate --output atlantis.yaml --autoplan --parallel --create-workspace
workflows:
  terragrunt:
    plan:
      steps:
      - run: terragrunt plan -no-color -out=$PLANFILE
      - run: terragrunt show -no-color -json $PLANFILE > $SHOWFILE
    apply:
      steps:
      - run: terragrunt apply -no-color $PLANFILE

In one of my PRs I modified the following file:

terragrunt/live/something/somethingelse/config.auto.tfvars

The directory terragrunt/live/something/somethingelse does not contain a terragrunt.hcl file.

So the plan failed

time=2022-02-24T12:49:18Z level=error msg=Error reading file at path /home/atlantis/.atlantis/repos/MyOrg/myrepo/2096/default/terragrunt/live/something/somethingelse/terragrunt.hcl: open /home/atlantis/.atlantis/repos/MyOrg/myrepo/2096/default/terragrunt/live/something/somethingelse/terragrunt.hcl: no such file or directory

Is this expected?

pantelis-karamolegkos avatar Feb 24 '22 13:02 pantelis-karamolegkos

I could very well be wrong here, but my inclination is that this is related to Atlantis and maybe not to this repo. I think Atlantis will try to run your main workflow plan step on any directory that has tf or .hcl files in them.

Are you able to post the top part of your repoConfig.yaml, which maybe got cur off?

dmattia avatar Feb 25 '22 21:02 dmattia

@dmattia I have updated my original question with the full file.

pantelis-karamolegkos avatar Feb 26 '22 15:02 pantelis-karamolegkos