Skip to content
This repository was archived by the owner on Sep 12, 2025. It is now read-only.

Commit 23e761d

Browse files
feat: DTOSS-4810 function env vars plus nft and integration environments (#50)
1 parent e2dbca4 commit 23e761d

25 files changed

+962
-232
lines changed

.azuredevops/pipelines/cd-infrastructure-dev-audit.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22

33
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r)
44

5-
trigger:
6-
branches:
7-
include:
8-
- main
9-
paths:
10-
include:
11-
- infrastructure/*
5+
trigger: none
6+
pr: none
127

138
pool:
149
# vmImage: ubuntu-latest
@@ -19,7 +14,7 @@ resources:
1914
- repository: dtos-devops-templates
2015
type: github
2116
name: NHSDigital/dtos-devops-templates
22-
ref: 8eac5e6ffc4ebc704880128b64a1a716b923c44a
17+
ref: 57e204e15509e40243551dccfe077f3452a31369
2318
endpoint: NHSDigital
2419

2520
variables:
@@ -39,7 +34,7 @@ stages:
3934
displayName: Terraform Plan
4035
condition: eq(variables['Build.Reason'], 'Manual')
4136
variables:
42-
tfvars: environments/$(ENVIRONMENT).tfvars
37+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
4338
jobs:
4439
- job: init_and_plan
4540
displayName: Init, plan, store artifact

.azuredevops/pipelines/cd-infrastructure-dev-core.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,25 @@
22

33
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r)
44

5-
trigger:
6-
branches:
7-
include:
8-
- main
9-
paths:
10-
include:
11-
- infrastructure/*
5+
trigger: none
6+
pr: none
127

138
pool:
14-
#vmImage: ubuntu-latest
9+
# vmImage: ubuntu-latest
1510
name: private-pool-dev-uks
1611

1712
resources:
1813
repositories:
1914
- repository: dtos-devops-templates
2015
type: github
2116
name: NHSDigital/dtos-devops-templates
22-
ref: 8eac5e6ffc4ebc704880128b64a1a716b923c44a
17+
ref: 57e204e15509e40243551dccfe077f3452a31369
2318
endpoint: NHSDigital
2419

2520
variables:
2621
- group: DEV_core_backend
27-
- group: DEV_hub_backend_remote_state
2822
- group: DEV_audit_backend_remote_state
23+
- group: DEV_hub_backend_remote_state
2924
- name: TF_DIRECTORY
3025
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-core
3126
- name: TF_VERSION
@@ -40,7 +35,7 @@ stages:
4035
displayName: Terraform Plan
4136
condition: eq(variables['Build.Reason'], 'Manual')
4237
variables:
43-
tfvars: environments/$(ENVIRONMENT).tfvars
38+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
4439
jobs:
4540
- job: init_and_plan
4641
displayName: Init, plan, store artifact
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
3+
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r)
4+
5+
trigger: none
6+
pr: none
7+
8+
pool:
9+
# vmImage: ubuntu-latest
10+
name: private-pool-dev-uks
11+
12+
resources:
13+
repositories:
14+
- repository: dtos-devops-templates
15+
type: github
16+
name: NHSDigital/dtos-devops-templates
17+
ref: 57e204e15509e40243551dccfe077f3452a31369
18+
endpoint: NHSDigital
19+
20+
variables:
21+
- group: INT_audit_backend
22+
- group: DEV_hub_backend_remote_state
23+
- name: TF_DIRECTORY
24+
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-audit
25+
- name: TF_VERSION
26+
value: 1.9.2
27+
- name: TF_PLAN_ARTIFACT
28+
value: tf_plan_audit_INT
29+
- name: ENVIRONMENT
30+
value: integration
31+
32+
stages:
33+
- stage: terraform_plan
34+
displayName: Terraform Plan
35+
condition: eq(variables['Build.Reason'], 'Manual')
36+
variables:
37+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
38+
jobs:
39+
- job: init_and_plan
40+
displayName: Init, plan, store artifact
41+
steps:
42+
- checkout: self
43+
- checkout: dtos-devops-templates
44+
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates
45+
46+
- stage: terraform_apply
47+
displayName: Terraform Apply
48+
dependsOn: [terraform_plan]
49+
condition: and(eq(dependencies.terraform_plan.outputs['init_and_plan.TerraformPlan.changesPresent'], 'true'), eq(variables['Build.Reason'], 'Manual'))
50+
jobs:
51+
- deployment: terraform_apply
52+
displayName: Init, get plan artifact, apply
53+
environment: $(ENVIRONMENT)
54+
strategy:
55+
runOnce:
56+
deploy:
57+
steps:
58+
- checkout: self
59+
- checkout: dtos-devops-templates
60+
- template: .azuredevops/templates/steps/tf_apply.yaml@dtos-devops-templates
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
3+
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r)
4+
5+
trigger: none
6+
pr: none
7+
8+
pool:
9+
# vmImage: ubuntu-latest
10+
name: private-pool-dev-uks
11+
12+
resources:
13+
repositories:
14+
- repository: dtos-devops-templates
15+
type: github
16+
name: NHSDigital/dtos-devops-templates
17+
ref: 57e204e15509e40243551dccfe077f3452a31369
18+
endpoint: NHSDigital
19+
20+
variables:
21+
- group: INT_core_backend
22+
- group: INT_audit_backend_remote_state
23+
- group: DEV_hub_backend_remote_state
24+
- name: TF_DIRECTORY
25+
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-core
26+
- name: TF_VERSION
27+
value: 1.9.2
28+
- name: TF_PLAN_ARTIFACT
29+
value: tf_plan_core_INT
30+
- name: ENVIRONMENT
31+
value: integration
32+
33+
stages:
34+
- stage: terraform_plan
35+
displayName: Terraform Plan
36+
condition: eq(variables['Build.Reason'], 'Manual')
37+
variables:
38+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
39+
jobs:
40+
- job: init_and_plan
41+
displayName: Init, plan, store artifact
42+
steps:
43+
- checkout: self
44+
- checkout: dtos-devops-templates
45+
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates
46+
47+
- stage: terraform_apply
48+
displayName: Terraform Apply
49+
dependsOn: [terraform_plan]
50+
condition: and(eq(dependencies.terraform_plan.outputs['init_and_plan.TerraformPlan.changesPresent'], 'true'), eq(variables['Build.Reason'], 'Manual'))
51+
jobs:
52+
- deployment: terraform_apply
53+
displayName: Init, get plan artifact, apply
54+
environment: $(ENVIRONMENT)
55+
strategy:
56+
runOnce:
57+
deploy:
58+
steps:
59+
- checkout: self
60+
- checkout: dtos-devops-templates
61+
- template: .azuredevops/templates/steps/tf_apply.yaml@dtos-devops-templates
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
3+
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r)
4+
5+
trigger: none
6+
pr: none
7+
8+
pool:
9+
# vmImage: ubuntu-latest
10+
name: private-pool-dev-uks
11+
12+
resources:
13+
repositories:
14+
- repository: dtos-devops-templates
15+
type: github
16+
name: NHSDigital/dtos-devops-templates
17+
ref: 57e204e15509e40243551dccfe077f3452a31369
18+
endpoint: NHSDigital
19+
20+
variables:
21+
- group: NFT_audit_backend
22+
- group: DEV_hub_backend_remote_state
23+
- name: TF_DIRECTORY
24+
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-audit
25+
- name: TF_VERSION
26+
value: 1.9.2
27+
- name: TF_PLAN_ARTIFACT
28+
value: tf_plan_audit_NFT
29+
- name: ENVIRONMENT
30+
value: nft
31+
32+
stages:
33+
- stage: terraform_plan
34+
displayName: Terraform Plan
35+
condition: eq(variables['Build.Reason'], 'Manual')
36+
variables:
37+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
38+
jobs:
39+
- job: init_and_plan
40+
displayName: Init, plan, store artifact
41+
steps:
42+
- checkout: self
43+
- checkout: dtos-devops-templates
44+
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates
45+
46+
- stage: terraform_apply
47+
displayName: Terraform Apply
48+
dependsOn: [terraform_plan]
49+
condition: and(eq(dependencies.terraform_plan.outputs['init_and_plan.TerraformPlan.changesPresent'], 'true'), eq(variables['Build.Reason'], 'Manual'))
50+
jobs:
51+
- deployment: terraform_apply
52+
displayName: Init, get plan artifact, apply
53+
environment: $(ENVIRONMENT)
54+
strategy:
55+
runOnce:
56+
deploy:
57+
steps:
58+
- checkout: self
59+
- checkout: dtos-devops-templates
60+
- template: .azuredevops/templates/steps/tf_apply.yaml@dtos-devops-templates
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
3+
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r)
4+
5+
trigger: none
6+
pr: none
7+
8+
pool:
9+
# vmImage: ubuntu-latest
10+
name: private-pool-dev-uks
11+
12+
resources:
13+
repositories:
14+
- repository: dtos-devops-templates
15+
type: github
16+
name: NHSDigital/dtos-devops-templates
17+
ref: 57e204e15509e40243551dccfe077f3452a31369
18+
endpoint: NHSDigital
19+
20+
variables:
21+
- group: NFT_core_backend
22+
- group: NFT_audit_backend_remote_state
23+
- group: DEV_hub_backend_remote_state
24+
- name: TF_DIRECTORY
25+
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-core
26+
- name: TF_VERSION
27+
value: 1.9.2
28+
- name: TF_PLAN_ARTIFACT
29+
value: tf_plan_core_NFT
30+
- name: ENVIRONMENT
31+
value: nft
32+
33+
stages:
34+
- stage: terraform_plan
35+
displayName: Terraform Plan
36+
condition: eq(variables['Build.Reason'], 'Manual')
37+
variables:
38+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
39+
jobs:
40+
- job: init_and_plan
41+
displayName: Init, plan, store artifact
42+
steps:
43+
- checkout: self
44+
- checkout: dtos-devops-templates
45+
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates
46+
47+
- stage: terraform_apply
48+
displayName: Terraform Apply
49+
dependsOn: [terraform_plan]
50+
condition: and(eq(dependencies.terraform_plan.outputs['init_and_plan.TerraformPlan.changesPresent'], 'true'), eq(variables['Build.Reason'], 'Manual'))
51+
jobs:
52+
- deployment: terraform_apply
53+
displayName: Init, get plan artifact, apply
54+
environment: $(ENVIRONMENT)
55+
strategy:
56+
runOnce:
57+
deploy:
58+
steps:
59+
- checkout: self
60+
- checkout: dtos-devops-templates
61+
- template: .azuredevops/templates/steps/tf_apply.yaml@dtos-devops-templates

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,21 @@ jobs:
9292
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
9393
version: "${{ needs.metadata.outputs.version }}"
9494
secrets: inherit
95-
build-stage: # Recommended maximum execution time is 3 minutes
95+
build-image-stage: # Recommended maximum execution time is 3 minutes
9696
name: Image build stage
9797
needs: [metadata, commit-stage, test-stage]
9898
uses: NHSDigital/dtos-devops-templates/.github/workflows/stage-3-build-images.yaml@main
99-
if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
99+
if: needs.metadata.outputs.does_pull_request_exist == 'true' || github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
100100
with:
101-
docker_compose_file_path: .
102-
environment_tag: "${{ needs.metadata.outputs.environment_tag }}"
101+
docker_compose_file: ./compose.yml
102+
excluded_containers_csv_list: azurite,azurite-setup,db,end-to-end-tests
103+
environment_tag: ${{ needs.metadata.outputs.environment_tag }}
103104
function_app_source_code_path: src
104105
project_name: communication-management
105106
secrets: inherit
106107
acceptance-stage: # Recommended maximum execution time is 10 minutes
107108
name: "Acceptance stage"
108-
needs: [metadata, build-stage]
109+
needs: [metadata, build-image-stage]
109110
uses: ./.github/workflows/stage-4-acceptance.yaml
110111
if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
111112
with:

infrastructure/tf-audit/data.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data "terraform_remote_state" "hub" {
66
subscription_id = var.HUB_SUBSCRIPTION_ID
77
storage_account_name = var.HUB_BACKEND_AZURE_STORAGE_ACCOUNT_NAME
88
container_name = var.HUB_BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME
9-
key = var.HUB_BACKEND_AZURE_STORAGE_KEY
9+
key = var.HUB_BACKEND_AZURE_STORAGE_ACCOUNT_KEY
1010
resource_group_name = var.HUB_BACKEND_AZURE_RESOURCE_GROUP_NAME
1111
}
1212
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
application = "commgt"
2+
application_full_name = "communication-management"
3+
environment = "INT"
4+
5+
features = {
6+
private_endpoints_enabled = true
7+
private_service_connection_is_manual = false
8+
public_network_access_enabled = false
9+
}
10+
11+
tags = {
12+
Project = "Communication-Management"
13+
}
14+
15+
regions = {
16+
uksouth = {
17+
is_primary_region = true
18+
address_space = "10.112.0.0/16"
19+
connect_peering = true
20+
subnets = {
21+
pep = {
22+
cidr_newbits = 8
23+
cidr_offset = 1
24+
}
25+
}
26+
}
27+
}
28+
29+
app_insights = {
30+
appinsights_type = "web"
31+
}
32+
33+
law = {
34+
law_sku = "PerGB2018"
35+
retention_days = 30
36+
}

0 commit comments

Comments
 (0)