Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions azure/infrastructure.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ resource "azurerm_resource_group" "group" {
location = var.location
}

# Create an availability set for the execution nodes
resource "azurerm_availability_set" "avset" {
name = "${var.cluster_name}_availability_set"
location = var.location
resource_group_name = local.resource_group_name
platform_update_domain_count = 1
platform_fault_domain_count = 1
}

# Create virtual machine
resource "azurerm_linux_virtual_machine" "instances" {
for_each = module.design.instances
Expand All @@ -60,6 +69,7 @@ resource "azurerm_linux_virtual_machine" "instances" {
location = var.location
resource_group_name = local.resource_group_name
network_interface_ids = [azurerm_network_interface.nic[each.key].id]
availability_set_id = contains(each.value["tags"], "node") ? azurerm_availability_set.avset.id : null
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just an example of how this could be done, perhaps you'd prefer an additional tag?


os_disk {
name = format("%s-%s-disk", var.cluster_name, each.key)
Expand Down