Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install-wrapper: true Breaks atmos workspace select using s3 backend. #23

Open
jamengual opened this issue Jun 2, 2023 · 0 comments
Open
Labels
bug 🐛 An issue with the system

Comments

@jamengual
Copy link

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

When :

  - name: Setup atmos
        uses: cloudposse/github-action-setup-atmos@1.0.1
        with:
          install-wrapper: true

install-wrapper: true and atmos plan command will fail due to the wrapper catching the output of the atmos command and somehow making atmos to believe the workspace does not exist.

Expected Behavior

The wrapper should not cause atmos plan command to fail.

Steps to Reproduce

This github action fails :

steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup TF
        uses: hashicorp/setup-terraform@v2
        with:
          terraform_version: 1.4.6
          cli_config_credentials_token: ""

      - name: Setup atmos
        uses: cloudposse/github-action-setup-atmos@1.0.1
        with:
          install-wrapper: true
          atmos-version: 1.34.0

      - name: Assume AWS Role
        uses: aws-actions/configure-aws-credentials@v2
        with:
          role-to-assume: ${{ env.AWS_ROLE }}
          aws-region: ${{ env.AWS_REGION }}
      
      
      - name: Atmos Plan
        run: |
          export ATMOS_LOGS_LEVEL=Trace
          aws sts get-caller-identity
          atmos terraform plan oidc -s platformlive-dev-uw2

ERROR:

Terraform v1.4.6
on linux_amd64
/home/runner/work/platform-live-aws-infrastructure/platform-live-aws-infrastructure
total 40
-rw-r--r-- 1 runner docker  565 Jun  1 15:37 README.md
-rw-r--r-- 1 runner docker 8515 Jun  1 15:37 atmos.yaml
-rw-r--r-- 1 runner docker 4960 Jun  1 15:37 bitbucket-pipelines.yml
drwxr-xr-x 3 runner docker 4096 Jun  1 15:37 components
drwxr-xr-x 3 runner docker 4096 Jun  1 15:37 docs
-rw-r--r-- 1 runner docker  831 Jun  1 15:37 plan.txt
drwxr-xr-x 4 runner docker 4096 Jun  1 15:37 stacks
components/terraform/oidc/:
total 16
-rw-r--r-- 1 runner docker 840 Jun  1 15:37 main.tf
-rw-r--r-- 1 runner docker 203 Jun  1 15:37 providers.tf
-rw-r--r-- 1 runner docker 392 Jun  1 15:37 variables.tf
-rw-r--r-- 1 runner docker 150 Jun  1 15:37 versions.tf
path: /home/runner/work/_actions/cloudposse/github-action-setup-atmos/atmos/atmos-bin
/home/runner/work/_actions/cloudposse/github-action-setup-atmos/atmos/atmos-bin terraform plan oidc -s platformlive-dev-uw2
Found stack config files:
- _global.yaml
- aws/account-globals.yaml
- aws/nonprod/dev/globals.yaml
- aws/nonprod/dev/us-west-2.yaml
- aws/nonprod/staging/globals.yaml
- aws/nonprod/staging/us-east-2.yaml
- aws/prod/globals.yaml
- aws/prod/us-west-2.yaml
- workflows/aws-core-infra-workflow.yaml
Found config for the component 'oidc' for the stack 'platformlive-dev-uw2' in the stack config file 'aws/nonprod/dev/us-west-2'
Variables for the component 'oidc' in the stack 'platformlive-dev-uw2':
account_map:
  automation: null
  dev: ***
  prod: *****
  staging: ***
client_id_list:
- ****
environment: dev
idp_url: ****
namespace: platformlive
region: us-west-2
stage: uw2
tags:
  product: Platform Live
thumbprint_list:
- ******
Writing the variables to file:
components/terraform/oidc/platformlive-dev-uw2-oidc.terraform.tfvars.json
Writing the backend config to file:
components/terraform/oidc/backend.tf.json
Executing command:
/usr/local/bin/terraform init -reconfigure
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 4.0"...
- Installing hashicorp/aws v4.67.0...
- Installed hashicorp/aws v4.67.0 (signed by HashiCorp)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
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.
Command info:
Terraform binary: terraform
Terraform command: plan
Arguments and flags: []
Component: oidc
Stack: platformlive-dev-uw2
Working dir: components/terraform/oidc
Executing command:
/usr/local/bin/terraform workspace new platformlive-dev-uw2
Workspace "platformlive-dev-uw2" already exists
exit status 1
Error: Atmos exited with code 1.
Error: Process completed with exit code 1.

Anything that will help us triage the bug will help. Here are some ideas:
Github action runner

Additional Context

https://sweetops.slack.com/archives/C031919U8A0/p1685484685655049

@jamengual jamengual added the bug 🐛 An issue with the system label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

1 participant