【问题标题】:How to destroy the additional tgw route table created by terraform transit-gateway module如何销毁由 terraform transit-gateway 模块创建的附加 tgw 路由表
【发布时间】:2021-06-15 10:45:35
【问题描述】:

我已经使用官方中转网关模块创建了 tgw,并且我正在使用默认路由表,我还看到该模块创建了一个额外的路由表,我无法通过 tf 代码将其删除。

module "transit-gateway" {
  source          = "terraform-aws-modules/transit-gateway/aws"
  version         = "1.4.0"
  name            = var.tgw
  amazon_side_asn = 64532

  enable_auto_accept_shared_attachments = true
  vpc_attachments = {
    vpc = {
      vpc_id                                          = module.vpc.vpc_id
      subnet_ids                                      = [module.vpc.private_subnets[0]]
      dns_support                                     = true
      ipv6_support                                    = false
      transit_gateway_default_route_table_association = true
      transit_gateway_default_route_table_propagation = true
    }
  }

  ram_allow_external_principals = true
  ram_principals                = [123456789, 0987654321]

  tags = {
    Environment = "${var.env}"
    Automated   = "Terraform"
    Owner       = "${var.owner}"
    Project     = "${var.project}"
  }
}

【问题讨论】:

  • 这个问题是怎么解决的?您找到比我提供的更好的解决方案了吗?

标签: amazon-web-services terraform terraform-provider-aws terraform0.12+ terraform-modules


【解决方案1】:

如果您查看模块的源代码here,禁用aws_ec2_transit_gateway_route_table 路由表创建的唯一方法是将create_tgw 设置为false

如果您这样做,您将禁用整个 TGW。所以你的问题的答案是你不能在不删除整个 TGW 的情况下删除它们。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-30
    • 2019-03-19
    • 2021-12-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-14
    • 1970-01-01
    相关资源
    最近更新 更多