-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Prevent duplicate plan output for TFE releases that don't support SRO for CLI #33018
Conversation
Heads up! This PR also contains the dependency upgrades that fix #31895 as well as fixes errors when applying from within a symlinked working directory. |
e15cd4d
to
cc91efc
Compare
cc91efc
to
6c3eacb
Compare
First glance looks good! Will take a deeper soon, but could you do a flyby fix of the type in the error message that was highlighted? Edit, this typo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, pending fixing the error message!
Will wait for an approval from @Mralbert93 before merging 👍 |
The plan succeeded without the warning or duplicate plan output, but it looks like there might be a slight issue parsing the TFE version. Please see below:
|
bc660c3
to
300a60f
Compare
LGTM now 👍
|
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
I think this missed the deadline for 1.4.5. Will this ship out in 1.4.6? |
Yes, let me backport it now to make sure. |
* Refactor SRO check to prevent duplicate plan output * Unit tests to ensure renderer is appropriately called * Fix typo in format version check --------- Co-authored-by: Sebastian Rivera <sebas.rivera0047@gmail.com> Co-authored-by: Sebastian Rivera <sebastian.rivera@hashicorp.com>
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
A customer reported seeing duplicate plan output when using Terraform v1.4.x against a TFE release that did not support enabling structured logging for runs created via the CLI. They see duplicate plan output because these releases will silently disable the setting when a run is created, resulting in plan output being written in human-readable format to the streamed log file. The only requirement to call the new JSON plan renderer (which generates plan output) was that the remote workspace needs to have the structured run output setting enabled. Therefore, plan output would be read from the streamed log file and subsequently re-generated by the plan renderer.
In short, this fix makes the check "TFE-aware". The requirement to call the JSON plan renderer for a cloud backend configured against TFE is:
X-TFE-Version
header), then the release must be equal to or later than202302-1
. This is the release version that adds SRO support for CLI-driven runs.X-TFE-Version
change.NOTE: The check still requires structured run output to be enabled on a TFE workspace for the renderer to be called.
Target Release
1.4.5
Draft CHANGELOG entry
BUG FIXES
cloud
: Fixes duplicate plan output for TFE releases that don't support enabling structured logging for CLI runs.Testing
In order to smoke test this, you will need a TFE release older than
202302-1
.tfenv install 1.4.0 && tfenv use 1.4.0
cloud
backend against the TFE installation. Andterraform plan
(your workspace, if created onterraform init
, should have SRO enabled by default).go install
. Run a plan using the installed binary:$GOPATH/bin/terraform plan