diff --git a/environment_setup/iac-create-environment-pipeline-tf.yml b/environment_setup/iac-create-environment-pipeline-tf.yml index ef184546..008db4c3 100644 --- a/environment_setup/iac-create-environment-pipeline-tf.yml +++ b/environment_setup/iac-create-environment-pipeline-tf.yml @@ -1,72 +1,36 @@ -# CI/PR Pipeline that deploys an TF template to create or update the resources needed by the other pipelines. +# CI/PR Pipeline that deploys an ARM template to create or update the resources needed by the other pipelines. trigger: branches: include: - - master + - master paths: include: - - environment_setup/tf-templates/* + - environment_setup/arm-templates/* pr: branches: include: - - master + - master paths: include: - - environment_setup/tf-templates/* + - environment_setup/arm-templates/* pool: - vmImage: 'ubuntu-latest' + vmImage: "ubuntu-latest" variables: -- group: devopsforai-aml-vg + - group: devopsforai-aml-vg + - name: WORKSPACE_SKU # https://docs.microsoft.com/en-us/azure/machine-learning/overview-what-is-azure-ml#sku + value: basic 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) - + - task: AzureResourceGroupDeployment@2 + inputs: + azureSubscription: "$(AZURE_RM_SVC_CONNECTION)" + action: "Create Or Update Resource Group" + resourceGroupName: "$(RESOURCE_GROUP)" + location: $(LOCATION) + templateLocation: "Linked artifact" + csmFile: "$(Build.SourcesDirectory)/environment_setup/arm-templates/cloud-environment.json" + overrideParameters: "-baseName $(BASE_NAME) -location $(LOCATION) -workspace $(WORKSPACE_NAME) -sku $(WORKSPACE_SKU)" + deploymentMode: "Incremental" + displayName: "Deploy MLOps resources to Azure" \ No newline at end of file