#atlantis (2021-07)

atlantis

Discuss the Atlantis (<http://runatlantis.iorunatlantis.io>)

**Archive: ** https://archive.sweetops.com/atlantis/

2021-07-07

Callum Robertson avatar
Callum Robertson

Hey question about Atlantis checks, we’re experiencing an issue where after an apply is run, even after there are errors in stdout the apply check marks as successful, is this behaviour expected?

joshmyers avatar
joshmyers

Nope.

Callum Robertson avatar
Callum Robertson

We’re using a Terragrunt worfklow.

    apply:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - run: terragrunt apply-all -no-color --terragrunt-parallelism 4 --terragrunt-non-interactive | grep -v 'terragrunt'
joshmyers avatar
joshmyers

Yeah, because you are using $action-all which fucks with stdout

Callum Robertson avatar
Callum Robertson

Ah lame =(

joshmyers avatar
joshmyers

Don’t use plan-all/apply-all, they aren’t safe.

this1
joshmyers avatar
joshmyers

Maybe alluring, but really not safe.

Callum Robertson avatar
Callum Robertson

Thanks for the quick response @joshmyers! Very alluring, but yes, we recognise that it’s not good practice. Originally was using it for larger deployments that were modular, so we were creating atlantis projects to run the commands with the dependencies block. Since moved away from that but still using the same workflow

Callum Robertson avatar
Callum Robertson

Easy fix, thanks again

Callum Robertson avatar
Callum Robertson

@joshmyers do you use -auto-approve flag in your workflow that doesn’t have the *-all ?

1
joshmyers avatar
joshmyers

default_apply_args = list("-auto-approve", get_env("PLANFILE", "tfplan"))

1

2021-07-08

Piotr Hryszko avatar
Piotr Hryszko

hey, i have a project that uses .tfvars files, a file per environment. Each environment uses it’s own backend stored in the same account as all other resources. What would be a good way to do terraform init for each environment and pass different configuration?

Piotr Hryszko avatar
Piotr Hryszko

i guess this section of docs applies here https://www.runatlantis.io/docs/custom-workflows.html#custom-backend-config however I’m not sure how the content of custom backend file would look like, ant pointers please?

Piotr Hryszko avatar
Piotr Hryszko

please ignore the question, it’s just standard terraform backend config file

1

2021-07-28

Arjun Venkatesh avatar
Arjun Venkatesh
05:45:14 PM

Hey There, We are currently using Terragrunt for Atlantis workflow and recently updated the Atlantis image to the latest one. Now, when we try to do a plan, it succeeds and shows the plan out put as:

Arjun Venkatesh avatar
Arjun Venkatesh

but, when we try to comment the apply command it throws 2 different types of errors:

  1. When you just comment “atlantis apply”
    Ran Apply for 0 projects:
    
  2. When you comment “atlantis apply -d test/myproject”, it throws the following error ``` exit status 1: running “terragrunt apply -no-color $$PLANFILE” in “/home/atlantis/.atlantis/repos/myrepo/myproject”:

Error: Failed to load “2408PLANFILE” as a plan file

Error: stat 2408PLANFILE: no such file or directory time=2021-07-28T17:40:15Z level=error msg=1 error occurred: * exit status 1 ```

jose.amengual avatar
jose.amengual

I have no seen this

jose.amengual avatar
jose.amengual

and that showing the name of the planfile is weird

jose.amengual avatar
jose.amengual

that about the atlantis logs?

jose.amengual avatar
jose.amengual

atlantis checkout the repo and the repo becomes the working directory

jose.amengual avatar
jose.amengual

so when the plan is done is where the plan file will be safe UNLESS you have custom command or custom plan that outputs the plan file to another directory

Arjun Venkatesh avatar
Arjun Venkatesh

so, I kinda of gotten it to work. The issue looks like was caused from having $$PLANFILE changed it to $PLANFILE and it worked fine

Arjun Venkatesh avatar
Arjun Venkatesh

No, we dont have any custom commands or plans configured output. This what we have as workflow steps:

terragrunt plan -no-color -out $PLANFILE
terragrunt apply -no-color -out $PLANFILE
jose.amengual avatar
jose.amengual

so you do have a custom workflow

jose.amengual avatar
jose.amengual

in my atlantis setups I never expecified the PLANFILE

Arjun Venkatesh avatar
Arjun Venkatesh

anyone faced something like this before? or any pointers on what I should be looking at?

Jurgen avatar

so, I started up atlantis for my terraform code base, it was working fine… Now I am getting this error on init
Error: Failed to install provider from shared cache
How do I resolve it? Do I really just not commit the lock files like threads are suggesting, seems broken.

The weird thing is, it worked for a few plans/PR’s/commits and now its coming up with this.

Jurgen avatar

ok, so I think its because I moved to a custom image and installed openssl.

I have deleted the cache and this plan has run, I will let you know if another plan has worked.

Jurgen avatar

so yeah, a second plan using the downloaded cache now fails again.

Jurgen avatar

ok, so what is atlantis doing, I can see its running update and adding hashes to the lock file….

Jurgen avatar

got it
terraform providers lock -platform=linux_amd64 -platform=darwin_amd64

jose.amengual avatar
jose.amengual

Atlantis just run terraform

jose.amengual avatar
jose.amengual

nothing else

jose.amengual avatar
jose.amengual

no magic

Reinholds Zviedris avatar
Reinholds Zviedris

True, Atlantis just runs Terraform, so you can try runing TF code yourself. If you experience the same behaviour then something is wrong with TF install or perms. That could be the issue also in case of custom built Atlantis image.

2021-07-29

    keyboard_arrow_up