Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ignored skip_requesting_account_id argument #40264

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

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.

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
Loading