这里的文档:https://www.terraform.io/docs/providers/aws/r/default_route_table.html声称您可以使用私有网络id导入默认路由表。
当我尝试这样做时,我得到了以下错误:
$ terraform import 'aws_default_route_table.aws-vpc' vpc-12345678
Error: resource aws_default_route_table doesn't support import我尝试使用路由表ID本身,以防文档不准确,但我得到了相同的错误。
我成功导入了路由表所属的私有网络,再次尝试导入路由表失败。
对于上下文-我需要导入默认路由表的原因是启用VPN网关的路由传播,如下所示:
resource aws_default_route_table aws-vpc {
default_route_table_id = var.aws_default_route_table_id
route {
cidr_block = "0.0.0.0/0"
gateway_id = var.aws_internet_gateway_id
}
propagating_vgws = [
aws_vpn_gateway.aws-vpn-gw.id
]
}我是否遗漏了什么,或者是否真的不可能将现有的默认路由表导入terraform?
发布于 2020-05-15 09:58:29
我跳到导入部分太快了。在同一文档https://www.terraform.io/docs/providers/aws/r/default_route_table.html的开头有这样一个子句:
The aws_default_route_table behaves differently from normal resources, in that Terraform does not create this resource, but instead attempts to "adopt" it into management. We can do this because each VPC created has a Default Route Table that cannot be destroyed, and is created with a single route.所以,你不能导入TL;DR,但你可以尝试创建一个现有的路由表,terraform将“采用”它,效果将与导入现有资源相同。
发布于 2020-05-15 07:33:40
我觉得你的进口看起来没问题。您可能需要使用terraform-aws-provider提交错误报告。https://github.com/terraform-providers/terraform-provider-aws
https://stackoverflow.com/questions/61808942
复制相似问题