Vinicius Oliveira
04/26/2024, 2:44 PMworkflows:
custom_gcp_dev:
plan:
steps:
- env:
name: GOOGLE_OAUTH_ACCESS_TOKEN
command: 'get_token.sh'
- run: |
env
rm -rf .terraform
- init:
extra_args: ["-reconfigure"]
- plan
- show
apply:
steps:
- env:
name: GOOGLE_OAUTH_ACCESS_TOKEN
command: 'get_token.sh'
- run: env
- apply
- show
The plan runs just fine and the apply also works but I get this error alongside it:
unable to read /home/atlantis/.atlantis/repos/pororo/ops-iaas-atlantis-demo/16/default/gcp-2/gcp-2-default.tfplan: open /home/atlantis/.atlantis/repos/pororo/ops-iaas-atlantis-demo/16/default/gcp-2/gcp-2-default.tfplan: no such file or directory
google_storage_bucket.gcp-vini-test: Creating...
google_storage_bucket.gcp-vini-test: Creation complete after 3s [id=vini-gcp-bucket-test-909090]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
The problem here is that it causes the atlantis apply build to fail in bitbucket. This is only happening with this workflow. No other workflow is showing this. I even checked in real time when the apply is executed and I can see the tfplan on the folder and then suddenly it is gone, hence the error:
ip-10-XX-XXX-XX:/home/atlantis/.atlantis/repos/pororo/ops-iaas-atlantis-demo/16/default/gcp-2# ls -ltr
total 16
-rw-r--r-- 1 atlantis atlantis 319 Apr 26 14:26 <http://main.tf|main.tf>
-rw-r--r-- 1 atlantis atlantis 2616 Apr 26 14:26 gcp-2-default.tfplan
-rwxr-xr-x 1 atlantis atlantis 2880 Apr 26 14:26 gcp-2-default.json
-rw-r--r-- 1 atlantis atlantis 0 Apr 26 14:29 terraform.tfstate
ip-10-XX-XXX-XX:/home/atlantis/.atlantis/repos/pororo/ops-iaas-atlantis-demo/16/default/gcp-2# ls -ltr
total 16
-rw-r--r-- 1 atlantis atlantis 319 Apr 26 14:26 <http://main.tf|main.tf>
-rw-r--r-- 1 atlantis atlantis 2616 Apr 26 14:26 gcp-2-default.tfplan
-rwxr-xr-x 1 atlantis atlantis 2880 Apr 26 14:26 gcp-2-default.json
-rw-r--r-- 1 atlantis atlantis 0 Apr 26 14:29 terraform.tfstate
ip-10-XX-XXX-XX:/home/atlantis/.atlantis/repos/pororo/ops-iaas-atlantis-demo/16/default/gcp-2# ls -ltr
total 12
-rw-r--r-- 1 atlantis atlantis 319 Apr 26 14:26 <http://main.tf|main.tf>
-rwxr-xr-x 1 atlantis atlantis 2880 Apr 26 14:26 gcp-2-default.json
-rw-r--r-- 1 atlantis atlantis 2038 Apr 26 14:29 terraform.tfstate
I know that the file is supposed to be deleted but for some reason, it is happening before the build status is updated.
Anyone has any idea of what I am doing wrong here?Vinicius Oliveira
04/26/2024, 2:50 PM- show I was adding after the apply facepalm