Skip to content

Commit a86dad8

Browse files
committed
wip
1 parent e8bcbbc commit a86dad8

13 files changed

Lines changed: 185 additions & 218 deletions

File tree

.azuredevops/pipelines/hub-infrastructure-dev.yaml

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ pr: none
66
pool:
77
name: private-pool-hub-nonlive-uks
88
# vmImage: ubuntu-latest
9-
steps:
10-
- script: |
11-
echo "=== List hosted toolcache ==="
12-
ls -la /opt/hostedtoolcache || true
13-
14-
echo "=== List terraform cache ==="
15-
ls -la /opt/hostedtoolcache/terraform || true
16-
17-
echo "=== Which terraform ==="
18-
which terraform || true
19-
20-
echo "=== Terraform version ==="
21-
terraform version || true
22-
displayName: Inspect Terraform installation
239

2410
resources:
2511
repositories:
@@ -32,9 +18,9 @@ resources:
3218
variables:
3319
- group: NON_LIVE_hub_backend
3420
- name: TF_DIRECTORY
35-
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/terraform/hub
21+
value: $(System.DefaultWorkingDirectory)/lung_cancer_screening/infrastructure/terraform/hub
3622
- name: TF_VERSION
37-
value: 1.11.4
23+
value: 1.14.3
3824
- name: TF_PLAN_ARTIFACT
3925
value: tf_plan_hub_art_NONLIVE_dev
4026
- name: ENVIRONMENT
@@ -50,19 +36,21 @@ stages:
5036
- job: init_and_plan
5137
displayName: Init, plan, store artifact
5238
steps:
53-
- task: TerraformInstaller@1
54-
displayName: Install Terraform $(TF_VERSION)
55-
inputs:
56-
terraformVersion: $(TF_VERSION)
39+
- checkout: self
40+
- checkout: dtos-devops-templates
5741
- task: Bash@3
58-
displayName: 'Set TF_DIRECTORY variable'
42+
displayName: 'Debug Terraform directory'
5943
inputs:
6044
targetType: 'inline'
6145
script: |
62-
terraform --version
63-
64-
- checkout: self
65-
- checkout: dtos-devops-templates
46+
find . -type d | grep dtos-devops-templates
47+
pwd
48+
ls -la
49+
echo "TF_DIRECTORY=$(TF_DIRECTORY)"
50+
# cd $(TF_DIRECTORY)
51+
ls -ltr
52+
find .
53+
terraform --version || true
6654
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates
6755

6856
- stage: terraform_apply

infrastructure/bootstrap/hub.bicep

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ module managedIdentiyGHtoADO 'modules/managedIdentity.bicep' = {
217217
}
218218
}
219219

220-
221220
@description('Let the GHtoADO managed identity access a subscription')
222221
resource readerAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
223222
name: guid(subscription().subscriptionId, hubType, 'reader')

infrastructure/bootstrap/modules/managedDevopsPool.bicep

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ param devopsSubnetName string
1212
param devopsSubnetAddressPrefix string
1313
param virtualNetworkName string
1414

15-
// param fabricProfileSkuName string = 'Standard_D2ads_v5'
16-
param fabricProfileSkuName string = 'Standard_D2as_v5'
15+
param fabricProfileSkuName string = 'Standard_D2ads_v5'
1716
//param fabricProfileSkuName string = 'Standard_D2ldsv6'
1817
//param fabricProfileSkuName string = 'Standard_B4ms'
1918

infrastructure/environments/nonlive-hub/variables.tfvars

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,53 @@ postgres_backup_retention_days = 7
1010
postgres_geo_redundant_backup_enabled = false
1111
protect_keyvault = false
1212
vnet_address_space = "10.65.0.0/16"
13+
14+
15+
regions = {
16+
uksouth = {
17+
address_space = "10.65.0.0/16"
18+
is_primary_region = true
19+
subnets = {
20+
acr = {
21+
cidr_newbits = 11
22+
cidr_offset = 8
23+
}
24+
api-mgmt = {
25+
cidr_newbits = 8
26+
cidr_offset = 6
27+
}
28+
app-gateway = {
29+
cidr_newbits = 8
30+
cidr_offset = 5
31+
}
32+
pep = {
33+
cidr_newbits = 8
34+
cidr_offset = 2
35+
}
36+
virtual-desktop = {
37+
cidr_newbits = 11
38+
cidr_offset = 32
39+
}
40+
devops = {
41+
cidr_newbits = 8
42+
cidr_offset = 9
43+
delegation_name = "Microsoft.DevOpsInfrastructure/pools" # az provider register --namespace 'Microsoft.DevOpsInfrastructure'
44+
service_delegation_name = "Microsoft.DevOpsInfrastructure/pools"
45+
service_delegation_actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
46+
}
47+
dns-resolver-in = {
48+
cidr_newbits = 12
49+
cidr_offset = 112
50+
delegation_name = "Microsoft.Network/dnsResolvers"
51+
service_delegation_name = "Microsoft.Network/dnsResolvers"
52+
service_delegation_actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
53+
}
54+
firewall = {
55+
name = "AzureFirewallSubnet"
56+
cidr_newbits = 10
57+
cidr_offset = 192
58+
create_nsg = false
59+
}
60+
}
61+
}
62+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module "config" {
2+
for_each = var.regions
3+
4+
source = "../../../../dtos-devops-templates/infrastructure/modules/shared-config"
5+
6+
location = each.key
7+
application = var.application
8+
env = var.environment
9+
env_type = var.env_type
10+
tags = var.tags
11+
}

infrastructure/terraform/hub/dns_private.tf

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ resource "azurerm_resource_group" "private_dns_rg" {
99
Private DNS Zone Resolver
1010
--------------------------------------------------------------------------------------------------*/
1111

12-
module "private_dns_resolver" {
13-
for_each = var.regions
12+
# module "private_dns_resolver" {
13+
# for_each = var.regions
1414

15-
source = "../../dtos-devops-templates/infrastructure/modules/private-dns-zone-resolver"
15+
# source = "../../../../dtos-devops-templates/infrastructure/modules/private-dns-zone-resolver"
1616

17-
name = "${module.config[each.key].names.resource-application}-private-dns-zone-resolver"
18-
resource_group_name = azurerm_resource_group.private_dns_rg[each.key].name
19-
location = each.key
20-
vnet_id = module.vnets_hub[each.key].vnet.id
17+
# name = "${module.config[each.key].names.resource-application}-private-dns-zone-resolver"
18+
# resource_group_name = azurerm_resource_group.private_dns_rg[each.key].name
19+
# location = each.key
20+
# vnet_id = module.vnets_hub[each.key].vnet.id
2121

22-
inbound_endpoint_config = {
23-
name = "private-dns-resolver-inbound-endpoint"
24-
private_ip_allocation_method = "Dynamic"
25-
subnet_id = module.subnets_hub["${module.config[each.key].names.subnet}-dns-resolver-in"].id
26-
}
22+
# inbound_endpoint_config = {
23+
# name = "private-dns-resolver-inbound-endpoint"
24+
# private_ip_allocation_method = "Dynamic"
25+
# subnet_id = module.subnets_hub["${module.config[each.key].names.subnet}-dns-resolver-in"].id
26+
# }
2727

28-
tags = var.tags
29-
}
28+
# tags = var.tags
29+
# }
3030

3131
/*--------------------------------------------------------------------------------------------------
3232
Private DNS zones
@@ -66,57 +66,57 @@ locals {
6666
private_dns_zones_map = { for obj in local.private_dns_zones_obj_list : "${obj.region}-${obj.description}" => obj }
6767
}
6868

69-
module "private_dns_zones" {
70-
for_each = local.private_dns_zones_map
69+
# module "private_dns_zones" {
70+
# for_each = local.private_dns_zones_map
7171

72-
source = "../../dtos-devops-templates/infrastructure/modules/private-dns-zone"
72+
# source = "../../../../dtos-devops-templates/infrastructure/modules/private-dns-zone"
7373

74-
name = each.value.name
75-
resource_group_name = azurerm_resource_group.private_dns_rg[each.value.region].name
76-
vnet_id = module.vnets_hub[each.value.region].vnet.id
74+
# name = each.value.name
75+
# resource_group_name = azurerm_resource_group.private_dns_rg[each.value.region].name
76+
# vnet_id = module.vnets_hub[each.value.region].vnet.id
7777

78-
tags = var.tags
79-
}
78+
# tags = var.tags
79+
# }
8080

8181
/*--------------------------------------------------------------------------------------------------
8282
Private DNS A Records for APIM and Application Gateway
8383
--------------------------------------------------------------------------------------------------*/
8484

85-
locals {
86-
apim_private_custom_domains = ["gateway", "portal", "scm"]
87-
appgw_private_listener_hostnames = ["api"]
88-
89-
private_dns_a_records_obj_list = flatten([
90-
for region in keys(var.regions) : [
91-
[
92-
for hostname in local.apim_private_custom_domains : {
93-
region = region
94-
name = hostname
95-
records = module.api-management[region].private_ip_addresses
96-
}
97-
],
98-
[
99-
for hostname in local.appgw_private_listener_hostnames : {
100-
region = region
101-
name = hostname
102-
records = [local.appgw_config[region].frontend_ip_configuration.private.private_ip_address]
103-
}
104-
]
105-
]
106-
])
107-
private_dns_a_records_map = { for obj in local.private_dns_a_records_obj_list : "${obj.region}-${obj.name}" => obj }
108-
}
109-
110-
module "private-dns-a-records" {
111-
for_each = local.private_dns_a_records_map
112-
113-
source = "../../dtos-devops-templates/infrastructure/modules/private-dns-a-record"
114-
115-
name = each.value.name
116-
resource_group_name = resource.azurerm_resource_group.private_dns_rg[each.value.region].name
117-
zone_name = var.dns_zone_name_private.nationalscreening
118-
ttl = 300
119-
records = each.value.records
120-
121-
tags = var.tags
122-
}
85+
# locals {
86+
# apim_private_custom_domains = ["gateway", "portal", "scm"]
87+
# appgw_private_listener_hostnames = ["api"]
88+
89+
# private_dns_a_records_obj_list = flatten([
90+
# for region in keys(var.regions) : [
91+
# [
92+
# for hostname in local.apim_private_custom_domains : {
93+
# region = region
94+
# name = hostname
95+
# records = module.api-management[region].private_ip_addresses
96+
# }
97+
# ],
98+
# [
99+
# for hostname in local.appgw_private_listener_hostnames : {
100+
# region = region
101+
# name = hostname
102+
# records = [local.appgw_config[region].frontend_ip_configuration.private.private_ip_address]
103+
# }
104+
# ]
105+
# ]
106+
# ])
107+
# private_dns_a_records_map = { for obj in local.private_dns_a_records_obj_list : "${obj.region}-${obj.name}" => obj }
108+
# }
109+
110+
# module "private-dns-a-records" {
111+
# for_each = local.private_dns_a_records_map
112+
113+
# source = "../../../../dtos-devops-templates/infrastructure/modules/private-dns-a-record"
114+
115+
# name = each.value.name
116+
# resource_group_name = resource.azurerm_resource_group.private_dns_rg[each.value.region].name
117+
# zone_name = var.dns_zone_name_private.nationalscreening
118+
# ttl = 300
119+
# records = each.value.records
120+
121+
# tags = var.tags
122+
# }

infrastructure/terraform/hub/dns_public.tf

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
Application Gateway Public DNS A Records
33
--------------------------------------------------------------------------------------------------*/
44

5-
locals {
6-
appgw_public_listener_hostnames = [
7-
for listener in local.appgw_config[local.primary_region].http_listener :
8-
listener.host_name if listener.frontend_ip_configuration_key == "public"
9-
]
10-
}
5+
# locals {
6+
# appgw_public_listener_hostnames = [
7+
# for listener in local.appgw_config[local.primary_region].http_listener :
8+
# listener.host_name if listener.frontend_ip_configuration_key == "public"
9+
# ]
10+
# }
1111

12-
module "appgw-dns-a-records" {
13-
# No region loop since public DNS is global. Traffic Manager will be required if an additional region is added.
14-
for_each = toset(local.appgw_public_listener_hostnames)
12+
# module "appgw-dns-a-records" {
13+
# # No region loop since public DNS is global. Traffic Manager will be required if an additional region is added.
14+
# for_each = toset(local.appgw_public_listener_hostnames)
1515

16-
source = "../../dtos-devops-templates/infrastructure/modules/dns-a-record"
16+
# source = "../../../../dtos-devops-templates/infrastructure/modules/dns-a-record"
1717

18-
name = split(".", each.key)[0]
19-
resource_group_name = var.dns_zone_rg_name_public
20-
zone_name = replace(each.key, "${split(".", each.key)[0]}.", "")
21-
ttl = 300
22-
target_resource_id = module.application-gateway-pip[local.primary_region].id
18+
# name = split(".", each.key)[0]
19+
# resource_group_name = var.dns_zone_rg_name_public
20+
# zone_name = replace(each.key, "${split(".", each.key)[0]}.", "")
21+
# ttl = 300
22+
# target_resource_id = module.application-gateway-pip[local.primary_region].id
2323

24-
tags = var.tags
25-
}
24+
# tags = var.tags
25+
# }

infrastructure/terraform/hub/firewall.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module "firewall" {
22
for_each = var.regions
33

4-
source = "../../dtos-devops-templates/infrastructure/modules/firewall"
4+
source = "../../../../dtos-devops-templates/infrastructure/modules/firewall"
55

66
firewall_name = module.config[each.key].names.firewall
77
resource_group_name = azurerm_resource_group.rg_hub[each.key].name
@@ -33,7 +33,7 @@ module "firewall" {
3333
module "public_ip" {
3434
for_each = local.public_ips_map
3535

36-
source = "../../dtos-devops-templates/infrastructure/modules/public-ip"
36+
source = "../../../../dtos-devops-templates/infrastructure/modules/public-ip"
3737

3838
name = "${module.config[each.value.region_key].names.public-ip-address}-${each.value.name_suffix}"
3939
resource_group_name = azurerm_resource_group.rg_hub[each.value.region_key].name
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
resource "azurerm_resource_group" "rg_hub" {
2+
for_each = var.regions
3+
4+
name = "${module.config[each.key].names.resource-group}-${var.application}-networking"
5+
location = each.key
6+
}

infrastructure/terraform/hub/outputs.tf

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,6 @@ output "azure_monitor_private_link_scope_name" {
22
value = azurerm_monitor_private_link_scope.ampls.name
33
}
44

5-
output "certificates" {
6-
value = module.acme_certificate
7-
sensitive = true
8-
}
9-
10-
output "event_grid_topic" {
11-
value = module.event_grid_topic
12-
}
13-
14-
# Output the Event Hub Id for Log Analytics Data Exports so it can be used as a reference
15-
# by the Log Analytics workspace modules in Audit and Hub services
16-
output "eventhub_law_export_id" {
17-
value = { for k, v in module.eventhub_law_export : k => v.id }
18-
}
19-
20-
output "event_hubs" {
21-
value = { for k, v in module.eventhub_law_export : k => v.event_hubs }
22-
}
23-
245
# Output the Firewall details so they can be used in the spoke networks
256
output "firewall_policy_id" {
267
value = { for k, v in module.firewall : k => v.firewall_policy_id }
@@ -74,6 +55,6 @@ output "storage" {
7455
sensitive = true
7556
}
7657

77-
output "vnets_hub" {
78-
value = module.vnets_hub
79-
}
58+
# output "vnets_hub" {
59+
# value = module.vnets_hub
60+
# }

0 commit comments

Comments
 (0)