如何使用 Terraform 设置“nginx.ingress.kubernetes.io/server-snippet”注释?

问题描述 投票:0回答:1

我想使用 Terraform 设置以下注释

nginx.ingress.kubernetes.io/server-snippet: |-
  location ~* /admin {
    allow xxx.xxx.xxx.xxx;
    deny all;
}

只要是像下面提到的字符串我就可以设置注释

resource "helm_release" "keycloak" {
  repository = "https://charts.bitnami.com/bitnami"
  chart      = "keycloak"
  namespace  = kubernetes_namespace.keycloak.metadata[0].name
  name       = "keycloak"

  set {
    name  = "replicaCount"
    value = 1
  }
}

但我没有看到任何关于 "nginx.ingress.kubernetes.io/server-snippet:"

的参考
nginx.ingress.kubernetes.io/server-snippet: |-
  location ~* /admin {
    allow xxx.xxx.xxx.xxx;
    deny all;
}
kubernetes terraform kubernetes-helm terraform-provider-azure helm3
1个回答
0
投票

使用 yamlencode 怎么样?这只是一个例子:

set {
  name = "server\\.resources"
  value = yamlencode({
    limits = {
      cpu    = "200m"
      memory = "50Mi"
    }
    requests = {
      cpu    = "100m"
      memory = "30Mi"
    }
  })
}
© www.soinside.com 2019 - 2024. All rights reserved.