Created
June 6, 2021 03:52
-
-
Save yogesh174/4d0b4cdefc573acb95c5a9452c9051c0 to your computer and use it in GitHub Desktop.
Multi-cloud K8s cluster with Terraform and Ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################## | |
######## 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