hashicorp / setup-terraform

Sets up Terraform CLI in your GitHub Actions workflow.
https://developer.hashicorp.com/terraform/tutorials/automation/github-actions
Mozilla Public License 2.0
1.37k stars 240 forks source link

Terraform apply with Environment Variables taking an eternity to finish #403

Open yuvaraja402 opened 6 months ago

yuvaraja402 commented 6 months ago

Description:

In my current project, I have a working directory containing a Python application and Terraform script. As part of the deployment process, I'm using a GitHub runner to execute Terraform scripts for infrastructure provisioning.

Problem:

The deployment phase seems to be stuck after passing the _client_id and client_secret_ from GitHub secrets.

Screenshot 2024-03-16 at 10 35 39 PM

File Structure for clarity:

The Terraform files involved in this process include:

Screenshot 2024-03-16 at 10 29 22 PM Screenshot 2024-03-16 at 10 42 58 PM
bflad commented 6 months ago

Hi @yuvaraja402 👋 Thank you for raising this and let's see if we cannot get you unstuck here.

One thing that I am immediately noticing is that you are pointing at a quite old hashicorp/setup-terraform@v1 tag. Does anything change if you switch that to v2 or v3?

Do you see any output if you let the command run for a very long time? GitHub Actions should time it out at 6 hours, but that is also configurable with the timeout-minutes workflow configuration.

One other thing you may want to try in this case is disabling the GitHub Actions wrapper, which seems to be problematic at the moment (https://github.com/hashicorp/setup-terraform/issues/395) -- that should allow Terraform CLI to output information into the GitHub Actions logs immediately, rather than potentially waiting until the command is finished for any long-running operations.

For example:

- name: Install Terraform
  uses: hashicorp/setup-terraform@v3
  with:
    terraform_wrapper: false

Hope this helps. Please let us know how it goes.

yuvaraja402 commented 6 months ago

Hello @bflad 👋 Thank you for responding on this thread!

As you suggested, yes I did try with v2 and v3 for hashicorp/setup-terraform@v1 and do meet the same problem. I haven't let the runner run for more than 2 hours since it depletes the purpose of using a Github runner if it takes long to push my changes.

I will try the GitHub Actions wrapper and will update this thread soon.

Regards, Yuva