'AWS CDK (.NET) Unable to create Transient Gateway Attachment

I have an existing VPC with private/public subnets (created with the CDK) and an existing Transient Gateway (created manually) that is not in pending status. I am now trying to modify my stack to create a VPC Transit Gateway Attachment but my code is not finding the Transit Gateway. Here is the code:

// create a VPC attachment to the transit gateway
var transitGatewayAttachment = new CfnTransitGatewayAttachment(this, "TransitGatewayAttachment", new CfnTransitGatewayAttachmentProps 
{ 
   VpcId = Vpc.VpcId,
   TransitGatewayId = "tgw-xxxxxx",     
   SubnetIds = Vpc.PrivateSubnets.Select(s => s.SubnetId).ToArray()
});

CDK returns the an error that the Transit Gateway does not exist. So does CloudFormation. I have double and tripple-checked the tgw id so I am buffled as to what the problem might be.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source