Skip to content

Commit

Permalink
add back api to path
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Oct 15, 2024
1 parent 02c9993 commit 5e3f960
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 25 deletions.
28 changes: 17 additions & 11 deletions ops/terraform/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,49 @@ locals {
dev = {
dev = {
vnetcidr = "10.0.0.0/16"
websubnetcidr = "10.0.1.0/24"
appsubnetcidr = "10.0.1.0/24"
websubnetcidr = "10.0.2.0/24"
lbsubnetcidr = "10.0.2.0/24"
}
}
dev2 = {
dev2 = {
vnetcidr = "10.2.0.0/16"
websubnetcidr = "10.2.1.0/24"
lbsubnetcidr = "10.2.2.0/24"
appsubnetcidr = "10.2.1.0/24"
websubnetcidr = "10.2.2.0/24"
lbsubnetcidr = "10.2.3.0/24"
}
}
dev3 = {
dev3 = {
vnetcidr = "10.3.0.0/16"
websubnetcidr = "10.3.1.0/24"
lbsubnetcidr = "10.3.2.0/24"
appsubnetcidr = "10.3.1.0/24"
websubnetcidr = "10.3.2.0/24"
lbsubnetcidr = "10.3.3.0/24"
}
}
dev4 = {
dev4 = {
vnetcidr = "10.4.0.0/16"
websubnetcidr = "10.4.1.0/24"
lbsubnetcidr = "10.4.2.0/24"
appsubnetcidr = "10.4.1.0/24"
websubnetcidr = "10.4.2.0/24"
lbsubnetcidr = "10.4.3.0/24"
}
}
dev5 = {
dev5 = {
vnetcidr = "10.5.0.0/16"
websubnetcidr = "10.5.1.0/24"
lbsubnetcidr = "10.5.2.0/24"
appsubnetcidr = "10.5.1.0/24"
websubnetcidr = "10.5.2.0/24"
lbsubnetcidr = "10.5.3.0/24"
}
}
dev6 = {
dev6 = {
vnetcidr = "10.6.0.0/16"
websubnetcidr = "10.6.1.0/24"
lbsubnetcidr = "10.6.2.0/24"
appsubnetcidr = "10.6.1.0/24"
websubnetcidr = "10.6.2.0/24"
lbsubnetcidr = "10.6.3.0/24"
}
}
}
18 changes: 18 additions & 0 deletions ops/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ locals {
}
}

output "workspace" {
value = "${terraform.workspace}"
}

output "vnetcidr" {
value = "${local.workspace["vnetcidr"]}"
}

output "websubnetcidr" {
value = "${local.workspace["websubnetcidr"]}"
}

output "lbsubnetcidr" {
value = "${local.workspace["lbsubnetcidr"]}"
}

##########
## 02-network
##########
Expand All @@ -19,6 +35,7 @@ module "networking" {
vnetcidr = local.workspace["vnetcidr"]
websubnetcidr = local.workspace["websubnetcidr"]
lbsubnetcidr = local.workspace["lbsubnetcidr"]
appsubnetcidr = local.workspace["appsubnetcidr"]
env = local.environment
}

Expand All @@ -32,6 +49,7 @@ module "securitygroup" {
location = data.azurerm_resource_group.rg.location
resource_group = data.azurerm_resource_group.rg.name
web_subnet_id = module.networking.websubnet_id
app_subnet_id = module.networking.appsubnet_id
# db_subnet_id = module.networking.dbsubnet_id
lb_subnet_id = module.networking.lbsubnet_id
env = local.environment
Expand Down
2 changes: 1 addition & 1 deletion ops/terraform/modules/app_gateway/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ resource "azurerm_application_gateway" "load_balancer" {

path_rule {
name = "api"
paths = ["/*", "/"]
paths = ["/api/*", "/api"]
backend_address_pool_name = local.backend_address_pool_name_api
backend_http_settings_name = local.http_setting_name_api
// this is the default, why would we set it again?
Expand Down
26 changes: 13 additions & 13 deletions ops/terraform/modules/network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ resource "azurerm_subnet" "web-subnet" {
depends_on = [azurerm_virtual_network.vnet]
}

# resource "azurerm_subnet" "app-subnet" {
# name = "${var.name}-app-subnet-${var.env}"
# virtual_network_name = azurerm_virtual_network.vnet.name
# resource_group_name = var.resource_group
# address_prefixes = [var.appsubnetcidr]
resource "azurerm_subnet" "app-subnet" {
name = "${var.name}-app-subnet-${var.env}"
virtual_network_name = azurerm_virtual_network.vnet.name
resource_group_name = var.resource_group
address_prefixes = [var.appsubnetcidr]

# delegation {
# name = "delegation"
delegation {
name = "delegation"

# service_delegation {
# name = "Microsoft.ContainerInstance/containerGroups"
# actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
# }
# }
# }
service_delegation {
name = "Microsoft.ContainerInstance/containerGroups"
actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
}
}
}

resource "azurerm_subnet" "lb-subnet" {
name = "${var.name}-lb-subnet-${var.env}"
Expand Down
5 changes: 5 additions & 0 deletions ops/terraform/modules/network/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ output "websubnet_id" {
description = "Id of websubnet in the network"
}

output "appsubnet_id" {
value = azurerm_subnet.app-subnet.id
description = "Id of appsubnet in the network"
}

# output "dbsubnet_id" {
# value = azurerm_subnet.db-subnet.id
# description = "Id of dbsubnet in the network"
Expand Down
1 change: 1 addition & 0 deletions ops/terraform/modules/network/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ variable "name" {}
variable "location" {}
variable "vnetcidr" {}
variable "websubnetcidr" {}
variable "appsubnetcidr" {}
variable "lbsubnetcidr" {}
# variable "dbsubnetcidr" {}
variable "env" {}
1 change: 1 addition & 0 deletions ops/terraform/modules/security/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ variable "name" {}
variable "env" {}
variable "resource_group" {}
variable "web_subnet_id" {}
variable "app_subnet_id" {}
# variable "db_subnet_id" {}
variable "lb_subnet_id" {}

0 comments on commit 5e3f960

Please sign in to comment.