kvrhdn / tfe-run Goto Github PK
View Code? Open in Web Editor NEWThe glue between GitHub Actions and Terraform Cloud
License: MIT License
The glue between GitHub Actions and Terraform Cloud
License: MIT License
TFC Run triggered using this GH Action fail with below issue.
Same error does not happen when I Queue plan manually from the Terraform Cloud UI.
Terraform v1.0.0
on linux_amd64
Setup failed: failed unpacking terraform config: lstat /tmp/terraform-build-worker01234676/slug: no such file or directory
I've tried configure the workspace with both UI/VCS-driven and API-driven workflows. Same issue in both cases.
Action step:
- name: Terraform Cloud Run
uses: kvrhdn/[email protected]
with:
token: ${{ secrets.TFC_ACCESS_TOKEN }}
organization: MyOpg
workspace: my-workspace
type: apply
wait-for-completion: true
message: |
Run triggered using tfe-run (commit: ${{ github.SHA }})
id: tfe-run
Recommendation from GitHub: https://github.com/actions/toolkit/blob/master/docs/action-versioning.md
Because the output of the run is being got directly from the state it prints sensitive output values to the github action log.
Would be good to suppress this like the CLI does or at least make it an option.
Follow up from #22: in a new Terraform workspace when no statefile has been added yet, every speculative run will fail when attempting to fetch the outputs.
We should either:
terraform enterprise makes use of the same API as native terraform cloud.
Therefore, It would be nice if we can pass a hostname for an org terraform enterprise server in GitHub actions so that it doesn't use the default "app.terraform.io" for all api calls.
I hit the following issue when I added a Terraform output of type array.
Terraform Cloud Plan & Apply passes successfully and I can see array output.
But kvrhdn/tfe-run
action fails with
Run kvrhdn/[email protected]
...
Run has been applied!
Error: could not parse state: json: cannot unmarshal array into Go struct field terraformOutput.outputs.value of type string
My Terraform output
terraform output
name = [
"my-name",
]
Would you be open to a pull request for optionally passing as arguments and environment variables? I'm new to go and found your project when I was working through how to create a run through the SDK. Your much better implementation has given me a lot of great example content on how to do this.
I'm using in azure devops pipelines right now and was considering enhancing to support not just json but also env/cli args. If that's within scope let me know and I'll see if I can make a contribution and get some feedback for you. Cheers and thanks for this project!
Terraform Cloud gives me an error regarding the variables that have been uploaded to the run. Apparently they're missing a trailing newline, and nothing I've tried in the yaml will force the variable definition to include one.
I would expect that updating tfe-run
or go-tfe-run
to ensure there's a newline at the end of the vars file would fix this.
With a couple of Terraform providers we hit some transient errors which can be addressed by simply retrying the workspace run again.
Would it be possible to add a way to specify retriable errors to the action?
Similar to Terragrunt https://terragrunt.gruntwork.io/docs/features/auto-retry/
EDIT 6 Sept.: original title was Segmentation violation during monitoring of the run
The past day two runs failed with the same error message. It's unclear what is causing this error (whether it's a bug in our code or weird responses coming from the API), but we should try to fix it anyway.
Error message:
...
Run status: apply queued
Run status: applying
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x6d00d3]
goroutine 1 [running]:
github.com/kvrhdn/go-tfe-run.Run(0x803d80, 0xc00001c078, 0xc00002400c, 0x5a, 0xc00001e053, 0x6, 0xc0000200a0, 0x13, 0xc000012e10, 0x0, ...)
/go/pkg/mod/github.com/kvrhdn/[email protected]/tferun.go:188 +0x1483
main.main()
/app/main.go:52 +0x31f
The runs on Terraform Cloud where not impact and completed successfully.
Integration run 30 Aug. 10:21 UTC: https://github.com/kvrhdn/tfe-run/runs/1047358751?check_suite_focus=true#step:9:51
Integration run 30 Aug. 14:16 UTC: https://github.com/kvrhdn/tfe-run/runs/1047790479?check_suite_focus=true#step:9:51
Integration run 30 Aug, 23:15 UTC https://github.com/kvrhdn/tfe-run/runs/1048796083?check_suite_focus=true#step:9:51
Any ideas on this error?
For a Pull Request I'm using the action to run a Speculative Plan so type
is set to plan
- name: Terraform Cloud Speculative Plan
uses: kvrhdn/[email protected]
with:
token: ${{ secrets.TFC_ACCESS_TOKEN }}
organization: MyOrg
workspace: networking-workspace
directory: networking/
type: plan
wait-for-completion: true
message: |
${{ github.head_ref }} - ${{ github.event.commits[0].message }} #${{ github.run_number }} (commit: ${{ steps.slug.outputs.sha8 }})
From Terraform Cloud the speculative-plan finished successfully but the tfe-run
action fails
Run status: pending
Run status: plan queued
Run status: planning
Run status: planned and finished
Run is planned and finished.
::set-output name=run-url::https://app.terraform.io/app/XXXX
##[debug]='https://app.terraform.io/app/XXXXX'
::set-output name=has-changes::true
##[debug]='true'
Error: could not get current state: resource not found
##[debug]Docker Action run completed with exit code 1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.