Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 2e1c2ff

Browse files
committed
Support for TGW Attachment Peering resources
Support for removing TGW Attachment Peering resources, as only VPC attachments where supported before.
1 parent e45750a commit 2e1c2ff

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

resources/ec2-tgw-attachments.go

+15
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ func (e *EC2TGWAttachment) Remove() error {
5252
// as part of TGW to delete VPN attachments.
5353
return fmt.Errorf("VPN attachment")
5454
}
55+
56+
// Execute different API calls depending on the resource type.
57+
if *e.tgwa.ResourceType == "peering" {
58+
params := &ec2.DeleteTransitGatewayPeeringAttachmentInput{
59+
TransitGatewayAttachmentId: e.tgwa.TransitGatewayAttachmentId,
60+
}
61+
62+
_, err := e.svc.DeleteTransitGatewayPeeringAttachment(params)
63+
if err != nil {
64+
return err
65+
}
66+
67+
return nil
68+
}
69+
5570
params := &ec2.DeleteTransitGatewayVpcAttachmentInput{
5671
TransitGatewayAttachmentId: e.tgwa.TransitGatewayAttachmentId,
5772
}

0 commit comments

Comments
 (0)