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

[BUG]: Terraform plan hangs/freezes when used in a GitHub Actions workflow AND auth is based on GitHub App #2241

Open
1 task done
tiberium opened this issue Apr 25, 2024 · 0 comments
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented

Comments

@tiberium
Copy link

Expected Behavior

terraform plan should work in a GitHub Actions workflow with authentication based on GitHub App (using PEM file as the private key).

Actual Behavior

When I try to run terraform plan -out=plan in a GitHub Action, and I set the envs to provide the GitHub App configuration (all three envs set correctly: GITHUB_APP_ID, GITHUB_APP_INSTALLATION_ID, GITHUB_APP_PEM_FILE), the GitHub Actions job freezes/hangs after doing few Refreshing state... operations.

When executed from a local machine, outside the GitHub Actions context, with the same terraform file, with the same envs, and the same terraform version, the terraform plan operation works as expected. It seems to me that the problem only exists when the terraform command is executed on the GitHub Actions runner. Tested on two runners: ubuntu-latest and arc-runner-set (k8s).

When using PAT generated from the GitHub App, the behavior is correct - the terraform plan command works as expected both locally and on the GitHub Actions runner.

Terraform Version

Terraform v1.7.1

GitHub Provider v6.2.1 (tested also with v6.0.1, same behavior)

Affected Resource(s)

Affects basic terraform plan command (at least) when executed in a GitHub Actions job context AND the auth is based on GitHub App.

Terraform Configuration Files

No response

Steps to Reproduce

jobs:
  terraform-plan:
    runs-on: [ ubuntu-latest ]
    steps:  
      - name: Checkout repository
        uses: actions/checkout@v4
  
      - name: Setup terraform
        uses: hashicorp/setup-terraform@v3
        with:
          terraform_version: 1.7.1
          terraform_wrapper: false
      
      - name: Configure AWS
         # To access the state file
         # ...
      
      - name: Terraform init
        run: terraform init
        
      - name: Terraform plan
        env:
          GITHUB_OWNER: ***
          GITHUB_APP_ID: ***
          GITHUB_APP_INSTALLATION_ID: ***
          GITHUB_APP_PEM_FILE: ***
        run: terraform plan -out=${{ runner.temp }}/plan

Debug Output

No response

Panic Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tiberium tiberium added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Apr 25, 2024
@kfcampbell kfcampbell added Status: Up for grabs Issues that are ready to be worked on by anyone and removed Status: Triage This is being looked at and prioritized labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Up for grabs Issues that are ready to be worked on by anyone Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

2 participants