azure - Terraform azurerm_kubernetes_cluster 无效或未知 key : network_profile

标签 azure networking kubernetes terraform

我需要一些帮助来设置 azurerm_kubernetes_cluster 的高级网络

我一直使用此页面中的代码作为示例 https://www.terraform.io/docs/providers/azurerm/r/kubernetes_cluster.html

唯一的区别是我出于我的目的从中创建了一个模块。其余的都差不多

问题出在

network_profile {
    network_plugin = "azure"
  }

运行 terraform plan 后,我收到以下错误:

Error: module.aks.azurerm_kubernetes_cluster.aks: : invalid or unknown key: network_profile

我很高兴能得到任何帮助,谢谢

询问.tf

resource "azurerm_resource_group" "aks" {
  name = “name-rg”
  location = “East US”
}

resource azurerm_network_security_group "aks_nsg" {
  name                = “name-nsg"
  location            = "${azurerm_resource_group.aks.location}"
  resource_group_name = "${azurerm_resource_group.aks.name}"
}

resource "azurerm_virtual_network" "aks_vnet" {
  name                = “name-vnet"
  location            = "${azurerm_resource_group.aks.location}"
  resource_group_name = "${azurerm_resource_group.aks.name}"
  address_space       = ["10.2.0.0/16"]
}

resource "azurerm_subnet" "aks_subnet" {
  name                      = “name-subnet"
  resource_group_name       = "${azurerm_resource_group.aks.name}"
  network_security_group_id = "${azurerm_network_security_group.aks_nsg.id}"
  address_prefix            = "10.2.0.0/24"
  virtual_network_name      = "${azurerm_virtual_network.aks_vnet.name}"
}

resource "azurerm_kubernetes_cluster" "aks" {
  name                = "aks-name"
  location            = "${azurerm_resource_group.aks.location}"
  resource_group_name = "${azurerm_resource_group.aks.name}"
  dns_prefix          = “dns-name”

  linux_profile {
    admin_username = "${var.aks_admin_username}"

  ssh_key {
      key_data = "${var.aks_ssh_public_key_path}"
    }
  }

  agent_pool_profile {
    name            = "default"
    count           = "${var.aks_agent_count}"
    vm_size         = "${var.aks_vm_size}"
    os_type         = "${var.aks_os_type}"
    os_disk_size_gb = "${var.aks_os_disk_size_gb}"
    vnet_subnet_id = "${azurerm_subnet.aks_subnet.id}"
  }

  service_principal {
    client_id     = "${var.aks_client_id}"
    client_secret = "${var.aks_client_secret}"
  }

  network_profile {
    network_plugin     = "azure"
  }
}

更新:

Terraform v0.11.8
+ provider.azurerm v1.5.0          <---- Wrong version, should be v1.15.0

最佳答案

  • provider.azurerm v1.5.0 <----版本错误,应该是v1.15.0

关于azure - Terraform azurerm_kubernetes_cluster 无效或未知 key : network_profile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52534084/

相关文章:

kubernetes - 如何使用Kubernetes端点对象?

azure - Blob 存储中的空图像

asp.net-mvc - "Login failed for user ' <用户> '."在 SQL Azure 上的 MVC 5 中使用 DefaultConnection 时

ios - 如何检测iOS中的wifi网络变化

c++ - 如何以编程方式查找为 Linux 中的特定网络设备配置的 IP 地址/网络掩码/网关?

docker - 解析 dockerfile 路径 : please provide a valid path to a Dockerfile within the build context with --dockerfile 时出错

azure - docker-compose 在本地运行 Azure Functions

c# - 添加 Windows Azure 缓存会导致 Visual Studio 2012 崩溃,并出现 datacachefactory 参数 null 异常

networking - tcp reno、newreno 和慢启动

kubernetes - 无法访问 RPI 上运行的 K8 集群中的 NGINX nodePort 服务