Skip to content

Commit

Permalink
Support for TGW Attachment Peering resources (#996)
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.

Co-authored-by: Björn Häuser <[email protected]>
  • Loading branch information
alemuro and bjoernhaeuser authored Aug 2, 2023
1 parent 6ebac13 commit 529f885
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 529f885

Please sign in to comment.