Skip to content
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

fix: omit null defaultValue in bpmetadata #2048

Merged
merged 6 commits into from
Jan 5, 2024

Conversation

rzy-goog
Copy link
Member

Related to b/316180349

Currently, cft blueprint metadata -d appears to set the defaultValue to null if there's no default set in the Terraform file.

This breaks current terraform metadata parsing in g3

This change will omit defaultvalue from being added when null.

@apeabody apeabody changed the title chore: omit null defaultValue in bpmetadata fix: omit null defaultValue in bpmetadata Dec 19, 2023
@g-awmalik g-awmalik self-assigned this Dec 28, 2023
Copy link
Collaborator

@g-awmalik g-awmalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for a minor nit.

Comment on lines 234 to 238
if modVar.Default != nil {
vl, err := structpb.NewValue(modVar.Default)
if err == nil {
v.DefaultValue = vl
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we make this a bit more left aligned?

Suggested change
if modVar.Default != nil {
vl, err := structpb.NewValue(modVar.Default)
if err == nil {
v.DefaultValue = vl
}
if modVar.Default == nil {
return v
}
vl, err := structpb.NewValue(modVar.Default)
if err == nil {
v.DefaultValue = vl
}
return v

Copy link
Collaborator

@g-awmalik g-awmalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rzy-goog rzy-goog requested a review from g-awmalik January 4, 2024 06:38
@g-awmalik g-awmalik merged commit 1b5665e into GoogleCloudPlatform:master Jan 5, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants