Skip to content

Commit

Permalink
Support for TGW Attachment Peering resources
Browse files Browse the repository at this point in the history
Support for removing TGW Attachment Peering resources, as only VPC attachments
where supported before.
  • Loading branch information
alemuro committed Jul 11, 2023
1 parent 1ebde32 commit b0d033f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions resources/ec2-tgw-attachments.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ func (e *EC2TGWAttachment) Remove() error {
// as part of TGW to delete VPN attachments.
return fmt.Errorf("VPN attachment")
}

// Execute different API calls depending on the resource type.
if *e.tgwa.ResourceType == "peering" {
params := &ec2.DeleteTransitGatewayPeeringAttachmentInput{
TransitGatewayAttachmentId: e.tgwa.TransitGatewayAttachmentId,
}

_, err := e.svc.DeleteTransitGatewayPeeringAttachment(params)
if err != nil {
return err
}

return nil
}

params := &ec2.DeleteTransitGatewayVpcAttachmentInput{
TransitGatewayAttachmentId: e.tgwa.TransitGatewayAttachmentId,
}
Expand Down

0 comments on commit b0d033f

Please sign in to comment.