Created
November 9, 2020 23:52
-
-
Save jesseloudon/23d14feeb8c65cea7409b9b6f00eed89 to your computer and use it in GitHub Desktop.
ansible on azure part 2
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
variable "vmPublicIPDNS" { | |
type = string | |
description = "virtual machine public IP DNS name w/ technician's initials as a suffix" | |
default = "ansibledev-yourinitials" | |
} | |
data "azurerm_subnet" "default" { | |
name = var.vnetSubnetName | |
virtual_network_name = var.vnetName | |
resource_group_name = var.rgName | |
depends_on = [ | |
azurerm_virtual_network.vnet1 | |
] | |
} | |
variable "vmNICPrivateIP" { | |
type = string | |
description = "virtual machine network interface private IP address" | |
default = "10.0.0.5" | |
} | |
resource "azurerm_public_ip" "pip1" { | |
name = var.vmName | |
resource_group_name = azurerm_resource_group.rg1.name | |
location = azurerm_resource_group.rg1.location | |
allocation_method = "Dynamic" | |
domain_name_label = var.vmPublicIPDNS | |
} | |
resource "azurerm_network_interface" "nic1" { | |
name = var.vmName | |
location = azurerm_resource_group.rg1.location | |
resource_group_name = azurerm_resource_group.rg1.name | |
ip_configuration { | |
name = "internal" | |
subnet_id = data.azurerm_subnet.default.id | |
private_ip_address_allocation = "Static" | |
private_ip_address = var.vmNICPrivateIP | |
public_ip_address_id = azurerm_public_ip.pip1.id | |
} | |
} | |
output "pip1" { | |
value = azurerm_public_ip.pip1.fqdn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment