Azure 地形 "Endpoint was not set!"
Azure terraform "Endpoint was not set!"
Main.tf
provider "azurerm" {
features {}
}
data "azurestack_resource_group" "demo" {
name = "k8sample-rg-rg"
}
data "azurestack_subnet" "demo" {
name = "k8sample-rg-subnet"
virtual_network_name = "k8sample-rg-network"
resource_group_name = "k8sample-rg-rg"
}
resource "azurerm_kubernetes_cluster" "demo" {
name = "aathi-sample-aks"
location = data.azurestack_resource_group.demo.location
resource_group_name = data.azurestack_resource_group.demo.name
dns_prefix = "aathi-sample-aks"
default_node_pool {
name = "default"
node_count = 2
vm_size = "Standard_D2_v2"
type = "VirtualMachineScaleSets"
availability_zones = ["1", "2"]
enable_auto_scaling = true
min_count = 2
max_count = 4
# Required for advanced networking
vnet_subnet_id = data.azurestack_subnet.demo.id
}
identity {
type = "SystemAssigned"
}
network_profile {
network_plugin = "azure"
load_balancer_sku = "standard"
network_policy = "calico"
}
tags = {
Environment = "Development"
}
}
outputs.tf
output "client_certificate" {
value = azurerm_kubernetes_cluster.demo.kube_config.0.client_certificate
}
output "kube_config" {
value = azurerm_kubernetes_cluster.demo.kube_config_raw
}
output "resource_group_name" {
value = data.azurestack_resource_group.demo.name
}
output "resource_group_location" {
value = data.azurestack_resource_group.demo.location
}
output "subnet_id" {
value = data.azurestack_subnet.demo.id
}
之前我已经在我的 Azure 门户中创建了资源组。我需要为我的 aks 集群消耗这些资源。所以我使用了数据源方法。终端中收到了所有资源 ID,但我无法继续。我收到以下错误。
要重现的评论
- 地形初始化
- 地形规划
- 地形应用
在此之前,我们需要在AZURE中创建资源组和带子网的Vnet。
resource_group_name = "k8sample-rg-rg"
virtual_network_name = "k8sample-rg-network"
Subnet_name = "k8sample-rg-subnet"
Main.tf
provider "azurerm" {
features {}
}
data "azurestack_resource_group" "demo" {
name = "k8sample-rg-rg"
}
data "azurestack_subnet" "demo" {
name = "k8sample-rg-subnet"
virtual_network_name = "k8sample-rg-network"
resource_group_name = "k8sample-rg-rg"
}
resource "azurerm_kubernetes_cluster" "demo" {
name = "aathi-sample-aks"
location = data.azurestack_resource_group.demo.location
resource_group_name = data.azurestack_resource_group.demo.name
dns_prefix = "aathi-sample-aks"
default_node_pool {
name = "default"
node_count = 2
vm_size = "Standard_D2_v2"
type = "VirtualMachineScaleSets"
availability_zones = ["1", "2"]
enable_auto_scaling = true
min_count = 2
max_count = 4
# Required for advanced networking
vnet_subnet_id = data.azurestack_subnet.demo.id
}
identity {
type = "SystemAssigned"
}
network_profile {
network_plugin = "azure"
load_balancer_sku = "standard"
network_policy = "calico"
}
tags = {
Environment = "Development"
}
}
outputs.tf
output "client_certificate" {
value = azurerm_kubernetes_cluster.demo.kube_config.0.client_certificate
}
output "kube_config" {
value = azurerm_kubernetes_cluster.demo.kube_config_raw
}
output "resource_group_name" {
value = data.azurestack_resource_group.demo.name
}
output "resource_group_location" {
value = data.azurestack_resource_group.demo.location
}
output "subnet_id" {
value = data.azurestack_subnet.demo.id
}
之前我已经在我的 Azure 门户中创建了资源组。我需要为我的 aks 集群消耗这些资源。所以我使用了数据源方法。终端中收到了所有资源 ID,但我无法继续。我收到以下错误。
要重现的评论
- 地形初始化
- 地形规划
- 地形应用
在此之前,我们需要在AZURE中创建资源组和带子网的Vnet。
resource_group_name = "k8sample-rg-rg"
virtual_network_name = "k8sample-rg-network"
Subnet_name = "k8sample-rg-subnet"