Skip to content

Commit

Permalink
Merge pull request #7 from adambaumeister/tf-formatting
Browse files Browse the repository at this point in the history
Fix all formatting via terraform fmt
  • Loading branch information
adambaumeister committed Sep 24, 2020
2 parents ad1d2c6 + 5c384a3 commit 1427c67
Show file tree
Hide file tree
Showing 19 changed files with 469 additions and 469 deletions.
2 changes: 1 addition & 1 deletion example.tfvars
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Priority map of security rules for your management IP addresses.
# Each key is the public IP, and the number is the priority it gets in the relevant network security groups (NSGs).
management_ips = {
"199.199.199.199": 100,
"199.199.199.199" : 100,
}

# Optional Load Balancer (LB) rules
Expand Down
46 changes: 23 additions & 23 deletions external/test.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,63 +8,63 @@ terraform {
}

variable "key_lifetime" {
type = string
type = string
default = "8760"
}
variable "location" {
type = string
type = string
description = "The Azure region to use."
default = "Australia Central"
default = "Australia Central"
}
variable "name_prefix" {
type = string
type = string
description = "A prefix for all naming conventions - used globally"
default = "pantf"
default = "pantf"
}
variable "management_ips" {
type = map(any)
type = map(any)
description = "A list of IP addresses and/or subnets that are permitted to access the out of band Management network"
default = {
"121.45.210.83": 100
"121.45.210.83" : 100
}
}

variable "olb-private-ip" {
# This IP MUST be in the same subnet as the firewall "internal" interfaces
description = "The private IP address to assign to the Outgoing Load balancer frontend"
default = "172.16.1.250"
default = "172.16.1.250"
}

# Setup all the networking
module "networks" {
source = "../modules/networks"
location = var.location
source = "../modules/networks"
location = var.location
management_ips = var.management_ips
name_prefix = var.name_prefix
olb-ip = var.olb-private-ip
name_prefix = var.name_prefix
olb-ip = var.olb-private-ip
}
# Create a panorama instance
module "panorama" {
module "panorama" {
source = "../modules/panorama"

location = var.location
location = var.location
name_prefix = var.name_prefix
subnet-mgmt = module.networks.panorama-mgmt-subnet
password = "NicePassword!"
password = "NicePassword!"
}

data "external" "panorama_bootstrap" {
depends_on = [module.panorama]
program = ["python", "${path.module}/configure_panorama.py"]
program = ["python", "${path.module}/configure_panorama.py"]
query = {
panorama_ip = module.panorama.panorama-publicip
username = "panadmin"
password = "NicePassword!"
storage_account_name = module.panorama.bootstrap-storage-account.name
storage_account_key = module.panorama.bootstrap-storage-account.primary_access_key
inbound_storage_share_name = module.panorama.inbound-bootstrap-share-name
panorama_ip = module.panorama.panorama-publicip
username = "panadmin"
password = "NicePassword!"
storage_account_name = module.panorama.bootstrap-storage-account.name
storage_account_key = module.panorama.bootstrap-storage-account.primary_access_key
inbound_storage_share_name = module.panorama.inbound-bootstrap-share-name
outbound_storage_share_name = module.panorama.outbound-bootstrap-share-name
key_lifetime = var.key_lifetime
key_lifetime = var.key_lifetime
}
}
output "vm-auth-key" {
Expand Down
54 changes: 27 additions & 27 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,87 @@ provider "azurerm" {

# Setup all the networks required for the topology
module "networks" {
source = "./modules/networks"
location = var.location
source = "./modules/networks"
location = var.location
management_ips = var.management_ips
name_prefix = var.name_prefix
name_prefix = var.name_prefix

management_vnet_prefix = var.management_vnet_prefix
management_subnet = var.management_subnet
management_subnet = var.management_subnet

olb_private_ip = var.olb_private_ip

firewall_vnet_prefix = var.firewall_vnet_prefix
private_subnet = var.private_subnet
public_subnet = var.public_subnet
private_subnet = var.private_subnet
public_subnet = var.public_subnet
vm_management_subnet = var.vm_management_subnet
}

# Create a panorama instance
module "panorama" {
source = "./modules/panorama"

location = var.location
location = var.location
name_prefix = var.name_prefix
subnet_mgmt = module.networks.panorama-mgmt-subnet

username = var.username
password = var.password

panorama_sku = var.panorama_sku
panorama_sku = var.panorama_sku
panorama_version = var.panorama_version
}

# Deploy the inbound load balancer for traffic into the azure environment
module "inbound-lb" {
source = "./modules/lbs"

location = var.location
location = var.location
name_prefix = var.name_prefix
rules = var.rules
rules = var.rules

}

# Deploy the outbound load balancer for traffic out of the azure environment
module "outbound-lb" {
source = "./modules/olb"
location = var.location
name_prefix = var.name_prefix
private-ip = var.olb_private_ip
source = "./modules/olb"
location = var.location
name_prefix = var.name_prefix
private-ip = var.olb_private_ip
backend-subnet = module.networks.subnet-private.id
}

# Create the inbound and outbound VM Scale sets
module "vm-series" {
source = "./modules/vm"

location = var.location
location = var.location
name_prefix = var.name_prefix
username = var.username
password = var.password
username = var.username
password = var.password

subnet-mgmt = module.networks.subnet-mgmt
subnet-mgmt = module.networks.subnet-mgmt
subnet-private = module.networks.subnet-private
subnet-public = module.networks.subnet-public
subnet-public = module.networks.subnet-public

bootstrap-storage-account = module.panorama.bootstrap-storage-account
inbound-bootstrap-share-name = module.panorama.inbound-bootstrap-share-name
bootstrap-storage-account = module.panorama.bootstrap-storage-account
inbound-bootstrap-share-name = module.panorama.inbound-bootstrap-share-name
outbound-bootstrap-share-name = module.panorama.outbound-bootstrap-share-name

depends_on = [module.panorama]

vhd-container = module.panorama.storage-container-name
vhd-container = module.panorama.storage-container-name
private_backend_pool_id = module.outbound-lb.backend-pool-id
public_backend_pool_id = module.inbound-lb.backend-pool-id
public_backend_pool_id = module.inbound-lb.backend-pool-id
}

# Create a test VNET
module "test-host" {
source = "./modules/test-vnet"
source = "./modules/test-vnet"
admin-password = var.password
location = var.location
name_prefix = var.name_prefix
peer-vnet = module.networks.transit-vnet
location = var.location
name_prefix = var.name_prefix
peer-vnet = module.networks.transit-vnet
route-table-id = module.networks.outbound-route-table
}

Expand Down
60 changes: 30 additions & 30 deletions modules/lbs/lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,68 +3,68 @@

resource "azurerm_resource_group" "rg-lb" {
location = var.location
name = "${var.name_prefix}-lb-rg"
name = "${var.name_prefix}-lb-rg"
}

resource "azurerm_public_ip" "lb-fip-pip" {
for_each = { for rule in var.rules : rule.port => rule }
allocation_method = "Static"
sku = "standard"
location = azurerm_resource_group.rg-lb.location
name = "${var.name_prefix}-${each.value.port}"
for_each = { for rule in var.rules : rule.port => rule }
allocation_method = "Static"
sku = "standard"
location = azurerm_resource_group.rg-lb.location
name = "${var.name_prefix}-${each.value.port}"
resource_group_name = azurerm_resource_group.rg-lb.name
}

resource "azurerm_public_ip" "lb-inbound-fip-pip" {
allocation_method = "Static"
sku = "standard"
location = azurerm_resource_group.rg-lb.location
name = "${var.name_prefix}-inbound-fip-pip"
allocation_method = "Static"
sku = "standard"
location = azurerm_resource_group.rg-lb.location
name = "${var.name_prefix}-inbound-fip-pip"
resource_group_name = azurerm_resource_group.rg-lb.name
}

resource "azurerm_lb" "lb" {
location = var.location
name = "${var.name_prefix}-lb"
location = var.location
name = "${var.name_prefix}-lb"
resource_group_name = azurerm_resource_group.rg-lb.name
sku = "standard"
sku = "standard"
dynamic "frontend_ip_configuration" {
for_each = azurerm_public_ip.lb-fip-pip
content {
name = "${frontend_ip_configuration.value.name}-fip"
name = "${frontend_ip_configuration.value.name}-fip"
public_ip_address_id = frontend_ip_configuration.value.id
}
}
frontend_ip_configuration {
name = "${var.name_prefix}-outbound-fip"
name = "${var.name_prefix}-outbound-fip"
public_ip_address_id = azurerm_public_ip.lb-inbound-fip-pip.id
}
}

resource "azurerm_lb_backend_address_pool" "lb-backend" {
loadbalancer_id = azurerm_lb.lb.id
name = "${var.name_prefix}-lb-backend"
loadbalancer_id = azurerm_lb.lb.id
name = "${var.name_prefix}-lb-backend"
resource_group_name = azurerm_resource_group.rg-lb.name
}

resource "azurerm_lb_probe" "probe" {
loadbalancer_id = azurerm_lb.lb.id
name = "${var.name_prefix}-lb-probe-80"
port = 80
loadbalancer_id = azurerm_lb.lb.id
name = "${var.name_prefix}-lb-probe-80"
port = 80
resource_group_name = azurerm_resource_group.rg-lb.name

}

resource "azurerm_lb_rule" "lb-rules" {
for_each = { for rule in var.rules : rule.port => rule }
backend_port = each.value.port
for_each = { for rule in var.rules : rule.port => rule }
backend_port = each.value.port
frontend_ip_configuration_name = "${var.name_prefix}-${each.value.port}-fip"
frontend_port = each.value.port
loadbalancer_id = azurerm_lb.lb.id
name = "${each.value.name}-lbrule"
protocol = "Tcp"
resource_group_name = azurerm_resource_group.rg-lb.name
enable_floating_ip = true
backend_address_pool_id = azurerm_lb_backend_address_pool.lb-backend.id
probe_id = azurerm_lb_probe.probe.id
frontend_port = each.value.port
loadbalancer_id = azurerm_lb.lb.id
name = "${each.value.name}-lbrule"
protocol = "Tcp"
resource_group_name = azurerm_resource_group.rg-lb.name
enable_floating_ip = true
backend_address_pool_id = azurerm_lb_backend_address_pool.lb-backend.id
probe_id = azurerm_lb_probe.probe.id
}
2 changes: 1 addition & 1 deletion modules/lbs/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output "pip-ips" {

value = {
for pip in azurerm_public_ip.lb-fip-pip:
for pip in azurerm_public_ip.lb-fip-pip :
pip.id => pip.ip_address
}
}
Expand Down
Loading

0 comments on commit 1427c67

Please sign in to comment.