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

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 Jun 6, 2023
1 parent e45750a commit 2e1c2ff
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 2e1c2ff

Please sign in to comment.