Skip to content

Commit 080d20a

Browse files
committed
r/aws_ec2_transit_gateway: Move waiters and status function.
1 parent 779f4a8 commit 080d20a

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

internal/service/ec2/transitgateway_.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/hashicorp/aws-sdk-go-base/v2/tfawserr"
1616
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1717
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
18-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
1918
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
2019
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
2120
"github.com/hashicorp/terraform-provider-aws/internal/conns"
@@ -325,23 +324,3 @@ func resourceTransitGatewayDelete(ctx context.Context, d *schema.ResourceData, m
325324

326325
return diags
327326
}
328-
329-
func waitTransitGatewayDeleted(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.TransitGateway, error) {
330-
stateConf := &retry.StateChangeConf{
331-
Pending: enum.Slice(awstypes.TransitGatewayStateAvailable, awstypes.TransitGatewayStateDeleting),
332-
Target: []string{},
333-
Refresh: statusTransitGateway(ctx, conn, id),
334-
Timeout: timeout,
335-
Delay: 2 * time.Minute,
336-
MinTimeout: 10 * time.Second,
337-
NotFoundChecks: 1,
338-
}
339-
340-
outputRaw, err := stateConf.WaitForStateContext(ctx)
341-
342-
if output, ok := outputRaw.(*awstypes.TransitGateway); ok {
343-
return output, err
344-
}
345-
346-
return nil, err
347-
}

internal/service/ec2/wait.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,26 @@ func waitTransitGatewayCreated(ctx context.Context, conn *ec2.Client, id string,
21902190
return nil, err
21912191
}
21922192

2193+
func waitTransitGatewayDeleted(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.TransitGateway, error) {
2194+
stateConf := &retry.StateChangeConf{
2195+
Pending: enum.Slice(awstypes.TransitGatewayStateAvailable, awstypes.TransitGatewayStateDeleting),
2196+
Target: []string{},
2197+
Refresh: statusTransitGateway(ctx, conn, id),
2198+
Timeout: timeout,
2199+
Delay: 2 * time.Minute,
2200+
MinTimeout: 10 * time.Second,
2201+
NotFoundChecks: 1,
2202+
}
2203+
2204+
outputRaw, err := stateConf.WaitForStateContext(ctx)
2205+
2206+
if output, ok := outputRaw.(*awstypes.TransitGateway); ok {
2207+
return output, err
2208+
}
2209+
2210+
return nil, err
2211+
}
2212+
21932213
func waitTransitGatewayMulticastDomainCreated(ctx context.Context, conn *ec2.Client, id string, timeout time.Duration) (*awstypes.TransitGatewayMulticastDomain, error) {
21942214
stateConf := &retry.StateChangeConf{
21952215
Pending: enum.Slice(awstypes.TransitGatewayMulticastDomainStatePending),

0 commit comments

Comments
 (0)