backend/s3: skip account verification when no constraints given (#772)

Signed-off-by: Marcin Białoń <mbialon@spacelift.io>
This commit is contained in:
Marcin Białoń 2023-10-24 13:34:43 +02:00 committed by GitHub
parent b17374dc44
commit 10f7aeff66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -621,6 +621,10 @@ func (b *Backend) Configure(obj cty.Value) tfdiags.Diagnostics {
}
func verifyAllowedAccountID(ctx context.Context, awsConfig aws.Config, cfg *awsbase.Config) tfdiags.Diagnostics {
if len(cfg.ForbiddenAccountIds) == 0 && len(cfg.AllowedAccountIds) == 0 {
return nil
}
var diags tfdiags.Diagnostics
accountID, _, awsDiags := awsbase.GetAwsAccountIDAndPartition(ctx, awsConfig, cfg)
for _, d := range awsDiags {