我有以下代码:
resource "aws_ec2_transit_gateway_route_table" "non_default" {
transit_gateway_id = "${aws_ec2_transit_gateway.tgw.id}"
}
resource "aws_ec2_transit_gateway_route_table_association" "non_default_association" {
transit_gateway_attachment_id = "${aws_vpn_connection.tgw-vpn-attachment.transit_gateway_attachment_id}"
transit_gateway_route_table_id = "${aws_ec2_transit_gateway_route_table.non_default.id}"
depends_on = ["aws_vpn_connection.tgw-vpn-attachment"]
}
# Name default route table — This is not working either.
resource "aws_default_route_table" "default" {
default_route_table_id = "${aws_ec2_transit_gateway.tgw.id}"
tags = {
Name = "HelloWorld"
}
}
我想将VPN网关附件与非默认路由表相关联。但是,当我运行上面的代码时,它将其添加到默认路由表中吗?我需要一个默认路由表,并且不想禁用它。如何获得以上结果?
此外,当我尝试向无法正常运行的默认路由表中添加名称标签时。
答案 0 :(得分:0)
您可以更改附件的默认传播路径表。确保遵循以下所有步骤。
启用传播后,路由应显示在指定的路由表中,而不是默认路由表中。
aws_ec2_transit_gateway_route_table_propagation
使指定的附件能够将路由传播到指定的传播路由表。
resource "aws_ec2_transit_gateway_route_table_association" "association" {
transit_gateway_attachment_id = "${aws_vpn_connection.tgw-vpn-attachment.transit_gateway_attachment_id}"
transit_gateway_route_table_id = "${aws_ec2_transit_gateway_route_table.non_default.id}"
}
resource "aws_ec2_transit_gateway_route_table_propagation" "propagation" {
transit_gateway_attachment_id = "${aws_vpn_connection.tgw-vpn-attachment.transit_gateway_attachment_id}"
transit_gateway_route_table_id = "${aws_ec2_transit_gateway_route_table.non_default.id}"
}