Skip to content

Instantly share code, notes, and snippets.

@yogesh174
Created June 6, 2021 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogesh174/4d0b4cdefc573acb95c5a9452c9051c0 to your computer and use it in GitHub Desktop.
Save yogesh174/4d0b4cdefc573acb95c5a9452c9051c0 to your computer and use it in GitHub Desktop.
Multi-cloud K8s cluster with Terraform and Ansible
########################################
######## Create virtual machine ########
########################################
resource "azurerm_linux_virtual_machine" "k8s_worker" {
count = var.azure_nodes
name = "azure-k8s-worker-${count.index}"
resource_group_name = azurerm_resource_group.k8s.name
location = azurerm_resource_group.k8s.location
size = var.azure_vm_size
admin_username = "adminuser"
network_interface_ids = [
azurerm_network_interface.k8s[count.index].id,
]
admin_ssh_key {
username = "adminuser"
public_key = file(var.public_key_path)
}
os_disk {
caching = "ReadWrite"
storage_account_type = "Standard_LRS"
}
source_image_reference {
publisher = "Canonical"
offer = "UbuntuServer"
sku = "16.04-LTS"
version = "latest"
}
# Created after and destroyed before master node
depends_on = [
aws_instance.k8s_master,
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment