-
Notifications
You must be signed in to change notification settings - Fork 239
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
Plan too long to be passed between steps #24
Comments
A workaround is to disable the wrapper: - uses: hashicorp/setup-terraform@master
with:
terraform_wrapper: false
- run: terraform plan -out terraform.plan
- run: terraform show -json terraform.plan | tee terraform.json I wish the wrapper was disabled by default. |
I just discovered |
+1 to @alexjurkiewicz's wish that the wrapper was disabled by default, would've saved me quite a bit of debugging time. An additional note for anyone leveraging Terraform Cloud - the "remote" backend does not support saving a generated plan locally at this time (you'll get Unfortunately it seems that including the plan body in the PR comment (as described in the documentation example OP cited) isn't really feasible when your terraform plans can be large and you're managing state in Terraform Cloud. I had high hopes of scripting around the environment variable problem and implementing a file read in github-script like this, but I've thrashed enough on the problem that I'll probably just settle for having the full plans available in the Actions logs. |
My workspace has 1600 resources (long story), so the plan has 1600 lines in it of
|
@anthonyangel thanks for your script. But this will not work if plan is really long. Therefore I added this:
alternatively it's possible to shorten the plan to fit the max length but I'm too lazy to do so :D |
i know its old, but what worked for me was a combination of @anthonyangel and @euqen, difference with my approach is that we split on changes or no changes then again on any warnings to get "the middle"
|
We had a similar issue! We check the length of the plan before even considering passing it to the next step.
|
This example in the documentation often breaks down in real life. If the output from
terraform plan
is too big, it can't fit in an environment variable (which is how the documentation shows it being accessed).The workaround we have found is to save the plan as a file, pass the filename, and then use
terraform show -json $filename > plan.json
to get the plan value in the second step. The problem we are having with this workaround is that the wrapper script breaks STDOUT.The text was updated successfully, but these errors were encountered: