Comments (6)
This should now be resolved in v1.3.0
. The default v1
tag has also been moved to the latest commit c455396
I've tested in a few plans on v0.12/v0.13/v0.14 and it seems to work consistently, but please feel free to re-open this issue if there's anything weird going on with the formatting or I've missed a test case!
from terraform-pr-commenter.
Yeah something is wrong with the parsing of the input somewhere. If TF_IN_AUTOMATION: true
is not set I get the following output:
I cherry picked the plan parsing parts from
terraform-pr-commenter/entrypoint.sh
Line 33 in b7622fb
and
terraform-pr-commenter/entrypoint.sh
Lines 186 to 192 in b7622fb
which became
INPUT=$(terraform plan | sed 's/\x1b\[[0-9;]*m//g')
CLEAN_PLAN=$(echo "$INPUT" | sed -n '/Refreshing state\.\.\./!p') # Strip refresh section
CLEAN_PLAN=$(echo "$CLEAN_PLAN" | sed -nr '/-{72}/q;p') # Ignore everything after the 72 dashes (happens when saving a plan to file)
CLEAN_PLAN=${CLEAN_PLAN::65300} # GitHub has a 65535-char comment limit - truncate plan, leaving space for comment wrapper
CLEAN_PLAN=$(echo "$CLEAN_PLAN" | sed -r 's/^([[:blank:]]*)([-+~])/\2\1/g') # Move any diff characters to start of line
CLEAN_PLAN=$(echo "$CLEAN_PLAN" | sed -r 's/^~/!/g') # Replace ~ with ! to colourise the diff in GitHub comments
echo "$CLEAN_PLAN"
and ran it locally, and the output looked correct (incl removing the 72 dashes and the text after that).
The input to Docker looks fine as far as I can tell when viewing it in the output of the Post Plan step.
It seems like all the output before the 72 dashes is removed for some reason. Maybe steps.plan.outputs.stdout
formats weirdly or something happens with the formatting when sending it to Docker?
from terraform-pr-commenter.
Apologies, these notifications went to spam and I missed this thread!
@tamccall or @Fresa would you be able to confirm which version of Terraform you're using in the preceding steps?
My immediate suspicion is that this is related to Terraform v0.14's change to the way the output is formatted after a plan (they dropped the 72 -
's.) I've not yet moved my personal Terraform config over from v0.13 to v0.14 yet and it seems to still be running fine on both v0.12 and v0.13 - at least in the quick checks that I've done now.
I'll have a look in the next day or two to see if there's a backwards-compatible way of stripping off that refresh section.
from terraform-pr-commenter.
v0.14.5
from terraform-pr-commenter.
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_version: 0.14.5
from terraform-pr-commenter.
Can confirm that it works like a charm now! Great work @robburger! 🎉
from terraform-pr-commenter.
Related Issues (20)
- Apply
- Comment update removes the wrong comment HOT 2
- Action does not work with Composite action HOT 1
- Read plan from a file?
- Please add an option input to allow or disallow PR comment overwrite
- Docker build error (unable to select packages) HOT 2
- Terraform fmt comment output wrongly with -diff option
- maximum commenter_input length? HOT 2
- update plan comment summary to show changes
- Option to update comments instead of deleting
- Why is it showing this error? It doesn't print the message in the PR HOT 2
- Empty PR comment for plan with "moved"
- Carry through Exit Code HOT 1
- Getting an error for posting the plan in the PR HOT 1
- deprecated messages in plan output are not displayed in the PR
- Multiple environments, not using Terraform workspaces HOT 2
- Is still repository still maintained? HOT 4
- DOES NOT WORK HOT 9
- Error relocating /usr/bin/curl: curl_easy_nextheader: symbol not found? HOT 1
- New Jimdo fork
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-pr-commenter.