Merge pull request #330 from TomArcherMsft/UserStory281914
User Story 281914
This commit is contained in:
commit
6065e8c1a2
19
quickstart/101-aks-standard-lb-and-vmss/README.md
Normal file
19
quickstart/101-aks-standard-lb-and-vmss/README.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Aure Kubernetes Service (AKS) with standard load balancer and Virtual Machine Scale Sets (VMSS)
|
||||||
|
|
||||||
|
This template deploys an AKS cluster a standard load balancer and Virtual Machine Scale Sets (VMSS)
|
||||||
|
|
||||||
|
## Terraform resource types
|
||||||
|
|
||||||
|
- [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet)
|
||||||
|
- [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group)
|
||||||
|
- [random_string](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string)
|
||||||
|
- [azurerm_kubernetes_cluster](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster)
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
|
||||||
|
| Name | Description | Default |
|
||||||
|
|-|-|-|
|
||||||
|
| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg |
|
||||||
|
| `resource_group_location` | Location of the resource group. | eastus |
|
||||||
|
|
||||||
|
## Example
|
43
quickstart/101-aks-standard-lb-and-vmss/main.tf
Normal file
43
quickstart/101-aks-standard-lb-and-vmss/main.tf
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
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_string" "aks_cluster_name" {
|
||||||
|
length = 12
|
||||||
|
special = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_kubernetes_cluster" "aks_cluster" {
|
||||||
|
name = random_string.aks_cluster_name.result
|
||||||
|
location = azurerm_resource_group.rg.location
|
||||||
|
resource_group_name = azurerm_resource_group.rg.name
|
||||||
|
dns_prefix = "myakscluster"
|
||||||
|
|
||||||
|
default_node_pool {
|
||||||
|
type = "VirtualMachineScaleSets"
|
||||||
|
name = "default"
|
||||||
|
node_count = 1
|
||||||
|
max_count = 3
|
||||||
|
min_count = 1
|
||||||
|
vm_size = "Standard_DS2_v2"
|
||||||
|
enable_auto_scaling = true
|
||||||
|
}
|
||||||
|
|
||||||
|
network_profile {
|
||||||
|
network_plugin = "azure"
|
||||||
|
load_balancer_sku = "standard"
|
||||||
|
}
|
||||||
|
|
||||||
|
identity {
|
||||||
|
type = "SystemAssigned"
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = {
|
||||||
|
Environment = "Production"
|
||||||
|
}
|
||||||
|
}
|
7
quickstart/101-aks-standard-lb-and-vmss/outputs.tf
Normal file
7
quickstart/101-aks-standard-lb-and-vmss/outputs.tf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
output "resource_group_name" {
|
||||||
|
value = azurerm_resource_group.rg.name
|
||||||
|
}
|
||||||
|
|
||||||
|
output "aks_cluster_name" {
|
||||||
|
value = azurerm_kubernetes_cluster.aks_cluster.name
|
||||||
|
}
|
16
quickstart/101-aks-standard-lb-and-vmss/providers.tf
Normal file
16
quickstart/101-aks-standard-lb-and-vmss/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 {}
|
||||||
|
}
|
11
quickstart/101-aks-standard-lb-and-vmss/variables.tf
Normal file
11
quickstart/101-aks-standard-lb-and-vmss/variables.tf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
variable "resource_group_location" {
|
||||||
|
type = string
|
||||||
|
default = "eastus"
|
||||||
|
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."
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user