Skip to content

Commit

Permalink
chore(Terraform): move subnet ID to be specified as a variable - REVE…
Browse files Browse the repository at this point in the history
…RT ME

Don't have permission to read.
  • Loading branch information
afeld committed Dec 21, 2022
1 parent e4a2f0d commit c4748ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion terraform/app_service.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "azurerm_linux_web_app" "main" {
resource_group_name = data.azurerm_resource_group.main.name
service_plan_id = azurerm_service_plan.main.id
https_only = true
virtual_network_subnet_id = data.azurerm_subnet.main.id
virtual_network_subnet_id = local.subnet_id

site_config {
ftps_state = "Disabled"
Expand Down
12 changes: 5 additions & 7 deletions terraform/network.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
locals {
# VNet uses a shared resource group different from the main App Service resource group
network_resource_group_name = "RG-CDT-PUB-SHRD-W-${local.env_letter}-001"
}
# VNet uses a shared Resource Group, different from App Service Resource Group we use for Benefits stuff
network_resource_group_name = local.is_prod ? "RG-CDT-PUB-SHRD-W-P-001" : "RG-CDT-PUB-D-001"
vnet_name = local.is_prod ? "VNET-CDT-PUB-SHRD-W-P-001" : "VNET-CDT-PUB-D-001"
subnet_name = local.is_prod ? "SNET-CDT-PUB-CALITP-P-001" : "SN-CDT-PUB-CALITP-${local.env_letter}-001"

data "azurerm_subnet" "main" {
name = "SNET-CDT-PUB-CALITP-${local.env_letter}-001"
virtual_network_name = "VNET-CDT-PUB-SHRD-W-${local.env_letter}-001"
resource_group_name = local.network_resource_group_name
subnet_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/resourceGroups/${local.network_resource_group_name}/providers/Microsoft.Network/virtualNetworks/${local.vnet_name}/subnets/${local.subnet_name}"
}

0 comments on commit c4748ef

Please sign in to comment.