Skip to content

Commit

Permalink
Updates aws-sdk-go-base
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Jul 20, 2023
1 parent c39bfa3 commit 8a0a52b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
17 changes: 11 additions & 6 deletions internal/conns/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package conns
import (
"context"
"fmt"
"log"

aws_sdkv2 "github.com/aws/aws-sdk-go-v2/aws"
imds_sdkv2 "github.com/aws/aws-sdk-go-v2/feature/ec2/imds"
Expand All @@ -16,6 +15,7 @@ import (
basediag "github.com/hashicorp/aws-sdk-go-base/v2/diag"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-provider-aws/internal/errs"
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
"github.com/hashicorp/terraform-provider-aws/names"
Expand Down Expand Up @@ -147,14 +147,19 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS
}

tflog.Debug(ctx, "Retrieving AWS account details")
accountID, partition, err := awsbase.GetAwsAccountIDAndPartition(ctx, cfg, &awsbaseConfig)
if err != nil {
return nil, sdkdiag.AppendErrorf(diags, "retrieving AWS account details: %s", err)
accountID, partition, awsDiags := awsbase.GetAwsAccountIDAndPartition(ctx, cfg, &awsbaseConfig)
for _, d := range awsDiags {
diags = append(diags, diag.Diagnostic{
Severity: baseSeverityToSdkSeverity(d.Severity()),
Summary: fmt.Sprintf("retrieving AWS account details: %s", d.Summary()),
Detail: d.Detail(),
})
}

if accountID == "" {
// TODO: Make this a Warning Diagnostic
log.Println("[WARN] AWS account ID not found for provider. See https://www.terraform.io/docs/providers/aws/index.html#skip_requesting_account_id for implications.")
diags = append(diags, errs.NewWarningDiagnostic(
"AWS account ID not found for provider",
"See https://www.terraform.io/docs/providers/aws/index.html#skip_requesting_account_id for implications."))
}

if len(c.ForbiddenAccountIds) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions internal/service/configservice/configservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestAccConfigService_serial(t *testing.T) {
"ConformancePack": {
"basic": testAccConformancePack_basic,
"disappears": testAccConformancePack_disappears,
"forceNew": testAccConformancePack_forceNew,
"updateName": testAccConformancePack_updateName,
"inputParameters": testAccConformancePack_inputParameters,
"S3Delivery": testAccConformancePack_S3Delivery,
"S3Template": testAccConformancePack_S3Template,
Expand All @@ -57,7 +57,7 @@ func TestAccConfigService_serial(t *testing.T) {
"basic": testAccOrganizationConformancePack_basic,
"disappears": testAccOrganizationConformancePack_disappears,
"excludedAccounts": testAccOrganizationConformancePack_excludedAccounts,
"forceNew": testAccOrganizationConformancePack_forceNew,
"updateName": testAccOrganizationConformancePack_updateName,
"inputParameters": testAccOrganizationConformancePack_inputParameters,
"S3Delivery": testAccOrganizationConformancePack_S3Delivery,
"S3Template": testAccOrganizationConformancePack_S3Template,
Expand Down
3 changes: 2 additions & 1 deletion internal/service/configservice/conformance_pack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testAccConformancePack_basic(t *testing.T) {
})
}

func testAccConformancePack_forceNew(t *testing.T) {
func testAccConformancePack_updateName(t *testing.T) {
ctx := acctest.Context(t)
var before, after configservice.ConformancePackDetail
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
Expand All @@ -72,6 +72,7 @@ func testAccConformancePack_forceNew(t *testing.T) {
Config: testAccConformancePackConfig_basic(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckConformancePackExists(ctx, resourceName, &before),
resource.TestCheckResourceAttr(resourceName, "name", rName),
),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func testAccOrganizationConformancePack_excludedAccounts(t *testing.T) {
})
}

func testAccOrganizationConformancePack_forceNew(t *testing.T) {
func testAccOrganizationConformancePack_updateName(t *testing.T) {
ctx := acctest.Context(t)
var before, after configservice.OrganizationConformancePack
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
Expand All @@ -144,6 +144,7 @@ func testAccOrganizationConformancePack_forceNew(t *testing.T) {
Config: testAccOrganizationConformancePackConfig_basic(rName),
Check: resource.ComposeTestCheckFunc(
testAccCheckOrganizationConformancePackExists(ctx, resourceName, &before),
resource.TestCheckResourceAttr(resourceName, "name", rName),
),
},
{
Expand Down Expand Up @@ -650,7 +651,6 @@ resource "aws_s3_bucket" "test" {
bucket = %q
force_destroy = true
}
`, rName, bName))
}

Expand Down

0 comments on commit 8a0a52b

Please sign in to comment.