#atlantis (2023-07)

atlantis

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

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

2023-07-05

kunalsingthakur avatar
kunalsingthakur

Hello Team,

kunalsingthakur avatar
kunalsingthakur

i am trying to understand if bitbucket user is authenticated to approve using user list

kunalsingthakur avatar
kunalsingthakur
#701 How to use custom workflows and restrict actions by username

amazing! So if I wanted to run apply and destroy with the default behavior and just add a check for an allowed list of users I would just have to do this right?

apply:
  steps:
    - run: echo 'Checking Bitbucket user is allowed to run atlantis apply'
    - if [ $USER_NAME != "username" ]; then exit 1; fi
    - init
    - apply
destroy:
  steps:
    - run: echo 'Checking Bitbucket user is allowed to run atlantis apply'
    - if [ $USER_NAME != "username" ]; then exit 1; fi
    - init
    - apply

Originally posted by @red8888 in #308 (comment)

jose.amengual avatar
jose.amengual

it should work on bitbucket

#701 How to use custom workflows and restrict actions by username

amazing! So if I wanted to run apply and destroy with the default behavior and just add a check for an allowed list of users I would just have to do this right?

apply:
  steps:
    - run: echo 'Checking Bitbucket user is allowed to run atlantis apply'
    - if [ $USER_NAME != "username" ]; then exit 1; fi
    - init
    - apply
destroy:
  steps:
    - run: echo 'Checking Bitbucket user is allowed to run atlantis apply'
    - if [ $USER_NAME != "username" ]; then exit 1; fi
    - init
    - apply

Originally posted by @red8888 in #308 (comment)

jose.amengual avatar
jose.amengual

but you can run any script to do the check , it does not have to exactly that

kunalsingthakur avatar
kunalsingthakur

ok thanks

kunalsingthakur avatar
kunalsingthakur

i am following this thread

kunalsingthakur avatar
kunalsingthakur

any help will be appreciated

2023-07-06

kunalsingthakur avatar
kunalsingthakur

is there a way we can provide authentication on local machines for developer

kunalsingthakur avatar
kunalsingthakur

to not to run terraform destroy

kunalsingthakur avatar
kunalsingthakur

or add first terraform authenticatoin for users

kunalsingthakur avatar
kunalsingthakur

for any terraform operation like plan apply

kunalsingthakur avatar
kunalsingthakur

so that every user must authenticated

kunalsingthakur avatar
kunalsingthakur

so they will follow only atlantis workflow

kunalsingthakur avatar
kunalsingthakur

right now i can see only loophole

kunalsingthakur avatar
kunalsingthakur

if anyone running via terraform locally

kunalsingthakur avatar
kunalsingthakur

if they have code

jose.amengual avatar
jose.amengual

if you are in github you can have a list of people/groups that can plan or apply

jose.amengual avatar
jose.amengual

but there is no such thing as user authenticating against atlantis to then able to run plan or apply

jose.amengual avatar
jose.amengual

you can disable command that people can run through atlantis

jose.amengual avatar
jose.amengual

keep in mind that anyone that can run plan can do terraform plan --destroy

kunalsingthakur avatar
kunalsingthakur

Yeah that main concern

kunalsingthakur avatar
kunalsingthakur

That how we avoid or add gate on local terraform execution

jose.amengual avatar
jose.amengual

there is no way to do that in atlantis

jose.amengual avatar
jose.amengual

that is a terraform issue to be honest

kunalsingthakur avatar
kunalsingthakur

ohh ok

kunalsingthakur avatar
kunalsingthakur

thanks

jose.amengual avatar
jose.amengual

anyone that runs terraform will have this issue, and on Gitops this is even more relevant since the GitOps solution ( in this case Atlantis) is able to destroy stuff so it is tricky to do

jose.amengual avatar
jose.amengual

it could be possible to add some filtering capability in atlantis to parse EXTRA_ARGS as they are called in atlantis to not allow people to run -destroy but that does not do much either since users could have something like count = var.enabled and if they set that to false it will still destroy resources

jose.amengual avatar
jose.amengual

OPA policies might give you that using post/pre_workflow_hooks in Atlantis

jose.amengual avatar
jose.amengual

but you need to write the policies for conftest to run etc

2023-07-12

Release notes from atlantis avatar
Release notes from atlantis
08:48:37 PM

v0.24.4 What’s Changed Other Changes chore(deps): update node.js to v18.16.1 in .node-version by @renovate in <a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”1768878755” data-permission-text=”Title is private”…

Release v0.24.4 · runatlantis/atlantisattachment image

What’s Changed Other Changes

chore(deps): update node.js to v18.16.1 in .node-version by @renovate in #3544 chore(deps): update dependency hashicorp/terraform to v1.5.1 in .circleci/config.yml by …

Release notes from atlantis avatar
Release notes from atlantis
09:08:38 PM

v0.24.4 What’s Changed Other Changes chore(deps): update node.js to v18.16.1 in .node-version by @renovate in <a class=”issue-link js-issue-link” data-error-text=”Failed to load title” data-id=”1768878755” data-permission-text=”Title is private”…

2023-07-21

jose.amengual avatar
jose.amengual

Check out our interview https://www.theiacpodcast.com/episode/atlantis and if you want to help out the atlantis project let me know.

Atlantis with Pepe Amengual and Dylan Page | The IaC Podcastattachment image

In episode 6, we sit down with Pepe Amengual, Principal at Slalom Build, and Dylan Page, Principal Infrastructure Engineer at Autodesk.

2

2023-07-24

kexue.wang avatar
kexue.wang

Hi team, I have some question able atlantis version v0.23.5 , I’m run atlantis in EKS & arm64 , atlantis init. trigger this error log as below

running "/atlantis/bin/terraform1.5.3 init -input=false -upgrade" in "/atlantis/repos/meican-cd/terraform-sandbox/891/default/planet/planet-api/sandbox": exit status 2
/atlantis/bin/terraform1.5.3: line 0: syntax error: unexpected end of file (expecting ")")

I believe this caused by env.tf required_version try to use the newest under /atlantis/bin/, but it looks like execution file under /atlantis/bin/ not in the correct arch.

env.tf

terraform terraform { required_version = “>= 1.1.7”

After I check the folder /atltantis/bin & using file to check the arch file terraform1.5.3 the arch amd64 is not correct

/atlantis/bin # ls -al
-rwxrwxr-x    1 atlantis atlantis  65110016 Jul 14 10:49 terraform1.5.3

/atlantis/bin # file terraform1.5.3
terraform1.5.3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=T_LzuXquexv1WdDTxLVV/Besg9qQuP_ixANsswKze/43FLwgxOIbXKTbCNbH5T/2vpZqRaEGftpMi8UYtXu, stripped

Meanwhile the terraform under /user/local/bin has correct arch.

/usr/local/bin # file terraform
terraform: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=EqDQYkFQGdQC_v7FXFOP/pcPT9BsMT2UN5gE3Eg6d/ZXC87xOc_wyv-rsq_OOr/wkHveeIL-hSKBgScMVuq, stripped
/usr/local/bin # 
kexue.wang avatar
kexue.wang

both happened in version v0.24.4

kexue.wang avatar
kexue.wang

as check the code, after add this env and arm64, it issue not happened anymore, but files under /atlantis/bin still downloaded as amd64 arch. cloud be like a bug.

            - name: ATLANTIS_TF_DOWNLOAD
              value: "false" 
kexue.wang avatar
kexue.wang

one more info atlantis version v0.24.4 terraform default version is v1.5.2

jose.amengual avatar
jose.amengual

are you pushing the terraform lockfile?

jose.amengual avatar
jose.amengual

if you are and that was run in an Arch that is not same as Atlantis ( M1 for example) it will not work, since the terraform.lock file is Arch dependant

kexue.wang avatar
kexue.wang

thanks for the reply, I’m not push lockfile. those file been add into .gitignore

.idea
**/.terraform/
.DS_Store
**/.terraform.lock.hcl
jose.amengual avatar
jose.amengual

are you building a custom image?

kexue.wang avatar
kexue.wang

nope, I’m just using official image [ghcr.io/runatlantis/atlantis:v0.23.5](http://ghcr.io/runatlantis/atlantis:v0.23.5) in Arch arm64 , I’m think execution file terraform1.x.x is downloaded to /atlantis/bin after Pod initialed. (terraform1.5.3 as this verison just released two weeks ago, Jul-12) .

jose.amengual avatar
jose.amengual

can you try adding in the atlantis.yaml a required_version = "v1.5.2" or something like that so atlantis uses a lower version?

kexue.wang avatar
kexue.wang

try in env.tf with fixed lower verison, it works. it will using. /usr/local/bin/terraform to run the init

kexue.wang avatar
kexue.wang
/tmp # ls -al /atlantis/bin/
total 317180
drwxrws---    2 atlantis atlantis      4096 Jul 14 10:49 .
drwxrwsr-x    6 root     atlantis      4096 Jul 13  2022 ..
-rwxrwxr-x    1 atlantis atlantis  64626688 May 19 04:55 terraform1.4.6
-rwxrwxr-x    1 atlantis atlantis  65015808 Jun 15 10:04 terraform1.5.0
-rwxrwxr-x    1 atlantis atlantis  65015808 Jun 26 05:03 terraform1.5.1
-rwxrwxr-x    1 atlantis atlantis  65015808 Jun 30 03:27 terraform1.5.2
-rwxrwxr-x    1 atlantis atlantis  65110016 Jul 14 10:49 terraform1.5.3
/tmp # ls -al /usr/local/bin/
total 360324
drwxr-xr-x    1 root     root            34 Apr 17 22:00 .
drwxr-xr-x    1 root     root            19 Mar 29 14:46 ..
-rwxr-xr-x    1 root     root      25624576 Apr 17 22:00 atlantis
-rwxr-xr-x    1 1001     ntp       35389440 Mar 24 03:17 conftest
-rwxr-xr-x    1 root     root          1980 Apr 17 21:36 docker-entrypoint.sh
-rwxr-xr-x    1 root     root      61997056 Apr 12 17:16 terraform
-rwxr-xr-x    1 root     root      64290816 Apr 20  2022 terraform1.1.9
-rwxr-xr-x    1 root     root      60817408 Sep  7  2022 terraform1.2.9
-rwxr-xr-x    1 root     root      58851328 Feb 15 17:20 terraform1.3.9
-rwxr-xr-x    1 root     root      61997056 Apr 12 17:16 terraform1.4.5
/tmp # 

for the date of execution file Jul 14 10:49 terraform1.5.3 looks like wired,my atlantis verison is v0.23.5

kexue.wang avatar
kexue.wang

looks like the files under folder /atlantis/bin/ is coming from base image?

kexue.wang avatar
kexue.wang

check the github project Dockerfile, looks like nothing related with fodler /atlantis/bin/.

jose.amengual avatar
jose.amengual

I see ok

1
jose.amengual avatar
jose.amengual

are you pulling this tag? docker pull http://ghcr.io/runatlantis/atlantis<i class="em em-v0.24.4@sha256"ghcr.io/runatlantis/atlantis<i class=”em em-v0.24.4@sha256”</i>086c8a9e6978790acff90b718a7160bf1afb854ef46681191049b37ce85bdf7b>

jose.amengual avatar
jose.amengual

there is 3 different images for each arch

jose.amengual avatar
jose.amengual

I wonder if a ENV variable is using the wrong ARCH for the image

kexue.wang avatar
kexue.wang

Thanks for the updates:

• For platform arm64 ghcr.io/runatlantis/atlantis:v0.24.4 Digest: sha256:8be824d5b4b2f375f058f26db554fd142a6a967229d9334a952847d66e7bfd5a but the ARCH in /usr/local/bin are corrected. (for both arm64 and amd64) only the path /atltantis/bin always using the amd64 • And also I refer this code, https://github.com/runatlantis/atlantis/blob/main/server/core/terraform/terraform_client.go#L528-L530 build execution file CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build main.go in arm64 for verify the download. it also works as expected.

• one more thing for my yaml file, I’m not add any other ENV variable related with ARCH.

2023-07-25

2023-07-26

    keyboard_arrow_up