I need some help with setting Advanced Networking for azurerm_kubernetes_cluster
I've been using code from this page as an example https://www.terraform.io/docs/providers/azurerm/r/kubernetes_cluster.html
The only difference is that I make a module from it for my purpose. All there rest is pretty the same
Problem is with
network_profile {
network_plugin = "azure"
}
After run terraform plan I received the error below:
Error: module.aks.azurerm_kubernetes_cluster.aks: : invalid or unknown key: network_profile
I will be glad for any help thx
ask.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"
}
}
Update:
Terraform v0.11.8
+ provider.azurerm v1.5.0 <---- Wrong version, should be v1.15.0
Check your main.tf, if you have fixed the provider version, you need to take it out (see below) and test again.
provider "azurerm" {
#version = "=1.5.0"
}
currently it should be 1.20.0