Skip to content

Commit

Permalink
Support impersonation for bootstrap requests (#12104)
Browse files Browse the repository at this point in the history
  • Loading branch information
roaks3 authored Oct 23, 2024
1 parent 994ed95 commit 075e151
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,11 @@ func BootstrapConfig(t *testing.T) *transport_tpg.Config {
}

config := &transport_tpg.Config{
Credentials: envvar.GetTestCredsFromEnv(),
Project: envvar.GetTestProjectFromEnv(),
Region: envvar.GetTestRegionFromEnv(),
Zone: envvar.GetTestZoneFromEnv(),
Credentials: envvar.GetTestCredsFromEnv(),
ImpersonateServiceAccount: envvar.GetTestImpersonateServiceAccountFromEnv(),
Project: envvar.GetTestProjectFromEnv(),
Region: envvar.GetTestRegionFromEnv(),
Zone: envvar.GetTestZoneFromEnv(),
}

transport_tpg.ConfigureBasePaths(config)
Expand Down
8 changes: 8 additions & 0 deletions mmv1/third_party/terraform/envvar/envvar_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ var PapDescriptionEnvVars = []string{
"GOOGLE_PUBLIC_AVERTISED_PREFIX_DESCRIPTION",
}

var ImpersonateServiceAccountEnvVars = []string{
"GOOGLE_IMPERSONATE_SERVICE_ACCOUNT",
}

// AccTestPreCheck ensures at least one of the project env variables is set.
func GetTestProjectNumberFromEnv() string {
return transport_tpg.MultiEnvSearch(ProjectNumberEnvVars)
Expand Down Expand Up @@ -138,6 +142,10 @@ func GetTestZoneFromEnv() string {
return transport_tpg.MultiEnvSearch(ZoneEnvVars)
}

func GetTestImpersonateServiceAccountFromEnv() string {
return transport_tpg.MultiEnvSearch(ImpersonateServiceAccountEnvVars)
}

func GetTestCustIdFromEnv(t *testing.T) string {
SkipIfEnvNotSet(t, CustIdEnvVars...)
return transport_tpg.MultiEnvSearch(CustIdEnvVars)
Expand Down

0 comments on commit 075e151

Please sign in to comment.