Created
November 9, 2020 23:53
-
-
Save jesseloudon/57f6bf82e21688291d2fd4f136a0d941 to your computer and use it in GitHub Desktop.
ansible on azure part 2
This file contains hidden or 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
variable "vmName" { | |
type = string | |
description = "virtual machine name w/ technician's initials as a suffix" | |
default = "ansibledev-yourinitials" | |
} | |
variable "vmSize" { | |
type = string | |
description = "virtual machine size" | |
default = "Standard_B2s" | |
} | |
variable "vmAdminName" { | |
type = string | |
description = "virtual machine admin name" | |
default = "ansibleadmin" | |
} | |
variable "vmSrcImageReference" { | |
type = map | |
description = "virtual machine source image reference" | |
default = { | |
"publisher" = "Canonical" | |
"offer" = "UbuntuServer" | |
"sku" = "18.04-LTS" | |
"version" = "latest" | |
} | |
} | |
resource "azurerm_linux_virtual_machine" "vm1" { | |
name = var.vmName | |
resource_group_name = azurerm_resource_group.rg1.name | |
location = azurerm_resource_group.rg1.location | |
size = var.vmSize | |
admin_username = var.vmAdminName | |
network_interface_ids = [ | |
azurerm_network_interface.nic1.id | |
] | |
admin_ssh_key { | |
username = var.vmAdminName | |
public_key = tls_private_key.vm1key.public_key_openssh | |
} | |
os_disk { | |
caching = "ReadWrite" | |
storage_account_type = "Standard_LRS" | |
} | |
source_image_reference { | |
publisher = var.vmSrcImageReference["publisher"] | |
offer = var.vmSrcImageReference["offer"] | |
sku = var.vmSrcImageReference["sku"] | |
version = var.vmSrcImageReference["version"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment