Skip to content

Commit a976efb

Browse files
authored
fix: Terraform Provider Updates (#975)
* terraform provider updates * Remove NemsMeshRetrieval App Service Plan * Update Pre Prod environment * DevTest becomes Sandbox * Update sandbox from dev * Minor updates * Update PreProd scaling to match current deployment * Fix scaling
1 parent 459a2b3 commit a976efb

16 files changed

+1461
-188
lines changed

.azuredevops/pipelines/acr-image-promote-to-devtest.yaml renamed to .azuredevops/pipelines/acr-image-promote-to-sandbox.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ stages:
2424
name: private-pool-dev-uks
2525
displayName: Apply database changes
2626
variables:
27-
- group: DEVTEST_core_backend
28-
- group: DEVTEST_image_pipelines
27+
- group: SBX_core_backend
28+
- group: SBX_image_pipelines
2929
steps:
3030
- checkout: self
3131
- checkout: dtos-devops-templates
@@ -41,8 +41,8 @@ stages:
4141
name: private-pool-dev-uks
4242
displayName: Deploy Docker images to function apps
4343
variables:
44-
- group: DEVTEST_core_backend
45-
- group: DEVTEST_image_pipelines
44+
- group: SBX_core_backend
45+
- group: SBX_image_pipelines
4646
steps:
4747
- template: .azuredevops/templates/steps/deploy-images-from-acr.yaml@dtos-devops-templates
4848
parameters:
@@ -51,7 +51,7 @@ stages:
5151
- stage: post_deployment_tests_stage
5252
displayName: Post-deployment tests
5353
variables:
54-
- group: DEVTEST_automation_testing_pipeline
54+
- group: SBX_automation_testing_pipeline
5555
jobs:
5656
- job: post_deployment_tests
5757
displayName: Run post-deployment tests

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ resources:
1313
- repository: dtos-devops-templates
1414
type: github
1515
name: NHSDigital/dtos-devops-templates
16-
ref: 2f8731f9c7d6b9d53b7044979e381377b2c85bcd
16+
ref: c00889236a258a52a2f3131272427ce81d4da951
1717
endpoint: NHSDigital
1818

1919
variables:
2020
- group: DEV_core_backend
2121
- group: DEV_audit_backend_remote_state
2222
- group: DEV_hub_backend_remote_state
2323
- name: TF_VERSION
24-
value: 1.9.2
24+
value: 1.11.4
2525
- name: TF_PLAN_ARTIFACT
2626
value: tf_plan_core_DEV
2727
- name: TF_DIRECTORY

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

Lines changed: 0 additions & 59 deletions
This file was deleted.

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

Lines changed: 0 additions & 60 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ resources:
1313
- repository: dtos-devops-templates
1414
type: github
1515
name: NHSDigital/dtos-devops-templates
16-
ref: 2f8731f9c7d6b9d53b7044979e381377b2c85bcd
16+
ref: c00889236a258a52a2f3131272427ce81d4da951
1717
endpoint: NHSDigital
1818

1919
variables:
2020
- group: INT_core_backend
2121
- group: INT_audit_backend_remote_state
2222
- group: DEV_hub_backend_remote_state
2323
- name: TF_VERSION
24-
value: 1.9.2
24+
value: 1.11.4
2525
- name: TF_PLAN_ARTIFACT
2626
value: tf_plan_core_INT
2727
- name: TF_DIRECTORY

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ resources:
1313
- repository: dtos-devops-templates
1414
type: github
1515
name: NHSDigital/dtos-devops-templates
16-
ref: 2f8731f9c7d6b9d53b7044979e381377b2c85bcd
16+
ref: c00889236a258a52a2f3131272427ce81d4da951
1717
endpoint: NHSDigital
1818

1919
variables:
2020
- group: NFT_core_backend
2121
- group: NFT_audit_backend_remote_state
2222
- group: DEV_hub_backend_remote_state
2323
- name: TF_VERSION
24-
value: 1.9.2
24+
value: 1.11.4
2525
- name: TF_PLAN_ARTIFACT
2626
value: tf_plan_core_NFT
2727
- name: TF_DIRECTORY

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resources:
1313
- repository: dtos-devops-templates
1414
type: github
1515
name: NHSDigital/dtos-devops-templates
16-
ref: 2f8731f9c7d6b9d53b7044979e381377b2c85bcd
16+
ref: c00889236a258a52a2f3131272427ce81d4da951
1717
endpoint: NHSDigital
1818

1919
variables:
@@ -23,7 +23,7 @@ variables:
2323
- name: TF_DIRECTORY
2424
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-core
2525
- name: TF_VERSION
26-
value: 1.9.2
26+
value: 1.11.4
2727
- name: TF_PLAN_ARTIFACT
2828
value: tf_plan_core_PRE
2929
- name: ENVIRONMENT
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
3+
name: $(Build.SourceBranchName)-$(Date:yyyyMMdd)_$(Rev:r)
4+
trigger: none
5+
pr: none
6+
7+
pool:
8+
#vmImage: ubuntu-latest
9+
name: private-pool-dev-uks
10+
11+
resources:
12+
repositories:
13+
- repository: dtos-devops-templates
14+
type: github
15+
name: NHSDigital/dtos-devops-templates
16+
ref: c00889236a258a52a2f3131272427ce81d4da951
17+
endpoint: NHSDigital
18+
19+
parameters:
20+
- name: pipelineAction
21+
displayName: 'Pipeline Action'
22+
type: string
23+
values:
24+
- 'PlanOnly'
25+
- 'Apply'
26+
- 'Destroy'
27+
default: 'Apply'
28+
29+
variables:
30+
- group: SBX_core_backend
31+
- group: SBX_audit_backend_remote_state
32+
- group: DEV_hub_backend_remote_state
33+
- name: TF_VERSION
34+
value: 1.11.4
35+
- name: TF_PLAN_ARTIFACT
36+
value: tf_plan_core_SANDBOX
37+
- name: TF_DIRECTORY
38+
value: $(System.DefaultWorkingDirectory)/$(System.TeamProject)/infrastructure/tf-core
39+
- name: ENVIRONMENT
40+
value: sandbox
41+
42+
stages:
43+
- stage: terraform_plan
44+
displayName: Terraform Plan
45+
condition: and(in('${{ parameters.pipelineAction }}', 'Apply', 'PlanOnly'), eq(variables['Build.Reason'], 'Manual'))
46+
variables:
47+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
48+
jobs:
49+
- job: init_and_plan
50+
displayName: Init, plan, store artifact
51+
steps:
52+
- checkout: self
53+
- checkout: dtos-devops-templates
54+
- template: .azuredevops/templates/steps/tf_plan.yaml@dtos-devops-templates
55+
56+
- stage: terraform_apply
57+
displayName: Terraform Apply
58+
dependsOn: [terraform_plan]
59+
condition: and(eq('${{ parameters.pipelineAction }}', 'Apply'), eq(dependencies.terraform_plan.outputs['init_and_plan.TerraformPlan.changesPresent'], 'true'), eq(variables['Build.Reason'], 'Manual'))
60+
jobs:
61+
- deployment: terraform_apply
62+
displayName: Init, get plan artifact, apply
63+
environment: $(ENVIRONMENT)
64+
strategy:
65+
runOnce:
66+
deploy:
67+
steps:
68+
- checkout: self
69+
- checkout: dtos-devops-templates
70+
- template: .azuredevops/templates/steps/tf_apply.yaml@dtos-devops-templates
71+
72+
- stage: terraform_destroy
73+
displayName: Terraform Destroy
74+
condition: and(eq('${{ parameters.pipelineAction }}', 'Destroy'), eq(variables['Build.Reason'], 'Manual'))
75+
variables:
76+
tfVarsFile: environments/$(ENVIRONMENT).tfvars
77+
jobs:
78+
- deployment: terraform_destroy
79+
displayName: Terraform Destroy
80+
environment: $(ENVIRONMENT)
81+
strategy:
82+
runOnce:
83+
deploy:
84+
steps:
85+
- checkout: self
86+
- checkout: dtos-devops-templates
87+
- template: .azuredevops/templates/steps/tf_destroy.yaml@dtos-devops-templates
88+
89+
# - task: AzureCLI@2
90+
# displayName: Clean-up Backend
91+
# inputs:
92+
# azureSubscription: $(SERVICE_CONNECTION)
93+
# scriptLocation: inlineScript
94+
# scriptType: bash
95+
# workingDirectory: $(tfExecutionDir)
96+
# inlineScript: |
97+
# # Check if the backend configuration file exists and if it does, delete it:
98+
# container_exists=$(az storage container exists --name $(BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME) --account-name $(BACKEND_AZURE_STORAGE_ACCOUNT_NAME) --auth-mode login --output tsv)
99+
# if [ "$container_exists" == "True" ]; then
100+
# echo "##[debug] Container $(BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME) exists, deleting it..."
101+
# az storage container delete --name $(BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME) --account-name $(BACKEND_AZURE_STORAGE_ACCOUNT_NAME) --auth-mode login
102+
# else
103+
# echo "##[debug] Container $(BACKEND_AZURE_STORAGE_ACCOUNT_CONTAINER_NAME) does not exist."
104+
# fi

infrastructure/tf-core/data.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ data "azurerm_user_assigned_identity" "acr_mi" {
6262
data "azurerm_application_insights" "ai" {
6363
provider = azurerm.audit
6464

65-
name = var.function_apps.app_insights_name
66-
resource_group_name = var.function_apps.app_insights_rg_name
65+
name = data.terraform_remote_state.audit.outputs.application_insights.name
66+
resource_group_name = data.terraform_remote_state.audit.outputs.application_insights.resource_group_name
6767
}

0 commit comments

Comments
 (0)