forked from microsoft/MLOpsPython
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iac-create-environment-pipeline-tf.yml
72 lines (64 loc) · 2.54 KB
/
iac-create-environment-pipeline-tf.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# CI/PR Pipeline that deploys an TF template to create or update the resources needed by the other pipelines.
trigger:
branches:
include:
- master
paths:
include:
- environment_setup/tf-templates/*
pr:
branches:
include:
- master
paths:
include:
- environment_setup/tf-templates/*
pool:
vmImage: 'ubuntu-latest'
variables:
- group: devopsforai-aml-vg
steps:
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-installer.TerraformInstaller@0
displayName: 'Use Terraform 0.12.24'
inputs:
terraformVersion: 0.12.24
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-cli.TerraformCLI@0
displayName: 'TF init - Deploy MLOps resources to Azure'
inputs:
command: init
commandOptions: '-backend=true -backend-config=$(Build.SourcesDirectory)/environment_setup/tf-templates/backend.tf'
workingDirectory: '$(Build.SourcesDirectory)/environment_setup/tf-templates'
backendType: azurerm
backendServiceArm: $(AZURE_RM_SVC_CONNECTION)
ensureBackend: true
backendAzureRmResourceGroupLocation: $(LOCATION)
backendAzureRmResourceGroupName: $(RESOURCE_GROUP)
backendAzureRmStorageAccountName: '$(BASE_NAME)statestor'
backendAzureRmStorageAccountSku: 'Standard_LRS'
backendAzureRmContainerName: 'tfstate-cont'
backendAzureRmKey: 'mlopsinfra.tfstate'
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-cli.TerraformCLI@0
displayName: 'TF validate - Deploy MLOps resources to Azure'
inputs:
command: validate
workingDirectory: '$(Build.SourcesDirectory)/environment_setup/tf-templates'
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-cli.TerraformCLI@0
displayName: 'TF plan - Deploy MLOps resources to Azure'
inputs:
command: plan
workingDirectory: '$(Build.SourcesDirectory)/environment_setup/tf-templates'
environmentServiceName: $(AZURE_RM_SVC_CONNECTION)
env:
TF_VAR_BASE_NAME: $(BASE_NAME)
TF_VAR_RESOURCE_GROUP: $(RESOURCE_GROUP)
TF_VAR_WORKSPACE_NAME: $(WORKSPACE_NAME)
- task: charleszipp.azure-pipelines-tasks-terraform.azure-pipelines-tasks-terraform-cli.TerraformCLI@0
displayName: 'TF apply - Deploy MLOps resources to Azure'
inputs:
command: apply
workingDirectory: '$(Build.SourcesDirectory)/environment_setup/tf-templates'
environmentServiceName: $(AZURE_RM_SVC_CONNECTION)
env:
TF_VAR_BASE_NAME: $(BASE_NAME)
TF_VAR_RESOURCE_GROUP: $(RESOURCE_GROUP)
TF_VAR_WORKSPACE_NAME: $(WORKSPACE_NAME)