Initial put
This commit is contained in:
parent
107a79c353
commit
7a5a0062e4
58
quickstart/101-aks-extended-zones/main.tf
Normal file
58
quickstart/101-aks-extended-zones/main.tf
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
resource "random_pet" "rg_name" {
|
||||||
|
prefix = var.resource_group_name_prefix
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_resource_group" "rg" {
|
||||||
|
location = var.resource_group_location
|
||||||
|
name = random_pet.rg_name.id
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_pet" "azurerm_kubernetes_cluster_name" {
|
||||||
|
prefix = "cluster"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "random_pet" "azurerm_kubernetes_cluster_dns_prefix" {
|
||||||
|
prefix = "dns"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_virtual_network" "vnet" {
|
||||||
|
name = var.virtual_network_name
|
||||||
|
address_space = ["10.0.0.0/16"]
|
||||||
|
location = azurerm_resource_group.rg.location
|
||||||
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
|
|
||||||
|
subnet {
|
||||||
|
name = "subnet1"
|
||||||
|
address_prefix = "10.1.1.0/24"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_kubernetes_cluster" "aks" {
|
||||||
|
name = random_pet.azurerm_kubernetes_cluster_name.id
|
||||||
|
location = azurerm_resource_group.rg.location
|
||||||
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
|
dns_prefix = random_pet.azurerm_kubernetes_cluster_dns_prefix.id
|
||||||
|
|
||||||
|
identity {
|
||||||
|
type = "SystemAssigned"
|
||||||
|
}
|
||||||
|
|
||||||
|
default_node_pool {
|
||||||
|
name = "agentpool"
|
||||||
|
vm_size = "Standard_D2_v2"
|
||||||
|
node_count = var.aks_node_count
|
||||||
|
vnet_subnet_id = element(tolist(azurerm_virtual_network.vnet.subnet), 0).id
|
||||||
|
}
|
||||||
|
|
||||||
|
windows_profile {
|
||||||
|
admin_username = var.admin_username
|
||||||
|
admin_password = var.admin_password
|
||||||
|
}
|
||||||
|
|
||||||
|
network_profile {
|
||||||
|
network_plugin = "azure"
|
||||||
|
load_balancer_sku = "standard"
|
||||||
|
}
|
||||||
|
|
||||||
|
edge_zone = var.aks_extended_zone
|
||||||
|
}
|
11
quickstart/101-aks-extended-zones/outputs.tf
Normal file
11
quickstart/101-aks-extended-zones/outputs.tf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
output "resource_group_name" {
|
||||||
|
value = azurerm_resource_group.rg.name
|
||||||
|
}
|
||||||
|
|
||||||
|
output "aks_cluster_name" {
|
||||||
|
value = azurerm_kubernetes_cluster.aks.name
|
||||||
|
}
|
||||||
|
|
||||||
|
output "aks_extended_zone" {
|
||||||
|
value = azurerm_kubernetes_cluster.aks.edge_zone
|
||||||
|
}
|
16
quickstart/101-aks-extended-zones/providers.tf
Normal file
16
quickstart/101-aks-extended-zones/providers.tf
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
azurerm = {
|
||||||
|
source = "hashicorp/azurerm"
|
||||||
|
version = "~>3.0"
|
||||||
|
}
|
||||||
|
random = {
|
||||||
|
source = "hashicorp/random"
|
||||||
|
version = "~>3.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "azurerm" {
|
||||||
|
features {}
|
||||||
|
}
|
47
quickstart/101-aks-extended-zones/variables.tf
Normal file
47
quickstart/101-aks-extended-zones/variables.tf
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
variable "resource_group_location" {
|
||||||
|
type = string
|
||||||
|
default = "Central US"
|
||||||
|
description = "Location of the resource group."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "resource_group_name_prefix" {
|
||||||
|
type = string
|
||||||
|
default = "rg"
|
||||||
|
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription."
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "virtual_network_name" {
|
||||||
|
type = string
|
||||||
|
description = "Virtual network names"
|
||||||
|
default = "example-vnet"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "aks_node_count" {
|
||||||
|
type = number
|
||||||
|
description = "AKS node count"
|
||||||
|
default = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "aks_node_vm_size" {
|
||||||
|
type = string
|
||||||
|
description = "AKS node VM size"
|
||||||
|
default = "Standard_D2_v2"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "admin_username" {
|
||||||
|
type = string
|
||||||
|
description = "The admin username for the Windows node pool."
|
||||||
|
default = "azureuser"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "admin_password" {
|
||||||
|
type = string
|
||||||
|
description = "The admin password for the Windows node pool."
|
||||||
|
default = "Passw0rd1234Us!"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "aks_extended_zone" {
|
||||||
|
type = string
|
||||||
|
description = "AKS extended zone"
|
||||||
|
default = "Los Angeles"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user