constructor()

in lib/vpcRouteTableTransitRoute.ts [28:54]


  constructor(scope: core.Construct, id: string, props: VpcRouteTableTransitRouteProps) {
    super(scope, id);
    
    const transitGatewayIDSecretValue = sm.Secret.fromSecretArn(scope, 'ImportedSecret', props.transitGatewayIdSecretArn).secretValue;

    const privateSubnetSelection = { subnetType: ec2.SubnetType.PRIVATE };
    //const isolatedSubnetSelection = { subnetType: ec2.SubnetType.ISOLATED };
    const publicSubnetSelection = { subnetType: ec2.SubnetType.PUBLIC };
    const privateSubnets = props.targetVpc.selectSubnets(privateSubnetSelection);
    //const isolatedSubnets = props.targetVpc.selectSubnets(isolatedSubnetSelection);
    const publicSubnets = props.targetVpc.selectSubnets(publicSubnetSelection);
    
    this.populateRouteTableHash(privateSubnets);
    //this.populateRouteTableHash(isolatedSubnets);
    this.populateRouteTableHash(publicSubnets);
    
    var routeCounter = 0;
    for (let routeTableId in this.routeTableHash){
      const route = new ec2.CfnRoute(this, `${routeCounter}TransitGatewayRouteForRouteTable`, {
        routeTableId: routeTableId,
        destinationCidrBlock: props.destinationCidr,
        transitGatewayId: core.Token.asString(transitGatewayIDSecretValue)
      });
      routeCounter++;
    }
    
  }