diff --git a/pkg/accounts/account_resource.go b/pkg/accounts/account_resource.go index 70dc8efc..cf26ea38 100644 --- a/pkg/accounts/account_resource.go +++ b/pkg/accounts/account_resource.go @@ -26,6 +26,7 @@ type AccountResource struct { Name string `json:"Name" validate:"required,notall"` PrivateKeyFile *core.SensitiveValue `json:"PrivateKeyFile,omitempty"` PrivateKeyPassphrase *core.SensitiveValue `json:"PrivateKeyPassphrase,omitempty"` + Region string `json:"Region,omitempty"` ResourceManagerEndpoint string `json:"ResourceManagementEndpointBaseUri,omitempty"` SecretKey *core.SensitiveValue `json:"SecretKey,omitempty"` Slug string `json:"Slug,omitempty"` diff --git a/pkg/accounts/account_utilities.go b/pkg/accounts/account_utilities.go index 16e5d22b..b46b15dc 100644 --- a/pkg/accounts/account_utilities.go +++ b/pkg/accounts/account_utilities.go @@ -23,6 +23,7 @@ func ToAccount(accountResource *AccountResource) (IAccount, error) { if err != nil { return nil, err } + amazonWebServicesAccount.Region = accountResource.Region account = amazonWebServicesAccount case AccountTypeAwsOIDC: awsOIDCAccount, err := NewAwsOIDCAccount(accountResource.GetName(), accountResource.RoleArn) @@ -31,6 +32,7 @@ func ToAccount(accountResource *AccountResource) (IAccount, error) { } awsOIDCAccount.RoleArn = accountResource.RoleArn awsOIDCAccount.SessionDuration = accountResource.SessionDuration + awsOIDCAccount.Region = accountResource.Region awsOIDCAccount.Audience = accountResource.Audience awsOIDCAccount.DeploymentSubjectKeys = accountResource.DeploymentSubjectKeys awsOIDCAccount.AccountTestSubjectKeys = accountResource.AccountTestSubjectKeys @@ -149,10 +151,12 @@ func ToAccountResource(account IAccount) (*AccountResource, error) { amazonWebServicesAccount := account.(*AmazonWebServicesAccount) accountResource.AccessKey = amazonWebServicesAccount.AccessKey accountResource.SecretKey = amazonWebServicesAccount.SecretKey + accountResource.Region = amazonWebServicesAccount.Region case AccountTypeAwsOIDC: awsOIDCAccount := account.(*AwsOIDCAccount) accountResource.RoleArn = awsOIDCAccount.RoleArn accountResource.SessionDuration = awsOIDCAccount.SessionDuration + accountResource.Region = awsOIDCAccount.Region accountResource.Audience = awsOIDCAccount.Audience accountResource.DeploymentSubjectKeys = awsOIDCAccount.DeploymentSubjectKeys accountResource.AccountTestSubjectKeys = awsOIDCAccount.AccountTestSubjectKeys diff --git a/pkg/accounts/amazon_web_services_account.go b/pkg/accounts/amazon_web_services_account.go index 259cfa6c..e7a4e491 100644 --- a/pkg/accounts/amazon_web_services_account.go +++ b/pkg/accounts/amazon_web_services_account.go @@ -13,6 +13,7 @@ import ( type AmazonWebServicesAccount struct { AccessKey string `json:"AccessKey" validate:"required"` SecretKey *core.SensitiveValue `json:"SecretKey" validate:"required"` + Region string `json:"Region,omitempty"` account } diff --git a/pkg/accounts/aws_oidc_account.go b/pkg/accounts/aws_oidc_account.go index 4d44e72d..4dde3687 100644 --- a/pkg/accounts/aws_oidc_account.go +++ b/pkg/accounts/aws_oidc_account.go @@ -11,6 +11,7 @@ import ( type AwsOIDCAccount struct { RoleArn string `json:"RoleArn"` SessionDuration string `json:"SessionDuration,omitempty"` + Region string `json:"Region,omitempty"` Audience string `json:"Audience,omitempty"` DeploymentSubjectKeys []string `json:"DeploymentSubjectKeys,omitempty" validate:"omitempty,dive,oneof=space environment project tenant runbook account type'"` HealthCheckSubjectKeys []string `json:"HealthCheckSubjectKeys,omitempty" validate:"omitempty,dive,oneof=space account target type'"`