Terraform module for virtual machine creation with NIC and iptables MASQUERADE configuration in custom data.
This module is provisioning virtual machine with NIC. Below is an example that provisions VM with NIC and two subnets allowed in iptables configuration.
locals {
vm_admin_credentials = {
username = "example_user"
public_key = "<public_rsa_key>"
}
}
data "azurerm_subnet" "vm_subnet" {
name = "vm"
resource_group_name = "vm_rg"
virtual_network_name = "vm_vnet"
}
data "azurerm_subnet" "example_subnet" {
name = "databricks-public"
resource_group_name = "example_rg"
virtual_network_name = "example_vnet"
}
module "private-nat-vm" {
source = "data-platform-hq/private-nat-vm/azurerm"
project = "datahq"
env = "example"
location = "eastus"
resource_group = "example_rg"
vm_admin_credentials = local.vm_admin_credentials
subnet_id = data.azurerm_subnet.vm_subnet.id
subnet_cidrs = toset(data.azurerm_subnet.example_subnet.address_prefixes)
tags = { environment = "dev" }
}
Name | Version |
---|---|
terraform | >= 1.0.0 |
azurerm | >= 3.23.0 |
Name | Version |
---|---|
azurerm | >= 3.23.0 |
No modules.
Name | Type |
---|---|
azurerm_linux_virtual_machine.this | resource |
azurerm_network_interface.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
encryption_at_host_enabled | Boolean flag which controls Encryption at Host for all of the disks (including the temp disk) attached to this Virtual Machine. True means enable | bool |
true |
no |
env | Environment name | string |
n/a | yes |
location | Specifies the supported Azure location where the resource exists | string |
n/a | yes |
nic_ip_configuration | Network interface card IP configuration | object({ |
{ |
no |
project | Project name | string |
n/a | yes |
resource_group | The name of the resource group in which to create resources | string |
n/a | yes |
subnet_cidrs | CIDRs of subnets to be allowed on NAT instance | list(any) |
n/a | yes |
subnet_id | The ID of the Subnet where Network Interface should be located in | string |
n/a | yes |
suffix | Resource name suffix | string |
"" |
no |
tags | Resource tags | map(any) |
{} |
no |
use_custom_data | Boolean flag which controls usage of provided custom data during virtual machine provisioning. True means to use. | bool |
true |
no |
vm_admin_credentials | Username and public key used during virtual machine creation | object({ |
n/a | yes |
vm_os_disk | Virtual machine OS disk configuration | object({ |
{ |
no |
vm_size | Virtual machine instance size | string |
"Standard_B1ls" |
no |
vm_source_image_references | Virtual machine source image references | object({ |
{ |
no |
Name | Description |
---|---|
azurerm_vm_private_ip | Private IP address of virtual machine |
Apache 2 Licensed. For more information please see LICENSE