Open CMBG-Jamie opened 3 years ago
provider "azurerm" {
features {}
}
# Resource Group
resource "azurerm_resource_group" "example" {
name = "rg-vpngateway"
location = "East US"
}
# Virtual Network
resource "azurerm_virtual_network" "example" {
name = "vnet-example"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
# Subnet for Gateway (Ensure it’s named "GatewaySubnet")
resource "azurerm_subnet" "gateway_subnet" {
name = "GatewaySubnet"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.255.0/27"]
}
# Public IP for the VPN Gateway
resource "azurerm_public_ip" "vpn_gateway_ip" {
name = "vpnGatewayPip"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
allocation_method = "Static"
}
# VPN Gateway
resource "azurerm_virtual_network_gateway" "vpn_gateway" {
name = "example-vpn-gateway"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
type = "Vpn"
vpn_type = "RouteBased"
active_active = false
enable_bgp = false
sku = "VpnGw1"
ip_configuration {
name = "vnetGatewayConfig"
public_ip_address_id = azurerm_public_ip.vpn_gateway_ip.id
subnet_id = azurerm_subnet.gateway_subnet.id
private_ip_address_allocation = "Dynamic" # Static assignment not supported here
}
tags = {
environment = "test"
}
}
I've tried but to no avail to use a static IP configuration for the internal IP of a VPN Gateway. I've tried the usual ip_address, private_ip_address, static_ip_address, internal_ip_address parameters to accompany a private_ip_allocation_method of "Static" but I can't even validate the document.
Is this feature even available yet, or is there some parameter which is missing from the documentation?