From 48f48cd930f394acbfea6076442ee0e4499e8e4c Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 25 Aug 2023 20:09:35 +0000 Subject: [PATCH] feat: use small Terraform configuration for experimenting --- experiment/experiment-pipeline.yml | 14 ++++---------- experiment/main.tf | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 experiment/main.tf diff --git a/experiment/experiment-pipeline.yml b/experiment/experiment-pipeline.yml index 86a9264c..7d4ceea3 100644 --- a/experiment/experiment-pipeline.yml +++ b/experiment/experiment-pipeline.yml @@ -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 diff --git a/experiment/main.tf b/experiment/main.tf new file mode 100644 index 00000000..08148352 --- /dev/null +++ b/experiment/main.tf @@ -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" +}