Skip to content

Commit

Permalink
feat: use small Terraform configuration for experimenting
Browse files Browse the repository at this point in the history
  • Loading branch information
angela-tran committed Aug 25, 2023
1 parent 2d6fe09 commit 48f48cd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
14 changes: 4 additions & 10 deletions experiment/experiment-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,30 @@ stages:
terraformVersion: 1.3.1
# https://github.com/microsoft/azure-pipelines-terraform/tree/main/Tasks/TerraformTask/TerraformTaskV3#readme
- task: TerraformTaskV3@3
# - task: Bash@3
displayName: Terraform init
inputs:
provider: azurerm
command: init
workingDirectory: "$(System.DefaultWorkingDirectory)/terraform"
workingDirectory: "$(System.DefaultWorkingDirectory)/experiment"
# https://developer.hashicorp.com/terraform/tutorials/automation/automate-terraform#automated-terraform-cli-workflow
commandOptions: -input=false
# service connection
backendServiceArm: compiler-deployer
# needs to match main.tf
backendAzureRmResourceGroupName: courtesy-cards-eligibility-terraform
backendAzureRmStorageAccountName: courtesycardsterraform
backendAzureRmResourceGroupName: experiment-terraform
backendAzureRmStorageAccountName: experimentterraform
backendAzureRmContainerName: tfstate
backendAzureRmKey: terraform.tfstate
# targetType: inline
# script: echo "terraform init"
- task: TerraformTaskV3@3
# - task: Bash@3
displayName: Select environment
inputs:
provider: azurerm
command: custom
customCommand: workspace
commandOptions: select $(workspace)
workingDirectory: "$(System.DefaultWorkingDirectory)/terraform"
workingDirectory: "$(System.DefaultWorkingDirectory)/experiment"
# service connection
environmentServiceNameAzureRM: compiler-deployer
# targetType: inline
# script: echo $(workspace)
# - task: TerraformTaskV3@3
- task: Bash@3
displayName: Terraform plan
Expand Down
29 changes: 29 additions & 0 deletions experiment/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
terraform {
// see version in experiment-pipeline.yml
required_version = ">= 1.1.0"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.0.0, < 4.0.0"
}
}

backend "azurerm" {
# needs to match experiment-pipeline.yml
resource_group_name = "experiment-terraform"
storage_account_name = "experimentterraform"
container_name = "tfstate"
key = "terraform.tfstate"
}

}

provider "azurerm" {
features {}
}

resource "azurerm_resource_group" "rg" {
name = "myTFResourceGroup"
location = "westus2"
}

0 comments on commit 48f48cd

Please sign in to comment.