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

Support for TGW Attachment Peering resources #996

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading