From 24b7f31c55d3dbae41e9a31e38bf9156abd5d0de Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Mon, 8 Jul 2024 21:20:46 -0700 Subject: [PATCH] Rename Azure cluster region variable to location * Rename the region variable to location to align with Azure platform conventions, where resources are created within an Azure location, which are themselves part of broader geographical regions --- CHANGES.md | 3 +++ azure/fedora-coreos/kubernetes/controllers.tf | 4 ++-- azure/fedora-coreos/kubernetes/lb.tf | 8 ++++---- azure/fedora-coreos/kubernetes/network.tf | 2 +- azure/fedora-coreos/kubernetes/outputs.tf | 2 +- azure/fedora-coreos/kubernetes/variables.tf | 4 ++-- azure/fedora-coreos/kubernetes/workers.tf | 2 +- azure/fedora-coreos/kubernetes/workers/variables.tf | 4 ++-- azure/fedora-coreos/kubernetes/workers/workers.tf | 4 ++-- azure/flatcar-linux/kubernetes/controllers.tf | 4 ++-- azure/flatcar-linux/kubernetes/lb.tf | 8 ++++---- azure/flatcar-linux/kubernetes/network.tf | 2 +- azure/flatcar-linux/kubernetes/outputs.tf | 2 +- azure/flatcar-linux/kubernetes/variables.tf | 4 ++-- azure/flatcar-linux/kubernetes/workers.tf | 2 +- azure/flatcar-linux/kubernetes/workers/variables.tf | 4 ++-- azure/flatcar-linux/kubernetes/workers/workers.tf | 4 ++-- docs/advanced/arm64.md | 3 +-- docs/advanced/worker-pools.md | 4 ++-- docs/fedora-coreos/azure.md | 6 +++--- docs/flatcar-linux/azure.md | 6 +++--- 21 files changed, 42 insertions(+), 40 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 45efc341..85f55597 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Notable changes between versions. ### Azure +* Rename `region` variable to `location` to align with Azure platform conventions * Configure the virtual network and subnets with IPv6 private address space * Change `host_cidr` variable (string) to a `network_cidr` object with `ipv4` and `ipv6` fields that list CIDR strings. Leave the variable unset to use the defaults. (**breaking**) * Add support for dual-stack Kubernetes Ingress Load Balancing @@ -21,6 +22,8 @@ Notable changes between versions. ```diff module "cluster" { ... +- region = "centralus" ++ location = "centralus" # optional - host_cidr = "10.0.0.0/16" + network_cidr = { diff --git a/azure/fedora-coreos/kubernetes/controllers.tf b/azure/fedora-coreos/kubernetes/controllers.tf index 346d6584..7ee07f6f 100644 --- a/azure/fedora-coreos/kubernetes/controllers.tf +++ b/azure/fedora-coreos/kubernetes/controllers.tf @@ -26,7 +26,7 @@ resource "azurerm_dns_a_record" "etcds" { resource "azurerm_availability_set" "controllers" { name = "${var.cluster_name}-controllers" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location platform_fault_domain_count = 2 platform_update_domain_count = 4 managed = true @@ -38,7 +38,7 @@ resource "azurerm_linux_virtual_machine" "controllers" { name = "${var.cluster_name}-controller-${count.index}" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location availability_set_id = azurerm_availability_set.controllers.id size = var.controller_type diff --git a/azure/fedora-coreos/kubernetes/lb.tf b/azure/fedora-coreos/kubernetes/lb.tf index e9a7223f..5abd92b9 100644 --- a/azure/fedora-coreos/kubernetes/lb.tf +++ b/azure/fedora-coreos/kubernetes/lb.tf @@ -17,7 +17,7 @@ resource "azurerm_dns_a_record" "apiserver" { resource "azurerm_public_ip" "apiserver-ipv4" { name = "${var.cluster_name}-apiserver-ipv4" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location sku = "Standard" allocation_method = "Static" } @@ -26,7 +26,7 @@ resource "azurerm_public_ip" "apiserver-ipv4" { resource "azurerm_public_ip" "ingress-ipv4" { name = "${var.cluster_name}-ingress-ipv4" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location ip_version = "IPv4" sku = "Standard" allocation_method = "Static" @@ -36,7 +36,7 @@ resource "azurerm_public_ip" "ingress-ipv4" { resource "azurerm_public_ip" "ingress-ipv6" { name = "${var.cluster_name}-ingress-ipv6" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location ip_version = "IPv6" sku = "Standard" allocation_method = "Static" @@ -46,7 +46,7 @@ resource "azurerm_public_ip" "ingress-ipv6" { resource "azurerm_lb" "cluster" { name = var.cluster_name resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location sku = "Standard" frontend_ip_configuration { diff --git a/azure/fedora-coreos/kubernetes/network.tf b/azure/fedora-coreos/kubernetes/network.tf index 1f1599fd..b2dce8d0 100644 --- a/azure/fedora-coreos/kubernetes/network.tf +++ b/azure/fedora-coreos/kubernetes/network.tf @@ -19,7 +19,7 @@ locals { # Organize cluster into a resource group resource "azurerm_resource_group" "cluster" { name = var.cluster_name - location = var.region + location = var.location } resource "azurerm_virtual_network" "network" { diff --git a/azure/fedora-coreos/kubernetes/outputs.tf b/azure/fedora-coreos/kubernetes/outputs.tf index 8b6f4897..0182bd56 100644 --- a/azure/fedora-coreos/kubernetes/outputs.tf +++ b/azure/fedora-coreos/kubernetes/outputs.tf @@ -17,7 +17,7 @@ output "ingress_static_ipv6" { # Outputs for worker pools -output "region" { +output "location" { value = azurerm_resource_group.cluster.location } diff --git a/azure/fedora-coreos/kubernetes/variables.tf b/azure/fedora-coreos/kubernetes/variables.tf index a36af4b8..a8dd877b 100644 --- a/azure/fedora-coreos/kubernetes/variables.tf +++ b/azure/fedora-coreos/kubernetes/variables.tf @@ -5,9 +5,9 @@ variable "cluster_name" { # Azure -variable "region" { +variable "location" { type = string - description = "Azure Region (e.g. centralus , see `az account list-locations --output table`)" + description = "Azure location (e.g. centralus , see `az account list-locations --output table`)" } variable "dns_zone" { diff --git a/azure/fedora-coreos/kubernetes/workers.tf b/azure/fedora-coreos/kubernetes/workers.tf index 9427fcd4..641ad226 100644 --- a/azure/fedora-coreos/kubernetes/workers.tf +++ b/azure/fedora-coreos/kubernetes/workers.tf @@ -4,7 +4,7 @@ module "workers" { # Azure resource_group_name = azurerm_resource_group.cluster.name - region = azurerm_resource_group.cluster.location + location = azurerm_resource_group.cluster.location subnet_id = azurerm_subnet.worker.id security_group_id = azurerm_network_security_group.worker.id backend_address_pool_ids = local.backend_address_pool_ids diff --git a/azure/fedora-coreos/kubernetes/workers/variables.tf b/azure/fedora-coreos/kubernetes/workers/variables.tf index 8144fb74..f009a8c8 100644 --- a/azure/fedora-coreos/kubernetes/workers/variables.tf +++ b/azure/fedora-coreos/kubernetes/workers/variables.tf @@ -5,9 +5,9 @@ variable "name" { # Azure -variable "region" { +variable "location" { type = string - description = "Must be set to the Azure Region of cluster" + description = "Must be set to the Azure location of cluster" } variable "resource_group_name" { diff --git a/azure/fedora-coreos/kubernetes/workers/workers.tf b/azure/fedora-coreos/kubernetes/workers/workers.tf index 9efe78f3..ae20c4ff 100644 --- a/azure/fedora-coreos/kubernetes/workers/workers.tf +++ b/azure/fedora-coreos/kubernetes/workers/workers.tf @@ -6,7 +6,7 @@ locals { resource "azurerm_linux_virtual_machine_scale_set" "workers" { name = "${var.name}-worker" resource_group_name = var.resource_group_name - location = var.region + location = var.location sku = var.vm_type instances = var.worker_count # instance name prefix for instances in the set @@ -70,7 +70,7 @@ resource "azurerm_linux_virtual_machine_scale_set" "workers" { resource "azurerm_monitor_autoscale_setting" "workers" { name = "${var.name}-maintain-desired" resource_group_name = var.resource_group_name - location = var.region + location = var.location # autoscale enabled = true target_resource_id = azurerm_linux_virtual_machine_scale_set.workers.id diff --git a/azure/flatcar-linux/kubernetes/controllers.tf b/azure/flatcar-linux/kubernetes/controllers.tf index e69b75a2..31ffd863 100644 --- a/azure/flatcar-linux/kubernetes/controllers.tf +++ b/azure/flatcar-linux/kubernetes/controllers.tf @@ -32,7 +32,7 @@ resource "azurerm_dns_a_record" "etcds" { resource "azurerm_availability_set" "controllers" { name = "${var.cluster_name}-controllers" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location platform_fault_domain_count = 2 platform_update_domain_count = 4 managed = true @@ -44,7 +44,7 @@ resource "azurerm_linux_virtual_machine" "controllers" { name = "${var.cluster_name}-controller-${count.index}" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location availability_set_id = azurerm_availability_set.controllers.id size = var.controller_type diff --git a/azure/flatcar-linux/kubernetes/lb.tf b/azure/flatcar-linux/kubernetes/lb.tf index 04fc832e..b3d6bc0c 100644 --- a/azure/flatcar-linux/kubernetes/lb.tf +++ b/azure/flatcar-linux/kubernetes/lb.tf @@ -17,7 +17,7 @@ resource "azurerm_dns_a_record" "apiserver" { resource "azurerm_public_ip" "apiserver-ipv4" { name = "${var.cluster_name}-apiserver-ipv4" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location sku = "Standard" allocation_method = "Static" } @@ -26,7 +26,7 @@ resource "azurerm_public_ip" "apiserver-ipv4" { resource "azurerm_public_ip" "ingress-ipv4" { name = "${var.cluster_name}-ingress-ipv4" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location ip_version = "IPv4" sku = "Standard" allocation_method = "Static" @@ -36,7 +36,7 @@ resource "azurerm_public_ip" "ingress-ipv4" { resource "azurerm_public_ip" "ingress-ipv6" { name = "${var.cluster_name}-ingress-ipv6" resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location ip_version = "IPv6" sku = "Standard" allocation_method = "Static" @@ -46,7 +46,7 @@ resource "azurerm_public_ip" "ingress-ipv6" { resource "azurerm_lb" "cluster" { name = var.cluster_name resource_group_name = azurerm_resource_group.cluster.name - location = var.region + location = var.location sku = "Standard" frontend_ip_configuration { diff --git a/azure/flatcar-linux/kubernetes/network.tf b/azure/flatcar-linux/kubernetes/network.tf index 19118bec..5b690c0f 100644 --- a/azure/flatcar-linux/kubernetes/network.tf +++ b/azure/flatcar-linux/kubernetes/network.tf @@ -19,7 +19,7 @@ locals { # Organize cluster into a resource group resource "azurerm_resource_group" "cluster" { name = var.cluster_name - location = var.region + location = var.location } resource "azurerm_virtual_network" "network" { diff --git a/azure/flatcar-linux/kubernetes/outputs.tf b/azure/flatcar-linux/kubernetes/outputs.tf index 8b6f4897..0182bd56 100644 --- a/azure/flatcar-linux/kubernetes/outputs.tf +++ b/azure/flatcar-linux/kubernetes/outputs.tf @@ -17,7 +17,7 @@ output "ingress_static_ipv6" { # Outputs for worker pools -output "region" { +output "location" { value = azurerm_resource_group.cluster.location } diff --git a/azure/flatcar-linux/kubernetes/variables.tf b/azure/flatcar-linux/kubernetes/variables.tf index 476853ab..57a4e3d3 100644 --- a/azure/flatcar-linux/kubernetes/variables.tf +++ b/azure/flatcar-linux/kubernetes/variables.tf @@ -5,9 +5,9 @@ variable "cluster_name" { # Azure -variable "region" { +variable "location" { type = string - description = "Azure Region (e.g. centralus , see `az account list-locations --output table`)" + description = "Azure location (e.g. centralus , see `az account list-locations --output table`)" } variable "dns_zone" { diff --git a/azure/flatcar-linux/kubernetes/workers.tf b/azure/flatcar-linux/kubernetes/workers.tf index 3b212128..cd60d447 100644 --- a/azure/flatcar-linux/kubernetes/workers.tf +++ b/azure/flatcar-linux/kubernetes/workers.tf @@ -4,7 +4,7 @@ module "workers" { # Azure resource_group_name = azurerm_resource_group.cluster.name - region = azurerm_resource_group.cluster.location + location = azurerm_resource_group.cluster.location subnet_id = azurerm_subnet.worker.id security_group_id = azurerm_network_security_group.worker.id backend_address_pool_ids = local.backend_address_pool_ids diff --git a/azure/flatcar-linux/kubernetes/workers/variables.tf b/azure/flatcar-linux/kubernetes/workers/variables.tf index 458b1e8f..6fc2fab8 100644 --- a/azure/flatcar-linux/kubernetes/workers/variables.tf +++ b/azure/flatcar-linux/kubernetes/workers/variables.tf @@ -5,9 +5,9 @@ variable "name" { # Azure -variable "region" { +variable "location" { type = string - description = "Must be set to the Azure Region of cluster" + description = "Must be set to the Azure location of cluster" } variable "resource_group_name" { diff --git a/azure/flatcar-linux/kubernetes/workers/workers.tf b/azure/flatcar-linux/kubernetes/workers/workers.tf index da9994b2..fbd109fc 100644 --- a/azure/flatcar-linux/kubernetes/workers/workers.tf +++ b/azure/flatcar-linux/kubernetes/workers/workers.tf @@ -11,7 +11,7 @@ locals { resource "azurerm_linux_virtual_machine_scale_set" "workers" { name = "${var.name}-worker" resource_group_name = var.resource_group_name - location = var.region + location = var.location sku = var.vm_type instances = var.worker_count # instance name prefix for instances in the set @@ -91,7 +91,7 @@ resource "azurerm_linux_virtual_machine_scale_set" "workers" { resource "azurerm_monitor_autoscale_setting" "workers" { name = "${var.name}-maintain-desired" resource_group_name = var.resource_group_name - location = var.region + location = var.location # autoscale enabled = true target_resource_id = azurerm_linux_virtual_machine_scale_set.workers.id diff --git a/docs/advanced/arm64.md b/docs/advanced/arm64.md index 9cfcb715..c859d77b 100644 --- a/docs/advanced/arm64.md +++ b/docs/advanced/arm64.md @@ -190,7 +190,7 @@ module "ramius" { # Azure cluster_name = "ramius" - region = "centralus" + location = "centralus" dns_zone = "azure.example.com" dns_zone_group = "example-group" @@ -202,6 +202,5 @@ module "ramius" { controller_type = "Standard_D2pls_v5" worker_type = "Standard_D2pls_v5" worker_count = 2 - host_cidr = "10.0.0.0/20" } ``` diff --git a/docs/advanced/worker-pools.md b/docs/advanced/worker-pools.md index c1eb57d9..f03aebfb 100644 --- a/docs/advanced/worker-pools.md +++ b/docs/advanced/worker-pools.md @@ -114,7 +114,7 @@ Create a cluster following the Azure [tutorial](../flatcar-linux/azure.md#cluste source = "git::https://github.com/poseidon/typhoon//azure/fedora-coreos/kubernetes/workers?ref=v1.30.2" # Azure - region = module.ramius.region + location = module.ramius.location resource_group_name = module.ramius.resource_group_name subnet_id = module.ramius.subnet_id security_group_id = module.ramius.security_group_id @@ -140,7 +140,7 @@ Create a cluster following the Azure [tutorial](../flatcar-linux/azure.md#cluste source = "git::https://github.com/poseidon/typhoon//azure/flatcar-linux/kubernetes/workers?ref=v1.30.2" # Azure - region = module.ramius.region + location = module.ramius.location resource_group_name = module.ramius.resource_group_name subnet_id = module.ramius.subnet_id security_group_id = module.ramius.security_group_id diff --git a/docs/fedora-coreos/azure.md b/docs/fedora-coreos/azure.md index 9cdae709..089f03dd 100644 --- a/docs/fedora-coreos/azure.md +++ b/docs/fedora-coreos/azure.md @@ -90,7 +90,7 @@ module "ramius" { # Azure cluster_name = "ramius" - region = "centralus" + location = "centralus" dns_zone = "azure.example.com" dns_zone_group = "example-group" @@ -199,14 +199,14 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/azure/f | Name | Description | Example | |:-----|:------------|:--------| | cluster_name | Unique cluster name (prepended to dns_zone) | "ramius" | -| region | Azure region | "centralus" | +| location | Azure location | "centralus" | | dns_zone | Azure DNS zone | "azure.example.com" | | dns_zone_group | Resource group where the Azure DNS zone resides | "global" | | os_image | Fedora CoreOS image for instances | "/subscriptions/..../custom-image" | | ssh_authorized_key | SSH public key for user 'core' | "ssh-ed25519 AAAAB3NZ..." | !!! tip - Regions are shown in [docs](https://azure.microsoft.com/en-us/global-infrastructure/regions/) or with `az account list-locations --output table`. + Locations are shown in [docs](https://azure.microsoft.com/en-us/global-infrastructure/regions/) or with `az account list-locations --output table`. #### DNS Zone diff --git a/docs/flatcar-linux/azure.md b/docs/flatcar-linux/azure.md index 8a7d4fa3..c97169a4 100644 --- a/docs/flatcar-linux/azure.md +++ b/docs/flatcar-linux/azure.md @@ -79,7 +79,7 @@ module "ramius" { # Azure cluster_name = "ramius" - region = "centralus" + location = "centralus" dns_zone = "azure.example.com" dns_zone_group = "example-group" @@ -187,13 +187,13 @@ Check the [variables.tf](https://github.com/poseidon/typhoon/blob/master/azure/f | Name | Description | Example | |:-----|:------------|:--------| | cluster_name | Unique cluster name (prepended to dns_zone) | "ramius" | -| region | Azure region | "centralus" | +| location | Azure location | "centralus" | | dns_zone | Azure DNS zone | "azure.example.com" | | dns_zone_group | Resource group where the Azure DNS zone resides | "global" | | ssh_authorized_key | SSH public key for user 'core' | "ssh-rsa AAAAB3NZ..." | !!! tip - Regions are shown in [docs](https://azure.microsoft.com/en-us/global-infrastructure/regions/) or with `az account list-locations --output table`. + Locations are shown in [docs](https://azure.microsoft.com/en-us/global-infrastructure/regions/) or with `az account list-locations --output table`. #### DNS Zone