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.35k stars 237 forks source link

terraform init failing with latest main branch #359

Closed rgarg-quotient closed 10 months ago

rgarg-quotient commented 10 months ago

Hi,

We are using hashicorp/setup-terraform@main In our GitHub actions and it started failing in terraform init step recently with below error (Last worked successfully on 17th Oct with Main branch):

/home/svc_ghrunner/actions-runner/_work/_temp/adc49003-750d-4b8c-816f-c6c738c0e0a2/terraform:4342
      this._parser?.end()
                   ^

SyntaxError: Unexpected token .
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

I checked the commit history in main branch and tested that last working commit id is 34acbbf0339967bd99d1eb8fb98c51bcb3417a2b.

Please check on this and for the time being, can we have a tag on last working commit ID.

Thanks

austinvalle commented 10 months ago

Hey @rgarg-quotient 👋🏻 , thanks for the report! We're planning on releasing a new tagged version of the action soon (v3.0.0), but we had merged some dependencies in the wrong order. I have reverted the affected commit in our main branch.

As an aside, our general recommendation/expectations for version pinning would be on a tagged release and not the main branch, in-line with GitHub's recommendation.

So something like this:

      - uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
pribanerjee commented 10 months ago

hey @austinvalle , its still failing.. as when we use hashicorp/setup-terraform@v3 in our pipeline with wrapper enabled, terraform_version: 1.5.*, 1.6.1 it fails with error with same error

/actions-runner/_temp/e6023f8c-517d-4123-8609-5827ed8f73a7/terraform:4342 this._parser?.end() ^

SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 Error: Process completed with exit code 1.

github-actions[bot] commented 3 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.