mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-25 19:59:34 +01:00
7b0ea23cdc
* Add support for `terraform-provider-azurerm` v2.0+. Require `terraform-provider-azurerm` v2.0+ and drop v1.x support since the Azure provider major release is not backwards compatible * Use Azure's new Linux VM and Linux VM Scale Set resources * Change controller's Azure disk caching to None * Associate subnets (in addition to NICs) with security groups (aesthetic) * If set, change `worker_priority` from `Low` to `Spot` (action required) Related: * https://www.terraform.io/docs/providers/azurerm/guides/2.0-upgrade-guide.html
45 lines
1.5 KiB
HCL
45 lines
1.5 KiB
HCL
# Organize cluster into a resource group
|
|
resource "azurerm_resource_group" "cluster" {
|
|
name = var.cluster_name
|
|
location = var.region
|
|
}
|
|
|
|
resource "azurerm_virtual_network" "network" {
|
|
resource_group_name = azurerm_resource_group.cluster.name
|
|
|
|
name = var.cluster_name
|
|
location = azurerm_resource_group.cluster.location
|
|
address_space = [var.host_cidr]
|
|
}
|
|
|
|
# Subnets - separate subnets for controller and workers because Azure
|
|
# network security groups are based on IPv4 CIDR rather than instance
|
|
# tags like GCP or security group membership like AWS
|
|
|
|
resource "azurerm_subnet" "controller" {
|
|
resource_group_name = azurerm_resource_group.cluster.name
|
|
|
|
name = "controller"
|
|
virtual_network_name = azurerm_virtual_network.network.name
|
|
address_prefix = cidrsubnet(var.host_cidr, 1, 0)
|
|
}
|
|
|
|
resource "azurerm_subnet_network_security_group_association" "controller" {
|
|
subnet_id = azurerm_subnet.controller.id
|
|
network_security_group_id = azurerm_network_security_group.controller.id
|
|
}
|
|
|
|
resource "azurerm_subnet" "worker" {
|
|
resource_group_name = azurerm_resource_group.cluster.name
|
|
|
|
name = "worker"
|
|
virtual_network_name = azurerm_virtual_network.network.name
|
|
address_prefix = cidrsubnet(var.host_cidr, 1, 1)
|
|
}
|
|
|
|
resource "azurerm_subnet_network_security_group_association" "worker" {
|
|
subnet_id = azurerm_subnet.worker.id
|
|
network_security_group_id = azurerm_network_security_group.worker.id
|
|
}
|
|
|