Skip to content

Commit

Permalink
Merge pull request #40264 from kilmajster/main
Browse files Browse the repository at this point in the history
fix ignored skip_requesting_account_id argument
  • Loading branch information
ewbankkit authored Nov 22, 2024
2 parents 7a50b4d + a53860e commit d244ae5
Show file tree
Hide file tree
Showing 240 changed files with 4 additions and 1,923 deletions.
3 changes: 3 additions & 0 deletions .changelog/40264.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
provider: Suppress `Warning: AWS account ID not found for provider` when `skip_requesting_account_id` is `true`
```
2 changes: 1 addition & 1 deletion internal/conns/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS
})
}

if accountID == "" {
if accountID == "" && !awsbaseConfig.SkipRequestingAccountId {
diags = append(diags, errs.NewWarningDiagnostic(
"AWS account ID not found for provider",
"See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications."))
Expand Down
9 changes: 0 additions & 9 deletions internal/conns/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
terraformsdk "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/errs"
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
"github.com/hashicorp/terraform-provider-aws/internal/provider"
)
Expand Down Expand Up @@ -462,14 +461,6 @@ func TestProxyConfig(t *testing.T) {
}

expectedDiags := tc.expectedDiags
expectedDiags = append(
expectedDiags,
errs.NewWarningDiagnostic(
"AWS account ID not found for provider",
"See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.",
),
)

diags := p.Configure(ctx, terraformsdk.NewResourceConfigRaw(config))

if diff := cmp.Diff(diags, expectedDiags, cmp.Comparer(sdkdiag.Comparer)); diff != "" {
Expand Down
8 changes: 0 additions & 8 deletions internal/generate/serviceendpointtests/file.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -756,14 +756,6 @@ func testEndpointCase(t *testing.T, region string, testcase endpointTestCase, ca
}

expectedDiags := testcase.expected.diags
expectedDiags = append(
expectedDiags,
errs.NewWarningDiagnostic(
"AWS account ID not found for provider",
"See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.",
),
)

diags := p.Configure(ctx, terraformsdk.NewResourceConfigRaw(config))

if diff := cmp.Diff(diags, expectedDiags, cmp.Comparer(sdkdiag.Comparer)); diff != "" {
Expand Down
25 changes: 0 additions & 25 deletions internal/provider/provider_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,7 @@ sso_start_url = https://d-123456789a.awsapps.com/start#

diags = append(diags, p.Configure(ctx, rc)...)

// The provider always returns a warning if there is no account ID
var expected diag.Diagnostics
expected = append(expected,
errs.NewWarningDiagnostic(
"AWS account ID not found for provider",
"See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.",
),
)

if diff := cmp.Diff(diags, expected, cmp.Comparer(sdkdiag.Comparer)); diff != "" {
t.Errorf("unexpected diagnostics difference: %s", diff)
Expand Down Expand Up @@ -282,16 +275,7 @@ func (d testCaseDriver) Apply(ctx context.Context, t *testing.T) (context.Contex

diags = append(diags, p.Configure(ctx, rc)...)

// The provider always returns a warning if there is no account ID
var expected diag.Diagnostics
if d.mode == configtesting.TestModeLocal {
expected = append(expected,
errs.NewWarningDiagnostic(
"AWS account ID not found for provider",
"See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.",
),
)
}

if diff := cmp.Diff(diags, expected, cmp.Comparer(sdkdiag.Comparer)); diff != "" {
t.Errorf("unexpected diagnostics difference: %s", diff)
Expand Down Expand Up @@ -623,15 +607,6 @@ func TestProviderConfig_AssumeRole(t *testing.T) { //nolint:paralleltest
diags = append(diags, p.Configure(ctx, rc)...)

expectedDiags := tc.ExpectedDiags
// If the provider attempts authorization, it always returns a warning if there is no account ID
if !tc.ExpectedDiags.HasError() {
expectedDiags = append(expectedDiags,
errs.NewWarningDiagnostic(
"AWS account ID not found for provider",
"See https://registry.terraform.io/providers/hashicorp/aws/latest/docs#skip_requesting_account_id for implications.",
),
)
}

if diff := cmp.Diff(diags, expectedDiags, cmp.Comparer(sdkdiag.Comparer)); diff != "" {
t.Errorf("unexpected diagnostics difference: %s", diff)
Expand Down
8 changes: 0 additions & 8 deletions internal/service/accessanalyzer/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/account/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/acm/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/acmpca/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/amp/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/amplify/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/apigateway/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/apigatewayv2/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/appautoscaling/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/appconfig/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/appfabric/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/appflow/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/appmesh/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/apprunner/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/appstream/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/appsync/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions internal/service/athena/service_endpoints_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d244ae5

Please sign in to comment.