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

Go rewrite diffs fix #11659

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mmv1/products/securitycenterv2/ProjectMuteConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ examples:
vars:
mute_config_id: 'my-config'
test_env_vars:
project_id: PROJECT_NAME
project_id: :PROJECT_NAME
parameters:
- !ruby/object:Api::Type::String
name: location
Expand Down
3 changes: 3 additions & 0 deletions mmv1/templates/terraform/env_var_context.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@
"{{$varKey}}": envvar.GetTestZoneFromEnv(),
{{- end }}
{{- end }}
{{- if and $.HasNewLine (gt (len $.TestEnvVars) 0)}}
Copy link
Contributor

Choose a reason for hiding this comment

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

$.HasNewLine

I didn't realize we had this lol

Copy link
Member Author

@zli82016 zli82016 Sep 9, 2024

Choose a reason for hiding this comment

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

It is passed when calling the EnvVarContext templates.

{{""}}
{{- end}}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestAcc{{ $e.TestSlug $.Res.ProductMetadata.Name $.Res.Name }}(t *testing.T
t.Parallel()

context := map[string]interface{}{
{{- template "EnvVarContext" $e }}
{{- template "EnvVarContext" dict "TestEnvVars" $e.TestEnvVars "HasNewLine" false}}
{{- range $varKey, $varVal := $e.TestVarsOverrides }}
"{{$varKey}}": {{$varVal}},
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion mmv1/templates/terraform/iam/go/iam_context.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{- if $.IamPolicy.TestProjectName }}
"project_id" : fmt.Sprintf("{{ $.IamPolicy.TestProjectName }}%s", acctest.RandString(t, 10)),
{{- end }}
{{- template "EnvVarContext" $.FirstTestExample }}
{{- template "EnvVarContext" dict "TestEnvVars" $.FirstTestExample.TestEnvVars "HasNewLine" true}}
{{- if $.FirstTestExample.TestVarsOverrides }}
{{- range $varName, $override := $.FirstTestExample.TestVarsOverrides }}
"{{ $varName }}": {{ $override }},
Expand Down
Loading