https://www.runatlantis.io/ logo
Title
c

Carlo Schizzo

04/25/2023, 9:53 AM
Hello, I'm new to Atlantis and I have just completed the installation on a GKE, I'm having some bad time to configure it and understand how it works as unfortunately I'm getting issue related to bugs: https://github.com/runatlantis/atlantis/issues/2200 and https://github.com/runatlantis/atlantis/issues/1716 I use terragrunt and my project structure is:
├── prod
│   ├── bucket
│   │   └── terragrunt.hcl
│   ├── common_vars.yaml
│   └── terragrunt.hcl
└── stage
    ├── bucket
    │   └── terragrunt.hcl
    ├── common_vars.yaml
    └── terragrunt.hcl
my `repo_config.json`:
{
  "repos": [
    {
      "id": "<http://bitbucket.workday.com/Build|bitbucket.workday.com/Build> Engineering/terraform-gcp",
      "branch": "/master/",
      "allowed_overrides": [
        "workflow"
      ],
      "allow_custom_workflows": true,
      "apply_requirements": [
        "approved",
        "mergeable"
      ],
      "pre_workflow_hooks": [
        {
          "run": "cp atlantis/config/atlantis-dev.yaml ./atlantis.yaml",
          "description": "getting atlantis configuration for terraform-gcp project"
        }
      ]
    }
  ]
}
finally my
atlantis.yaml
version: 3
automerge: false
parallel_apply: false
parallel_plan: false
projects:
  - dir: test-atlantis/prod/bucket
    workflow: terragrunt

  - dir: test-atlantis/stage/bucket
    workflow: terragrunt
workflows:
  terragrunt:
    plan:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - run: printenv
        - run: terragrunt plan -out $PLANFILE
    apply:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - run: terragrunt apply $PLANFILE
Unfortunately when using this
atlantis.yaml
which comes from the Atlantis documentation I get this error:
...
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.[0m

Error: Too many command line arguments

To specify a working directory for the plan, use the global -chdir flag.

For more help on using this command, run:
  terraform plan -help
...
if I replace the
$PLANFILE
with the following:
version: 3
automerge: false
parallel_apply: false
parallel_plan: false
projects:
  - dir: test-atlantis/prod/bucket
    workflow: terragrunt

  - dir: test-atlantis/stage/bucket
    workflow: terragrunt
workflows:
  terragrunt:
    plan:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - run: terragrunt plan-all --terragrunt-non-interactive -no-color -out default.tfplan
    apply:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - run: terragrunt apply-all "default.tfplan" --terragrunt-non-interactive -no-color
It works, but I'm confused as the official documentation says to use
$PLANFILE
and help?
p

PePe Amengual

04/25/2023, 3:35 PM
you can call the plan output whatever you want , and in your example you called it default.tfplan
with the -out option