How to avoid circular dependency between transit gateway and route table?

0

In Cloudformation template I have an option to define AssociationDefaultRouteTableId and PropagationDefaultRouteTableId for TransitGateway.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgateway.html

Type: AWS::EC2::TransitGateway
Properties: 
  ...
  AssociationDefaultRouteTableId: String
  ...
  PropagationDefaultRouteTableId: String

But TransitGatewayRouteTable has mandatory parameter TransitGatewayId and this causes a circular dependency between route table and transit gateway :-(

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-transitgatewayroutetable.html

Type: AWS::EC2::TransitGatewayRouteTable
Properties: 
  ...
  TransitGatewayId: String

Is there a way to get around this somehow and actually set AssociationDefaultRouteTableId and PropagationDefaultRouteTableId for transit gateway from Cloudformation template ?

1개 답변
1
수락된 답변

I don't think you'll be able to do this how you are trying as the circular dependency will always be there.

One way that you may be able to achieve the same outcome is by using a custom lambda resource to modify the TGW defaults after it's created. Here is an example from github: https://github.com/alexandrespbr/vpcsharednfw/blob/3aad9e78c08610b2e3602364158f78867338db39/egressVpc.yaml#L475

AWS
답변함 2년 전
profile picture
전문가
Kallu
검토됨 6달 전
  • Thanks! This is my thinking as well. The only thing it doesn't explain why such parameters were made available for TransitGateway resource type you can not possibly use. Looks like a bug and missing feature (that ability to set route table id's).

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠