refactor: Add methods to init command's view implementations for logging about progress of initialising the working directory - #38992
Draft
SarahFrench wants to merge 5 commits into
Draft
Conversation
…s view implementations
…Complete` methods to `init` command's view implementations
…itializationCompleteCallToAction` methods to `init` command's view implementations
…successful initialization of a project with empty config.
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.
This PR adds methods to the
viewspackage'sInitinterface for logging messages related to the progress of initialising the working directory:Initializing HCP Terraform...initializing_terraform_cloud_messageTerraform has been successfully initialized!ORTerraform initialized in an empty directory!output_init_success_messageORoutput_init_empty_messageYou may now begin working with Terraform...output_init_success_cli_messageYou may now begin working with HCP Terraform...output_init_success_cli_cloud_messageDesign decisions
In future, fewer JSON
types could be used and nuances described via other fields.I combined logging
Terraform has been successfully initialized!andTerraform initialized in an empty directory!to the same method as I imagine that a future JSON object representing initialisation of a working directory could betype= a more genericinit_completeand then distinguish between whether the config was empty or not using fields in the JSON (and different human-readable summaries of the object).This could be extended to allow cloud and non-cloud versions of a message to be made from a single method, but I figured that was over-optimisation for this stage.
Using language that matches how other structured logging/SRO is implemented
In plan/apply's JSON logging the message types have conventions of _start, _progress, _complete, _errored as shared suffixes for JSON object types.
The init command produces structured logging/SRO but doesn't follow these conventions. The method names in this PR attempt to do this, and hopefully in future we can make changes to the JSON objects themselves (breaking change tho 😭).
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