Hello, i need to create a peer from 2 transit gate...
# aws
s
Hello, i need to create a peer from 2 transit gateway with pulumi:
tgw_peering = aws.ec2transitgateway.PeeringAttachment(
“tgw-peering”,
peer_region=“us-east-1",
peer_transit_gateway_id=tgw_ids[0],
transit_gateway_id=tgw_ids[1],
)
But you need to accept this peering:
peering = aws.ec2transitgateway.get_peering_attachment(filters=[{
“name”: “transit-gateway-id”,
“values”: [tgw_peering.peer_transit_gateway_id],
},{
“name”: “state”,
“values”: [“pendingAcceptance”],
}
]
)
aws.ec2transitgateway.PeeringAttachmentAccepter(“accepter”,
transit_gateway_attachment_id=peering.id,
)
in terraform you can wait the end of creation of tgw_peering before launching get_peering_attachment but in pulumi i don’t know how to do that
l
Pulumi waits for things for you, you don't need to tell it. Are you doing all this in a single project and stack? If you are, you should be able to use tgw_peeerind.id directly in the PeeringAttachmentAccepter's constructor. If you are creating one side in one project and the other side in another, then you'll need to export the attachment id from one stack and import it into the other. This means you need to check for undefined in the accepting stack's logic, as it might be run before the first stack has been upped.