Skip to content

Commit

Permalink
Revert "r/aws_fms_admin_account: Retries."
Browse files Browse the repository at this point in the history
This reverts commit ce57792.
  • Loading branch information
ewbankkit committed Apr 9, 2024
1 parent ce57792 commit baa275d
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions internal/service/fms/admin_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,7 @@ func resourceAdminAccountDelete(ctx context.Context, d *schema.ResourceData, met
var diags diag.Diagnostics
conn := meta.(*conns.AWSClient).FMSClient(ctx)

// Acceptance testing creates and deletes resources in quick succession.
// The FMS onboarding process into Organizations is opaque to consumers.
// Since we cannot reasonably check this status before receiving the error,
// set the operation as retryable.
const (
timeout = 1 * time.Minute
)
_, err := tfresource.RetryWhenIsAErrorMessageContains[*awstypes.InvalidOperationException](ctx, timeout, func() (interface{}, error) {
return conn.DisassociateAdminAccount(ctx, &fms.DisassociateAdminAccountInput{})
}, "Your AWS Organization is currently onboarding with AWS Firewall Manager and cannot be offboarded.")
_, err := conn.DisassociateAdminAccount(ctx, &fms.DisassociateAdminAccountInput{})

if err != nil {
return sdkdiag.AppendErrorf(diags, "disassociating FMS Admin Account (%s): %s", d.Id(), err)
Expand Down Expand Up @@ -161,16 +152,7 @@ func statusAssociateAdminAccount(ctx context.Context, conn *fms.Client, accountI
AdminAccount: aws.String(accountID),
}

// Acceptance testing creates and deletes resources in quick succession.
// The FMS onboarding process into Organizations is opaque to consumers.
// Since we cannot reasonably check this status before receiving the error,
// set the operation as retryable.
const (
timeout = 1 * time.Minute
)
_, err := tfresource.RetryWhenIsAErrorMessageContains[*awstypes.InvalidOperationException](ctx, timeout, func() (interface{}, error) {
return conn.AssociateAdminAccount(ctx, input)
}, "Your AWS Organization is currently offboarding with AWS Firewall Manager. Please submit onboard request after offboarded.")
_, err := conn.AssociateAdminAccount(ctx, input)

if err != nil {
return nil, "", err
Expand Down

0 comments on commit baa275d

Please sign in to comment.