-
Notifications
You must be signed in to change notification settings - Fork 62
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
Update Terraform repl package to bring in better formatting #14
Conversation
The repl package in Terraform core was updated to include heredoc formatting for multiline strings. The interface for this package changed to use cty.Value rather than map[string]interface{} so I had to bring in cty as a dependency and update the code that munges the manifest after it has been decoded to use it.
var serverSideMetadataFields = []string{ | ||
// ignoreMetadata is the list of metadata fields to strip | ||
// when --strip is supplied | ||
var ignoreMetadata = []string{ |
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.
managedFields
should also be dropped. They usually appear on resources extracted off a running cluster with 'kubectl get` and are technically a read-only field from the POV of the client.
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.
Yeah it is on the list it's just hidden by this diff 😄
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.
🤦
|
||
// stripServerSideFields removes fields that have been added on the | ||
// server side after the resource was created such as the status field | ||
func stripServerSideFields(doc cty.Value) cty.Value { |
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.
Not for this PR, but this function seems a prime candidate for some unit testing. Looks nicely isolated with (almost) no dependencies.
The repl package in Terraform core was updated to include heredoc formatting
for multiline strings.
The interface for the terraform/repl package changed to use cty.Value
rather than map[string]interface{} so I had to bring in cty as a dependency
and update the code that munges the manifest after it has been decoded to use it.
Closes #13
Multi-line support looks like this: