Skip to content

Commit

Permalink
feat: active property
Browse files Browse the repository at this point in the history
  • Loading branch information
bancey committed Dec 13, 2024
1 parent b0bfc14 commit c6aadb1
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
7 changes: 7 additions & 0 deletions infra-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ parameters:
destroy: false
deploy: true
dependsOn: []
- deployment: prod_vpn_gateway
environment: prod
component: cloud-vpn-gateway
destroy: false
deploy: true
dependsOn:
- test_vpn_gateway
- deployment: test_gameserver
environment: test
component: gameserver
Expand Down
14 changes: 0 additions & 14 deletions terraform/components/cloud-vpn-gateway/inputs-optional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,3 @@ variable "location" {
type = string
default = "uksouth"
}

variable "cloud_vpn_gateway" {
type = object({
name = string
existing_resource_group_name = optional(string)
tags = optional(map(string))
networking = object({
address_space = string
gateway_subnet_address_prefix = string
})
})
description = "Object describing the configuration for the VPN Gateway and associated resources."
default = {}
}
14 changes: 14 additions & 0 deletions terraform/components/cloud-vpn-gateway/inputs-required.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@ variable "env" {
description = "The name of the environment"
type = string
}

variable "cloud_vpn_gateway" {
type = object({
name = string
active = optional(bool, true)
existing_resource_group_name = optional(string)
tags = optional(map(string))
networking = object({
address_space = string
gateway_subnet_address_prefix = string
})
})
description = "Object describing the configuration for the VPN Gateway and associated resources."
}
4 changes: 2 additions & 2 deletions terraform/components/cloud-vpn-gateway/networking.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "networking" {
count = var.cloud_vpn_gateway != null && var.cloud_vpn_gateway != {} ? 1 : 0
count = var.cloud_vpn_gateway.active ? 1 : 0
source = "github.com/hmcts/terraform-module-azure-virtual-networking?ref=main"

env = var.env
Expand All @@ -26,7 +26,7 @@ module "networking" {
}

resource "azurerm_public_ip" "this" {
count = var.cloud_vpn_gateway != null && var.cloud_vpn_gateway != {} ? 1 : 0
count = var.cloud_vpn_gateway.active ? 1 : 0
name = "${local.name}-public-ip"
location = var.location
resource_group_name = local.resource_group_name
Expand Down
2 changes: 1 addition & 1 deletion terraform/components/cloud-vpn-gateway/resource-group.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azurerm_resource_group" "this" {
count = var.cloud_vpn_gateway != null && var.cloud_vpn_gateway != {} && var.cloud_vpn_gateway.existing_resource_group_name == null ? 1 : 0
count = var.cloud_vpn_gateway.active && var.cloud_vpn_gateway.existing_resource_group_name == null ? 1 : 0
name = "${local.name}-rg"
location = var.location
}
2 changes: 1 addition & 1 deletion terraform/components/cloud-vpn-gateway/vpn-gateway.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azurerm_virtual_network_gateway" "this" {
count = var.cloud_vpn_gateway != null && var.cloud_vpn_gateway != {} ? 1 : 0
count = var.cloud_vpn_gateway.active ? 1 : 0
name = "${local.name}-gateway"
location = var.location
resource_group_name = local.resource_group_name
Expand Down
14 changes: 11 additions & 3 deletions terraform/environments/prod/prod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,16 @@ adguard_user_rules = [
"@@||whattoexpect.com^$important",
"@@||analytics.twingate.com^$important",
"@@||msmetrics.ws.sonos.com^$important",
"@@||graph.facebook.com^$important",
"@@||b-graph.facebook.com^$important",
"@@||web.facebook.com^$important",
"@@||graph.facebook.com^$important",
"@@||b-graph.facebook.com^$important",
"@@||web.facebook.com^$important",
"@@||graph.instagram.com^$important",
]

cloud_vpn_gateway = {
name = "lab-vpn"
networking = {
address_space = "10.151.200.0/24"
gateway_subnet_address_prefix = "10.151.200.0/24"
}
}

0 comments on commit c6aadb1

Please sign in to comment.