AWS 负载均衡器转发操作粘性

时间:2021-08-01 13:48:18

标签: amazon-web-services terraform terraform-provider-aws

因此,我正在使用基于此 AWS LB Module

的模块

现在,我正在尝试在 default_action forward 上添加粘性选项。不知道为什么它不起作用。我尝试了各种改变。我最后的变化是这样的:

  dynamic "default_action" {
    for_each = contains(["authenticate-oidc", "authenticate-cognito"], lookup(var.https_listeners[count.index], "action_type", {})) ? [var.https_listeners[count.index]] : []
    content {
      type             = "forward"
      target_group_arn = aws_lb_target_group.main[lookup(default_action.value, "target_group_index", count.index)].id
      stickiness {
        enabled  = lookup(default_action.value, "stickiness", false)
        duration = lookup(default_action.value, "duration", null)
      }
    }
  }

我正在尝试通过这个:

  https_listeners = [
    {
      port            = 443
      protocol        = "HTTPS"
      certificate_arn = var.certificate_arn
      stickiness      = true
      duration        = 3600
    },
  ]

我现在正在考虑尝试使用默认粘性启用,持续时间为 3600。

对此有什么想法吗?

编辑 1:我尝试更改模块块,因为@bryan 提到我正在传递一个空地图。仅出于测试目的,我对粘性值进行了硬编码,如下所示:

  dynamic "default_action" {
    for_each = contains(["authenticate-oidc", "authenticate-cognito"], lookup(var.https_listeners[count.index], "action_type", {})) ? [var.https_listeners[count.index]] : []
    content {
      type             = "forward"
      target_group_arn = aws_lb_target_group.main[lookup(default_action.value, "target_group_index", count.index)].id
      stickiness {
        enabled  = true
        duration = 3600
      }
    }
  }

期望侦听器默认操作设置组粘性..但不知何故,它没有。我也在 AWS LB Module repo 上提出了这个问题

0 个答案:

没有答案