Atlantis: Atlantis Plan -d . or -p does not work - Runs plan. in 3 directories

Created on 29 Sep 2020  路  12Comments  路  Source: runatlantis/atlantis

Hi, my project structure looks like below but i keep getting errors when i run atlantis plan -p test-atlantis ..it says it wants to
Ran Plan in 3 directories:

  • .
  • backend-config
  • env-config

    and i only want it to plan and init in the main root and specify in the atlantis.yaml file /repos.yaml file where the backend-config is. and it does not init properly either:

  • main.tf

  • backend-config:

    • dev.tfvars:

  • env-config:

    • dev.tfvars:

```Plan Error for .
exit status 1: running "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default":
Initializing modules...

Initializing the backend...

Error: error using credentials to get account ID: error calling sts:GetCallerIdentity: ExpiredToken: The security token included in the request is expired
status code: 403, request id: 42f46134-11c4-4aca-97e3-2ba567baff58


```Plan Error for backend-config
exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config/default.tfplan -var atlantis_user=C91002 -p test-atlantis" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config": 
Usage: terraform plan [options] [DIR]

  Generates an execution plan for Terraform.

  This execution plan can be reviewed prior to running apply to get a
  sense for what Terraform will do. Optionally, the plan can be saved to
  a Terraform plan file, and apply can take this plan file to execute
  this plan exactly.
..

```Pla Error for .env-config
exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config/default.tfplan -var atlantis_user=C91002 -p test-atlantis" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config":
Usage: terraform plan [options] [DIR]

Generates an execution plan for Terraform.


my atlantis.yaml file looks like this:

# atlantis.yaml

terraform_version: 0.12.21 # optional version
version: 3

projects:

  • name: test-atlantis
    dir: .
    workflow: dev
and my repos.yaml file look like this:

workflows:
dev:
plan:
steps:
- run: rm -rf .terraform
- init:
extra_args: ["-backend-config=backend-config/dev.tfvars"]
- plan:
extra_args: ["-var-file=env-config/dev.tfvars"]
```

question

Most helpful comment

image

Yep, that'll do it! Pretty cool that is was still working decently though 馃槅

All 12 comments

@lkysow would you happen to know what the issue is here?

Hmm, is the atlantis.yaml on the same branch as your pull request? It should only be running plan in the directory specified so my first guess is that atlantis isn't parsing that config file. Can you paste the logs please?

@lkysow ok here is my log:

2020/09/29 09:48:53 middleware.go:27: [INFO] server: 200 | POST /events
2020/09/29 09:48:54 plan_executor.go:60: [INFO] C91002/gina_test_terraform#3: Found 19 files modified in this pull request
2020/09/29 09:48:54 project_finder.go:34: [INFO] C91002/gina_test_terraform#3: Filtered modified files to 9 .tf files: [backend-config/dev.tfvars backend-config/prod.tfvars backend-config/test.tfvars env-config/dev.tfvars env-config/prod.tfvars env-config/test.tfvars main.tf outputs.tf variables.tf]
2020/09/29 09:48:54 project_finder.go:45: [INFO] C91002/gina_test_terraform#3: There are 3 modified project(s) at path(s): backend-config, env-config, .
2020/09/29 09:48:54 atlantis_workspace.go:46: [INFO] C91002/gina_test_terraform#3: Cleaning clone directory "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 09:48:54 atlantis_workspace.go:52: [INFO] C91002/gina_test_terraform#3: Creating dir "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 09:48:54 atlantis_workspace.go:57: [INFO] C91002/gina_test_terraform#3: Git cloning "https://git.sys.com/C91002/gina_test_terraform.git" into "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 09:49:09 atlantis_workspace.go:64: [INFO] C91002/gina_test_terraform#3: Checking out branch "example_repo_atlantis"
2020/09/29 09:49:10 plan_executor.go:73: [INFO] C91002/gina_test_terraform#3: Running plan for project at path "backend-config"
2020/09/29 09:49:10 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#3: Acquired lock with id "C91002/gina_test_terraform/backend-config/default"
2020/09/29 09:49:10 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#3: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/29 09:49:10 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config"
2020/09/29 09:49:10 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform workspace select -no-color default" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config"
2020/09/29 09:49:11 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#3: Error: exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config/default.tfplan -var atlantis_user=C91002 -p test-atlantis" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config":
Usage: terraform plan [options] [DIR]

  Generates an execution plan for Terraform.

  This execution plan can be reviewed prior to running apply to get a
  sense for what Terraform will do. Optionally, the plan can be saved to
  a Terraform plan file, and apply can take this plan file to execute
  this plan exactly.

Options:

  -compact-warnings   If Terraform produces any warnings that are not
                      accompanied by errors, show them in a more compact form
                      that includes only the summary messages.

  -destroy            If set, a plan will be generated to destroy all resources
                      managed by the given configuration and state.

  -detailed-exitcode  Return detailed exit codes when the command exits. This
                      will change the meaning of exit codes to:
                      0 - Succeeded, diff is empty (no changes)
                      1 - Errored
                      2 - Succeeded, there is a diff

  -input=true         Ask for input for variables if not directly set.

  -lock=true          Lock the state file when locking is supported.

  -lock-timeout=0s    Duration to retry a state lock.

  -no-color           If specified, output won't contain any color.

  -out=path           Write a plan file to the given path. This can be used as
                      input to the "apply" command.

  -parallelism=n      Limit the number of concurrent operations. Defaults to 10.

  -refresh=true       Update state prior to checking for differences.

  -state=statefile    Path to a Terraform state file to use to look
                      up Terraform-managed resources. By default it will
                      use the state "terraform.tfstate" if it exists.

  -target=resource    Resource to target. Operation will be limited to this
                      resource and its dependencies. This flag can be used
                      multiple times.

  -var 'foo=bar'      Set a variable in the Terraform configuration. This
                      flag can be set multiple times.

  -var-file=foo       Set variables in the Terraform configuration from
                      a file. If "terraform.tfvars" or any ".auto.tfvars"
                      files are present, they will be automatically loaded.

2020/09/29 09:49:11 plan_executor.go:73: [INFO] C91002/gina_test_terraform#3: Running plan for project at path "env-config"
2020/09/29 09:49:11 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#3: Acquired lock with id "C91002/gina_test_terraform/env-config/default"
2020/09/29 09:49:11 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#3: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/29 09:49:11 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config"
2020/09/29 09:49:11 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform workspace select -no-color default" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config"
2020/09/29 09:49:11 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#3: Error: exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config/default.tfplan -var atlantis_user=C91002 -p test-atlantis" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config":
Usage: terraform plan [options] [DIR]

  Generates an execution plan for Terraform.

  This execution plan can be reviewed prior to running apply to get a
  sense for what Terraform will do. Optionally, the plan can be saved to
  a Terraform plan file, and apply can take this plan file to execute
  this plan exactly.

Options:

  -compact-warnings   If Terraform produces any warnings that are not
                      accompanied by errors, show them in a more compact form
                      that includes only the summary messages.

  -destroy            If set, a plan will be generated to destroy all resources
                      managed by the given configuration and state.

  -detailed-exitcode  Return detailed exit codes when the command exits. This
                      will change the meaning of exit codes to:
                      0 - Succeeded, diff is empty (no changes)
                      1 - Errored
                      2 - Succeeded, there is a diff

  -input=true         Ask for input for variables if not directly set.

  -lock=true          Lock the state file when locking is supported.

  -lock-timeout=0s    Duration to retry a state lock.

  -no-color           If specified, output won't contain any color.

  -out=path           Write a plan file to the given path. This can be used as
                      input to the "apply" command.

  -parallelism=n      Limit the number of concurrent operations. Defaults to 10.

  -refresh=true       Update state prior to checking for differences.

  -state=statefile    Path to a Terraform state file to use to look
                      up Terraform-managed resources. By default it will
                      use the state "terraform.tfstate" if it exists.

  -target=resource    Resource to target. Operation will be limited to this
                      resource and its dependencies. This flag can be used
                      multiple times.

  -var 'foo=bar'      Set a variable in the Terraform configuration. This
                      flag can be set multiple times.

  -var-file=foo       Set variables in the Terraform configuration from
                      a file. If "terraform.tfvars" or any ".auto.tfvars"
                      files are present, they will be automatically loaded.

2020/09/29 09:49:11 plan_executor.go:73: [INFO] C91002/gina_test_terraform#3: Running plan for project at path "."
2020/09/29 09:49:11 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#3: Acquired lock with id "C91002/gina_test_terraform/./default"
2020/09/29 09:49:11 project_pre_execute.go:63: [INFO] C91002/gina_test_terraform#3: Parsed atlantis config file in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 09:49:11 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#3: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/29 09:49:14 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#3: Error: exit status 1: running "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default":
Initializing modules...

Initializing the backend...

Error: error using credentials to get account ID: error calling sts:GetCallerIdentity: ExpiredToken: The security token included in the request is expired
    status code: 403, request id: 7aee1d57-225d-431b-97b4-246872a54cb9



2020/09/29 09:49:14 events_controller.go:157: [DEBUG] server: Ignoring: not an Atlantis command
2020/09/29 09:49:14 middleware.go:27: [INFO] server: 200 | POST /events

yes my branch is examples and i created a Merge Request in Git Lab to master..so the atlantis.yaml file is in the examples branch.. my directory structure looks like this in examples branch...

  • main.tf
  • backend-config:

    • dev.tfvars:

  • env-config:

    • dev.tfvars:

  • atlantis.yaml
  • repos.yaml

trying to run it several times atlantis plan -p test-atlantis

*My atlantis.yaml file *
looks like this:

---
terraform_version: 0.12.21 # optional version
version: 3

projects:
- name: test-atlantis
  dir: .
  workflow: dev
workflows:
  dev:
    plan:
      steps:
      - run: rm -rf .terraform
      - init:
          extra_args: [-backend-config=backend-config/dev.tfvars]
      - plan:
          extra_args: [-var-file=env-config/dev.tfvars]

Logs:

2020/09/29 11:11:44 plan_executor.go:60: [INFO] C91002/gina_test_terraform#3: Found 19 files modified in this pull request
2020/09/29 11:11:44 project_finder.go:34: [INFO] C91002/gina_test_terraform#3: Filtered modified files to 9 .tf files: [backend-config/dev.tfvars backend-config/prod.tfvars backend-config/test.tfvars env-config/dev.tfvars env-config/prod.tfvars env-config/test.tfvars main.tf outputs.tf variables.tf]
2020/09/29 11:11:44 project_finder.go:45: [INFO] C91002/gina_test_terraform#3: There are 3 modified project(s) at path(s): backend-config, env-config, .
2020/09/29 11:11:44 atlantis_workspace.go:46: [INFO] C91002/gina_test_terraform#3: Cleaning clone directory "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 11:11:44 atlantis_workspace.go:52: [INFO] C91002/gina_test_terraform#3: Creating dir "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 11:11:44 atlantis_workspace.go:57: [INFO] C91002/gina_test_terraform#3: Git cloning "https://git.sys.com/C91002/gina_test_terraform.git" into "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 11:12:11 atlantis_workspace.go:64: [INFO] C91002/gina_test_terraform#3: Checking out branch "example_repo_atlantis"
2020/09/29 11:12:12 plan_executor.go:73: [INFO] C91002/gina_test_terraform#3: Running plan for project at path "backend-config"
2020/09/29 11:12:13 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#3: Acquired lock with id "C91002/gina_test_terraform/backend-config/default"
2020/09/29 11:12:13 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#3: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/29 11:12:13 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config"
2020/09/29 11:12:13 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform workspace select -no-color default" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config"
2020/09/29 11:12:13 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#3: Error: exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config/default.tfplan -var atlantis_user=C91002 -p test-atlantis" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/backend-config":
Usage: terraform plan [options] [DIR]

  Generates an execution plan for Terraform.

  This execution plan can be reviewed prior to running apply to get a
  sense for what Terraform will do. Optionally, the plan can be saved to
  a Terraform plan file, and apply can take this plan file to execute
  this plan exactly.

Options:

  -compact-warnings   If Terraform produces any warnings that are not
                      accompanied by errors, show them in a more compact form
                      that includes only the summary messages.

  -destroy            If set, a plan will be generated to destroy all resources
                      managed by the given configuration and state.

  -detailed-exitcode  Return detailed exit codes when the command exits. This
                      will change the meaning of exit codes to:
                      0 - Succeeded, diff is empty (no changes)
                      1 - Errored
                      2 - Succeeded, there is a diff

  -input=true         Ask for input for variables if not directly set.

  -lock=true          Lock the state file when locking is supported.

  -lock-timeout=0s    Duration to retry a state lock.

  -no-color           If specified, output won't contain any color.

  -out=path           Write a plan file to the given path. This can be used as
                      input to the "apply" command.

  -parallelism=n      Limit the number of concurrent operations. Defaults to 10.

  -refresh=true       Update state prior to checking for differences.

  -state=statefile    Path to a Terraform state file to use to look
                      up Terraform-managed resources. By default it will
                      use the state "terraform.tfstate" if it exists.

  -target=resource    Resource to target. Operation will be limited to this
                      resource and its dependencies. This flag can be used
                      multiple times.

  -var 'foo=bar'      Set a variable in the Terraform configuration. This
                      flag can be set multiple times.

  -var-file=foo       Set variables in the Terraform configuration from
                      a file. If "terraform.tfvars" or any ".auto.tfvars"
                      files are present, they will be automatically loaded.

2020/09/29 11:12:13 plan_executor.go:73: [INFO] C91002/gina_test_terraform#3: Running plan for project at path "env-config"
2020/09/29 11:12:13 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#3: Acquired lock with id "C91002/gina_test_terraform/env-config/default"
2020/09/29 11:12:13 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#3: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/29 11:12:13 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config"
2020/09/29 11:12:13 terraform_client.go:100: [INFO] C91002/gina_test_terraform#3: Successfully ran "sh -c terraform workspace select -no-color default" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config"
2020/09/29 11:12:13 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#3: Error: exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config/default.tfplan -var atlantis_user=C91002 -p test-atlantis" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default/env-config":
Usage: terraform plan [options] [DIR]

  Generates an execution plan for Terraform.

  This execution plan can be reviewed prior to running apply to get a
  sense for what Terraform will do. Optionally, the plan can be saved to
  a Terraform plan file, and apply can take this plan file to execute
  this plan exactly.

Options:

  -compact-warnings   If Terraform produces any warnings that are not
                      accompanied by errors, show them in a more compact form
                      that includes only the summary messages.

  -destroy            If set, a plan will be generated to destroy all resources
                      managed by the given configuration and state.

  -detailed-exitcode  Return detailed exit codes when the command exits. This
                      will change the meaning of exit codes to:
                      0 - Succeeded, diff is empty (no changes)
                      1 - Errored
                      2 - Succeeded, there is a diff

  -input=true         Ask for input for variables if not directly set.

  -lock=true          Lock the state file when locking is supported.

  -lock-timeout=0s    Duration to retry a state lock.

  -no-color           If specified, output won't contain any color.

  -out=path           Write a plan file to the given path. This can be used as
                      input to the "apply" command.

  -parallelism=n      Limit the number of concurrent operations. Defaults to 10.

  -refresh=true       Update state prior to checking for differences.

  -state=statefile    Path to a Terraform state file to use to look
                      up Terraform-managed resources. By default it will
                      use the state "terraform.tfstate" if it exists.

  -target=resource    Resource to target. Operation will be limited to this
                      resource and its dependencies. This flag can be used
                      multiple times.

  -var 'foo=bar'      Set a variable in the Terraform configuration. This
                      flag can be set multiple times.

  -var-file=foo       Set variables in the Terraform configuration from
                      a file. If "terraform.tfvars" or any ".auto.tfvars"
                      files are present, they will be automatically loaded.

2020/09/29 11:12:13 plan_executor.go:73: [INFO] C91002/gina_test_terraform#3: Running plan for project at path "."
2020/09/29 11:12:13 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#3: Acquired lock with id "C91002/gina_test_terraform/./default"
2020/09/29 11:12:13 project_pre_execute.go:63: [INFO] C91002/gina_test_terraform#3: Parsed atlantis config file in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default"
2020/09/29 11:12:13 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#3: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/29 11:12:16 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#3: Error: exit status 1: running "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/3/default":
Initializing modules...

Initializing the backend...

Error: error using credentials to get account ID: error calling sts:GetCallerIdentity: ExpiredToken: The security token included in the request is expired
    status code: 403, request id: e369f605-322e-4305-a1cf-554ea916855f



2020/09/29 11:12:17 events_controller.go:157: [DEBUG] server: Ignoring: not an Atlantis command
2020/09/29 11:12:17 middleware.go:27: [INFO] server: 200 | POST /events

more of the same thing

@lkysow i refreshed and reran atlantis server, this helped to tf init but it still could not find the backend-file and .. i tried to change the directory structure and the atlantis.yaml file but the logs keep missing the config files.

directory structure:

  • atlantis.yaml
  • repos.yaml
  • test

    • main.tf

    • outputs.tf

    • variables.tf

    • backend-config.tf



      • dev.tfvars



    • env-config.tf



      • dev.tfvars



atlantis.yaml file

# atlantis.yaml
---
terraform_version: 0.12.21 # optional version
version: 3

projects:
- name: test-atlantis
  dir: test
  workflow: dev
  # workspace: default
  autoplan:
    when_modified: ["*.tf"]
    enabled: true
  # apply_requirements: [mergeable, approved]
workflows:
  dev:
    plan:
      steps:
      - run: rm -rf .terraform
      - init:
          run: terraform init -backend-config=backend-config/dev.tfvars
          # extra_args: ["-backend-config", "backend-config/dev.tfvars"]
      - plan:
          extra_args: ["-var-file", "env-config/dev.tfvars"]

LOGS:

2020/09/29 20:04:07 [INFO] server: 200 | POST /events
2020/09/29 20:04:32 [INFO] server: 200 | POST /events
2020/09/29 20:04:32 [INFO] C91002/gina_test_terraform#4: Found 2 files modified in this pull request
2020/09/29 20:04:32 [INFO] C91002/gina_test_terraform#4: Filtered modified files to 1 .tf files: [test/env-config/dev.tfvars]
2020/09/29 20:04:32 [INFO] C91002/gina_test_terraform#4: There are 1 modified project(s) at path(s): test/env-config
2020/09/29 20:04:32 [INFO] C91002/gina_test_terraform#4: Cleaning clone directory "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default"
2020/09/29 20:04:32 [INFO] C91002/gina_test_terraform#4: Creating dir "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default"
2020/09/29 20:04:32 [INFO] C91002/gina_test_terraform#4: Git cloning "https://git.sys.com/C91002/gina_test_terraform.git" into "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default"
2020/09/29 20:04:51 [INFO] C91002/gina_test_terraform#4: Checking out branch "example_repo_atlantis"
2020/09/29 20:04:54 [INFO] C91002/gina_test_terraform#4: Running plan for project at path "test/env-config"
2020/09/29 20:04:54 [INFO] C91002/gina_test_terraform#4: Acquired lock with id "C91002/gina_test_terraform/test/env-config/default"
2020/09/29 20:04:54 [INFO] C91002/gina_test_terraform#4: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/29 20:04:54 [INFO] C91002/gina_test_terraform#4: Successfully ran "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/test/env-config"
2020/09/29 20:04:54 [INFO] C91002/gina_test_terraform#4: Successfully ran "sh -c terraform workspace select -no-color default" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/test/env-config"

It just keeps 1) trying to init and plan in subdirectories env-config and backend-config and 2) missing the extra_args at the end of init and plan. i have no clue why. it doesnt run the custom workflow properly either! 馃槶

Hi, Atlantis isn't finding your atlantis.yaml file. It should be logging successfully parsed atlantis.yaml file. If you log into the box and navigate into /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default I bet you don't see the atlantis.yaml file.

The file must be at the root of your repo.

..this is what i do to start my server: atlantis server --atlantis-url http://10.25.251.199:4141 --gitlab-user c91002 --config=/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/repos.yaml and above is my folder structure

however i think my repos.yaml file is not being recognized so it cant change the workflow when i try --repo-config=/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/repos.yaml i get :

Error: unknown flag: --repo-config

Usage:
  atlantis server [flags]

Flags:
      --atlantis-url string            URL that Atlantis can be reached at. Defaults to http://$(hostname):$port where $port is from --port.
      --config string                  Path to config file.
      --data-dir string                Path to directory to store Atlantis data. (default "~/.atlantis")
      --gh-hostname string             Hostname of your Github Enterprise installation. If using github.com, no need to set. (default "github.com")
      --gh-token string                GitHub token of API user. Can also be specified via the ATLANTIS_GH_TOKEN environment variable.
      --gh-user string                 GitHub username of API user.
      --gh-webhook-secret string       Optional secret used to validate GitHub webhooks (see https://developer.github.com/webhooks/securing/). If not specified, Atlantis won't be able to validate that the incoming webhook call came from GitHub. Can also be specified via the ATLANTIS_GH_WEBHOOK_SECRET environment variable.
      --gitlab-hostname string         Hostname of your GitLab Enterprise installation. If using gitlab.com, no need to set. (default "gitlab.com")
      --gitlab-token string            GitLab token of API user. Can also be specified via the ATLANTIS_GITLAB_TOKEN environment variable.
      --gitlab-user string             GitLab username of API user.
      --gitlab-webhook-secret string   Optional secret used to validate GitLab webhooks. If not specified, Atlantis won't be able to validate that the incoming webhook call came from GitLab. Can also be specified via the ATLANTIS_GITLAB_WEBHOOK_SECRET environment variable.
  -h, --help                           help for server
      --log-level string               Log level. Either debug, info, warn, or error. (default "info")
      --port int                       Port to bind to. (default 4141)
      --require-approval               Require pull requests to be "Approved" before allowing the apply command to be run.
      --ssl-cert-file string           File containing x509 Certificate used for serving HTTPS. If the cert is signed by a CA, the file should be the concatenation of the server's certificate, any intermediates, and the CA's certificate.
      --ssl-key-file string            File containing x509 private key matching --ssl-cert-file.

since --repo-config wasnt allowed i also tried running --config and putting in the following values:

```repos.yaml
log-level: debug
repo-config-json: '{"repos":[{"id":"/.*/", "allowed_overrides":["apply_requirements","workflow"], "allow_custom_workflows":true}]}'



then when i ran the server ..

`atlantis server --config=/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/repos.yaml --log-level-debug`

but i got the same logs as the first time, it knows where to look then it doesnt pick up on the tfvars:

2020/09/30 19:48:19 middleware.go:27: [INFO] server: 200 | POST /events
2020/09/30 19:48:20 plan_executor.go:60: [INFO] C91002/gina_test_terraform#4: Found 4 files modified in this pull request
2020/09/30 19:48:20 project_finder.go:34: [INFO] C91002/gina_test_terraform#4: Filtered modified files to 2 .tf files: [test/env-config/dev.tfvars test/main.tf]
2020/09/30 19:48:20 project_finder.go:45: [INFO] C91002/gina_test_terraform#4: There are 2 modified project(s) at path(s): test/env-config, test
2020/09/30 19:48:20 atlantis_workspace.go:46: [INFO] C91002/gina_test_terraform#4: Cleaning clone directory "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default"
2020/09/30 19:48:20 atlantis_workspace.go:52: [INFO] C91002/gina_test_terraform#4: Creating dir "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default"
2020/09/30 19:48:20 atlantis_workspace.go:57: [INFO] C91002/gina_test_terraform#4: Git cloning "https://git.sys.com/C91002/gina_test_terraform.git" into "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default"
2020/09/30 19:48:43 atlantis_workspace.go:64: [INFO] C91002/gina_test_terraform#4: Checking out branch "example_repo_atlantis"
2020/09/30 19:48:45 plan_executor.go:73: [INFO] C91002/gina_test_terraform#4: Running plan for project at path "test/env-config"
2020/09/30 19:48:45 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#4: Acquired lock with id "C91002/gina_test_terraform/test/env-config/default"
2020/09/30 19:48:45 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#4: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/30 19:48:45 terraform_client.go:100: [INFO] C91002/gina_test_terraform#4: Successfully ran "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/test/env-config"
2020/09/30 19:48:45 terraform_client.go:100: [INFO] C91002/gina_test_terraform#4: Successfully ran "sh -c terraform workspace select -no-color default" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/test/env-config"
2020/09/30 19:48:45 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#4: Error: exit status 1: running "sh -c terraform plan -refresh -no-color -out /home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/test/env-config/default.tfplan -var atlantis_user=C91002 -p test-atlantis -- -var-file=env-config/dev.tfvars" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/test/env-config":
Usage: terraform plan [options] [DIR]

Generates an execution plan for Terraform.

This execution plan can be reviewed prior to running apply to get a
sense for what Terraform will do. Optionally, the plan can be saved to
a Terraform plan file, and apply can take this plan file to execute
this plan exactly.

Options:

-compact-warnings If Terraform produces any warnings that are not
accompanied by errors, show them in a more compact form
that includes only the summary messages.

-destroy If set, a plan will be generated to destroy all resources
managed by the given configuration and state.

-detailed-exitcode Return detailed exit codes when the command exits. This
will change the meaning of exit codes to:
0 - Succeeded, diff is empty (no changes)
1 - Errored
2 - Succeeded, there is a diff

-input=true Ask for input for variables if not directly set.

-lock=true Lock the state file when locking is supported.

-lock-timeout=0s Duration to retry a state lock.

-no-color If specified, output won't contain any color.

-out=path Write a plan file to the given path. This can be used as
input to the "apply" command.

-parallelism=n Limit the number of concurrent operations. Defaults to 10.

-refresh=true Update state prior to checking for differences.

-state=statefile Path to a Terraform state file to use to look
up Terraform-managed resources. By default it will
use the state "terraform.tfstate" if it exists.

-target=resource Resource to target. Operation will be limited to this
resource and its dependencies. This flag can be used
multiple times.

-var 'foo=bar' Set a variable in the Terraform configuration. This
flag can be set multiple times.

-var-file=foo Set variables in the Terraform configuration from
a file. If "terraform.tfvars" or any ".auto.tfvars"
files are present, they will be automatically loaded.

2020/09/30 19:48:45 plan_executor.go:73: [INFO] C91002/gina_test_terraform#4: Running plan for project at path "test"
2020/09/30 19:48:45 project_pre_execute.go:53: [INFO] C91002/gina_test_terraform#4: Acquired lock with id "C91002/gina_test_terraform/test/default"
2020/09/30 19:48:45 project_pre_execute.go:73: [INFO] C91002/gina_test_terraform#4: Determined that we are running terraform with version >= 0.9.0. Running version 0.12.21
2020/09/30 19:48:47 terraform_client.go:97: [DEBUG] C91002/gina_test_terraform#4: Error: exit status 1: running "sh -c terraform init -no-color" in "/home/SILVER/c91002/.atlantis/repos/C91002/gina_test_terraform/4/default/test":
Initializing modules...
Downloading git::https://git.sys.com/terraform-aws-lambda.git?ref=tags/v5.2.2 for lambda...

  • lambda in .terraform/modules/lambda
  • lambda.event-cloudwatch in .terraform/modules/lambda/modules/event/cloudwatch-event
  • lambda.event-dynamodb in .terraform/modules/lambda/modules/event/dynamodb
  • lambda.event-kinesis in .terraform/modules/lambda/modules/event/kinesis
  • lambda.event-s3 in .terraform/modules/lambda/modules/event/s3
  • lambda.event-sns in .terraform/modules/lambda/modules/event/sns
  • lambda.event-sqs in .terraform/modules/lambda/modules/event/sqs
    Downloading git::https://git.sys.com/terraform-label.git?ref=tags/1.0.0 for lambda.label...
  • lambda.label in .terraform/modules/lambda.label
  • lambda.lambda in .terraform/modules/lambda/modules/lambda

Initializing the backend...
bucket
The name of the S3 bucket

Enter a value:
key
The path to the state file inside the bucket

Enter a value:
region
The region of the S3 bucket.

Enter a value:

Error: Invalid AWS Region:

2020/09/30 19:48:48 events_controller.go:157: [DEBUG] server: Ignoring: not an Atlantis command


### repos.yaml

repos:

  • id: /.*/
    allow_custom_workflows: true
    # apply_requirements: [approved, mergeable]
    allowed_overrides: [workflow]
    workflow: dev

### atlantis.yaml

# atlantis.yaml

terraform_version: 0.12.21 # optional version
version: 3

projects:

  • name: test-atlantis
    dir: test
    workflow: dev
    workflows:
    dev:
    plan:
    steps:

    • run: rm -rf .terraform

    • init:

      run: terraform init -backend-config=backend-config/dev.tfvars

    • plan:

      extra_args: ["-var-file", "env-config/dev.tfvars"]

      ```

I think you're running a very old version of Atlantis. Which version are you on?

omg, 馃槱 i was on 0.2.4. just figured it out. thank you so much. you can close this

image

Yep, that'll do it! Pretty cool that is was still working decently though 馃槅

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ojacobson picture ojacobson  路  5Comments

natalysheinin picture natalysheinin  路  3Comments

stephencoe picture stephencoe  路  5Comments

cket picture cket  路  5Comments

cheethoe picture cheethoe  路  4Comments