|
| 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 |
0 commit comments