Skip to content

Commit

Permalink
r/aws_ec2_carrier_gateway: Better handling of carrier gateway deletion.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Dec 7, 2020
1 parent 337c75e commit bcee37a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion aws/internal/service/ec2/waiter/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ func CarrierGatewayState(conn *ec2.EC2, carrierGatewayID string) resource.StateR
return nil, carrierGatewayStateNotFound, nil
}

return carrierGateway, aws.StringValue(carrierGateway.State), nil
state := aws.StringValue(carrierGateway.State)

if state == ec2.CarrierGatewayStateDeleted {
return nil, carrierGatewayStateNotFound, nil
}

return carrierGateway, state, nil
}
}

Expand Down
2 changes: 1 addition & 1 deletion aws/internal/service/ec2/waiter/waiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func CarrierGatewayAvailable(conn *ec2.EC2, carrierGatewayID string) (*ec2.Carri
func CarrierGatewayDeleted(conn *ec2.EC2, carrierGatewayID string) (*ec2.CarrierGateway, error) {
stateConf := &resource.StateChangeConf{
Pending: []string{ec2.CarrierGatewayStateDeleting},
Target: []string{ec2.CarrierGatewayStateDeleted},
Target: []string{},
Refresh: CarrierGatewayState(conn, carrierGatewayID),
Timeout: CarrierGatewayDeletedTimeout,
}
Expand Down

0 comments on commit bcee37a

Please sign in to comment.