Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions samples/web-app-cosmosdb-mongodb-api/python/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ locals {
suffix = lower(var.suffix)
resource_group_name = "${var.prefix}-rg"
log_analytics_name = "${local.prefix}-log-analytics-${local.suffix}"
storage_account_name = "${local.prefix}datastore${local.suffix}"
virtual_network_name = "${local.prefix}-vnet-${local.suffix}"
nat_gateway_name = "${local.prefix}-nat-gateway-${local.suffix}"
private_endpoint_name = "${local.prefix}-mongodb-pe-${local.suffix}"
network_security_group_name = "${local.prefix}-default-nsg-${local.suffix}"
webapp_subnet_nsg_name = "${local.prefix}-webapp-subnet-nsg-${local.suffix}"
pe_subnet_nsg_name = "${local.prefix}-pe-subnet-nsg-${local.suffix}"
cosmosdb_account_name = "${local.prefix}-mongodb-${local.suffix}"
app_service_plan_name = "${local.prefix}-app-service-plan-${local.suffix}"
web_app_name = "${local.prefix}-webapp-${local.suffix}"
Expand Down Expand Up @@ -61,21 +63,33 @@ module "virtual_network" {
]
}

# Create a network security group and associate it with the default subnet
module "network_security_group" {
# Create a network security group and associate it with the webapp subnet
module "webapp_subnet_network_security_group" {
source = "./modules/network_security_group"
name = local.network_security_group_name
name = local.webapp_subnet_nsg_name
resource_group_name = azurerm_resource_group.example.name
location = var.location
log_analytics_workspace_id = module.log_analytics_workspace.id
tags = var.tags
subnet_ids = {
(var.webapp_subnet_name) = module.virtual_network.subnet_ids[var.webapp_subnet_name]
}
}

# Create a network security group and associate it with the private endpoint subnet
module "pe_subnet_network_security_group" {
source = "./modules/network_security_group"
name = local.pe_subnet_nsg_name
resource_group_name = azurerm_resource_group.example.name
location = var.location
log_analytics_workspace_id = module.log_analytics_workspace.id
tags = var.tags
subnet_ids = {
(var.pe_subnet_name) = module.virtual_network.subnet_ids[var.pe_subnet_name]
}
}

# Create a NAT gateway and associate it with the default subnet
# Create a NAT gateway and associate it with the webapp subnet
module "nat_gateway" {
source = "./modules/nat_gateway"
name = local.nat_gateway_name
Expand Down
Loading