commands/state_migrate: Implement JSON output - #38895
Draft
SarahFrench wants to merge 14 commits into
Draft
Conversation
SarahFrench
force-pushed
the
implement-state-migrate-json-output
branch
from
July 20, 2026 18:53
8b998c7 to
fee481f
Compare
SarahFrench
commented
Jul 20, 2026
| @@ -0,0 +1,3 @@ | |||
| {"@level":"info","@message":"Terraform 1.16.0-dev","@module":"terraform.ui","@timestamp":"2026-07-20T17:37:42.389757+01:00","terraform":"1.16.0-dev","type":"version","ui":"1.3"} | |||
| {"@level":"info","@message":"[reset][bold]Migrating state from backend \"local\" to backend \"local\"...[reset]","@module":"terraform.ui","@timestamp":"2026-07-20T17:37:42.392448+01:00"} | |||
Member
Author
There was a problem hiding this comment.
Wherever a log is produced through state migrate's Log method we have human output formatting directives present in the JSON like this.
Also, it'd be nice to have the log type be unique to the message, similar to messages logged via the ProviderInstaller interface.
SarahFrench
force-pushed
the
implement-state-migrate-json-output
branch
from
August 4, 2026 15:05
fee481f to
4a5c086
Compare
…r formatting and printing messages to stdout
… `print` method. This ensures that all methods perform the same actions on a message string: * Trim whitespace * Apply colour Previously `prepareMessage` did this, which meant that methods that don't use `prepareMessage` were at risk of not formatting messages in the expected way.
…a view to log details about establishing trust for a PSS provider This change also takes the PSS-related message codes/types and puts them in the message_types.go file, and avoids the 'message registry' in the init view implementation's file.
…ger use the init message registry when constructing the logged message. Also, update the message type code. Before we matched what was in the init message registry, but now we match the conventions of message_types.go instead of having unnecessary `_message` suffixes.
…tion_start` message type, and how it's used as the value of the `type` field in JSON objects.
… if an unrecognised message code, or empty message contents, is encountered. The `init` implementation of 'prepareMessage' doesn't panic and instead lets data fall through, which potentially can cover up defects (they'd otherwise only be detectable by tests asserting that log's contents). As `state migrate` is new I believe panicking is good as it helps us identify defects.
…nInfoWithKeyID` methods to `StateMigrateJSON` view
SarahFrench
force-pushed
the
implement-state-migrate-json-output
branch
2 times, most recently
from
August 5, 2026 14:23
85e25d2 to
25ccbdb
Compare
…es on `StateMigrateJSON` view
…s golden reference files.
SarahFrench
force-pushed
the
implement-state-migrate-json-output
branch
from
August 5, 2026 14:40
25ccbdb to
e7830bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP
Target Release
1.17.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry