terraform 创建 AKS 使用现有的应用程序网关似乎已损坏

发布于 2025-01-11 22:30:04 字数 1198 浏览 2 评论 0原文

我很确定最近有变化吗?似乎我不能再在 terraform 中使用现有的应用程序网关作为 aks 的 AGIC,

ingress_application_gateway {

      subnet_id    = var.ingress_agic_subnet == null ? null : data.azurerm_subnet.ingress_agic_subnet[0].id # existing subnet where I created App gateway
      gateway_id   = var.ingress_application_gateway_id #existing  app gateway ID
    

    }

错误消息一直显示


│ Error: Conflicting configuration arguments
│
│   with module.aks.azurerm_kubernetes_cluster.this,
│   on terraform-azurerm-lab3-aks\main.tf line 70, in resource "azurerm_kubernetes_cluster" "this":
│   70:       subnet_id    = var.ingress_agic_subnet == null ? null : data.azurerm_subnet.ingress_agic_subnet[0].id
│
│ "ingress_application_gateway.0.subnet_id": conflicts with ingress_application_gateway.0.gateway_id
╵
╷
│ Error: Conflicting configuration arguments
│
│   with module.aks.azurerm_kubernetes_cluster.this,
│   on terraform-azurerm-lab3-aks\main.tf line 73, in resource "azurerm_kubernetes_cluster" "this":
│   73:       gateway_id   = var.ingress_application_gateway_id
│
│ "ingress_application_gateway.0.gateway_id": conflicts with ingress_application_gateway.0.subnet_id

I'm pretty sure there's a recent change? seems I can't use existing app gateway as AGIC for aks anymore in terraform

ingress_application_gateway {

      subnet_id    = var.ingress_agic_subnet == null ? null : data.azurerm_subnet.ingress_agic_subnet[0].id # existing subnet where I created App gateway
      gateway_id   = var.ingress_application_gateway_id #existing  app gateway ID
    

    }

the error message keeps saying


│ Error: Conflicting configuration arguments
│
│   with module.aks.azurerm_kubernetes_cluster.this,
│   on terraform-azurerm-lab3-aks\main.tf line 70, in resource "azurerm_kubernetes_cluster" "this":
│   70:       subnet_id    = var.ingress_agic_subnet == null ? null : data.azurerm_subnet.ingress_agic_subnet[0].id
│
│ "ingress_application_gateway.0.subnet_id": conflicts with ingress_application_gateway.0.gateway_id
╵
╷
│ Error: Conflicting configuration arguments
│
│   with module.aks.azurerm_kubernetes_cluster.this,
│   on terraform-azurerm-lab3-aks\main.tf line 73, in resource "azurerm_kubernetes_cluster" "this":
│   73:       gateway_id   = var.ingress_application_gateway_id
│
│ "ingress_application_gateway.0.gateway_id": conflicts with ingress_application_gateway.0.subnet_id

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只有影子陪我不离不弃 2025-01-18 22:30:04

感谢您stephybun在 GitHub 讨论中提出的建议与同一问题相关。将此作为答案发布以帮助其他社区成员。

AKS API 将根据
提供的subnet_id 或subnet_cidr,或者您可以BYO 应用程序网关。
因此,无法同时指定subnet_id和gateway_id
因为这会触发 API 中的冲突行为。自从你
已经有一个现有的应用程序网关,这是您唯一的财产
需要设置的是gateway_id。

参考:https://github.com/hashicorp/ terraform-provider-azurerm/issues/15693

即使您也可以遵循此Microsoft 文档 提到了相同的启用 AGIC现有 AKS 集群中的附加组件,您只需要 gateway_id

Thank You stephybun for your suggestion over the GitHub Disccusion related to same issue. Posting this as an asnwer to help other community member as well.

The AKS API will create an Application Gateway for you based on the
subnet_id or subnet_cidr provided, or you can BYO Application Gateway.
As a result it isn't possible to specify both subnet_id and gateway_id
since that would trigger conflicting behaviours in the API. Since you
already have an existing Application Gateway the only property you
need to set is the gateway_id.

Reference : https://github.com/hashicorp/terraform-provider-azurerm/issues/15693

Even you can follow this Microsoft Documennt which mention the same Enable the AGIC add-on in existing AKS cluster you only require gateway_id

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文