【问题标题】:Terraform circular dependency between security groups安全组之间的 Terraform 循环依赖
【发布时间】:2021-06-11 05:06:27
【问题描述】:

我有一个设置:ECS 前面的 ALB。我有一个 ecs 模块和一个用于 alb: alb_sg的ALB的出口规则:

  egress {
    description     = "Traffic from ALB to ECS"
    from_port       = 80
    to_port         = 80
    protocol        = "tcp"
    security_groups = [var.ecs_sg] //comes from output from ecs stack
  } 

现在在 ECS 中,我的安全组 (ecs_sg) 有类似的东西

  ingress {
    description = "Allow ALB to ECS"
    from_port   = 80
    to_port     = 80
    protocol    = "tcp"
    security_groups = [var.alb_sg] //comes from output from alb stack
  }

现在我有一些错误:

│ Error: Cycle: module.ecs.var.alb_sg (expand), module.ecs.aws_security_group.ecs_sg, module.ecs.output.ecs_sg (expand), module.alb.var.ecs_sg (expand), module.alb.aws_security_group.alb_sg, module.alb.output.alb_sg (expand)

如何解决?谢谢

【问题讨论】:

    标签: terraform amazon-ecs aws-application-load-balancer


    【解决方案1】:

    解决方案是分别创建 SG 和 SG 规则。您可以使用 aws_security_group_rule 资源定义 SG 规则。

    【讨论】:

      猜你喜欢
      • 2020-02-24
      • 2021-03-02
      • 2018-09-19
      • 1970-01-01
      • 2019-02-04
      • 2014-11-10
      • 2021-04-23
      • 1970-01-01
      相关资源
      最近更新 更多