This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import datetime | |
import hashlib | |
import hmac | |
import base64 | |
#Retrieve your Log Analytics Workspace ID from your Key Vault Databricks Secret Scope | |
wks_id = dbutils.secrets.get(scope = "keyvault_scope", key = "wks-id-logaw1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Set the terraform backend | |
terraform { | |
backend "local" {} #Using a local backend just for the demo, the reco is to use a remote backend, see : https://jamesdld.github.io/terraform/Best-Practice/BestPractice-1/ | |
} | |
#Set the Provider | |
provider "azurerm" { | |
tenant_id = var.tenant_id | |
subscription_id = var.subscription_id | |
client_id = var.client_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- stage: Deliver | |
dependsOn: Deploy | |
jobs: | |
# track deployments on the environment | |
- deployment: Terraform_Destroy | |
displayName: Terraform Destroy - Script ok, now deleting the resources | |
pool: | |
vmImage: $(vmImageName) | |
environment: "Terraform_Destroy" | |
strategy: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- stage: Deploy | |
dependsOn: Build | |
jobs: | |
# track deployments on the environment | |
- deployment: Terraform_Apply | |
displayName: Terraform Apply - Resources creation | |
pool: | |
vmImage: $(vmImageName) | |
environment: "Terraform_Apply" | |
strategy: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- stage: Build | |
jobs: | |
- job: Terraform_Plan | |
displayName: Terraform Plan - Publish a package if Infrastructure changes are identified | |
continueOnError: false | |
pool: | |
vmImage: $(vmImageName) | |
steps: | |
- task: DownloadSecureFile@1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Multi-stage YAML pipeline demo. | |
name: $(BuildDefinitionName).$(DayOfYear)$(Rev:.r) | |
variables: | |
- name: terraform_version | |
value: "0.12.13" | |
- name: vmImageName | |
value: "ubuntu-latest" | |
- name: backend_main_secret_file_id1 # secret id located in your Azure DevOps library, file used by the following cmdlet Terraform init, plan, apply and destroy | |
value: "backend-main-jdld-1.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Multi-stage YAML pipeline demo. | |
name: $(BuildDefinitionName).$(DayOfYear)$(Rev:.r) | |
variables: | |
- group: terraform_binary # variable group containing Terraform information like the Terraform version (like terraform_version) | |
- name: vmImageName | |
value: 'ubuntu-latest' | |
- name: backend_main_secret_file_id1 # secret file used by the following cmdlet Terraform init, plan, apply and destroy | |
value: 'backend-main-jdld-1.json' | |
- name: ArtifactName |
NewerOlder