data-platform-hq / terraform-azurerm-private-nat-vm

Terraform module for VM creation and configuting iptables MASQUERADE with custom data

Home Page:https://registry.terraform.io/modules/data-platform-hq/private-nat-vm/azurerm/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure private nat vm Terraform module

Terraform module for virtual machine creation with NIC and iptables MASQUERADE configuration in custom data.

Usage

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" }
}

Requirements

Name Version
terraform >= 1.0.0
azurerm >= 3.23.0

Providers

Name Version
azurerm >= 3.23.0

Modules

No modules.

Resources

Name Type
azurerm_linux_virtual_machine.this resource
azurerm_network_interface.this resource

Inputs

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({
name = string
private_ip_address_allocation = string
})
{
"name": "external",
"private_ip_address_allocation": "Dynamic"
}
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({
username = string
public_key = string
})
n/a yes
vm_os_disk Virtual machine OS disk configuration
object({
caching = string
storage_account_type = string
})
{
"caching": "None",
"storage_account_type": "Standard_LRS"
}
no
vm_size Virtual machine instance size string "Standard_B1ls" no
vm_source_image_references Virtual machine source image references
object({
publisher = string
offer = string
sku = string
version = string
})
{
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18.04-LTS",
"version": "latest"
}
no

Outputs

Name Description
azurerm_vm_private_ip Private IP address of virtual machine

License

Apache 2 Licensed. For more information please see LICENSE

About

Terraform module for VM creation and configuting iptables MASQUERADE with custom data

https://registry.terraform.io/modules/data-platform-hq/private-nat-vm/azurerm/latest

License:Other


Languages

Language:HCL 55.6%Language:Shell 44.4%