Skip to content

Commit 3242c03

Browse files
committed
CI/CD modifications
1 parent c8012e2 commit 3242c03

5 files changed

Lines changed: 27 additions & 3 deletions

File tree

.github/workflows/terraform-infra-apply.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ on:
88
jobs:
99
terraform:
1010
runs-on: ubuntu-latest
11+
if: contains(fromJson('["devsocket"]'), github.actor)
1112

1213
env:
1314
TF_VAR_db_admin_password: ${{ secrets.DB_ADMIN_PASSWORD }}
15+
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
16+
ARM_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
17+
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
18+
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
19+
1420

1521
steps:
1622
- name: Checkout code
@@ -27,6 +33,15 @@ jobs:
2733
uses: azure/login@v1
2834
with:
2935
creds: ${{ secrets.AZURE_CREDENTIALS }}
36+
# client-id: ${{ secrets.AZURE_CLIENT_ID }}
37+
# tenant-id: ${{ secrets.AZURE_TENANT_ID }}
38+
# subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
39+
40+
run: |
41+
# az account set --subscription "a6d4bb1c-5386-4a9a-af52-ef605eeea0b0"
42+
az group create --name "ecommerce-qa-rg" --location "East US" || true
43+
az storage account create --name "qatfstateaccount" --resource-group "ecommerce-qa-rg" --location "East US" --sku Standard_LRS || true
44+
az storage container create --name "qatfstate" --account-name "qatfstateaccount" || true
3045

3146
- name: Setup Terraform
3247
uses: hashicorp/setup-terraform@v2

.github/workflows/terraform-infra-destroy.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
jobs:
99
terraform-destroy:
1010
runs-on: ubuntu-latest
11+
if: contains(fromJson('["devsocket"]'), github.actor)
1112

1213
env:
1314
TF_VAR_db_admin_password: ${{ secrets.DB_ADMIN_PASSWORD }}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
terraform {
22
backend "azurerm" {
3-
resource_group_name = "tf-state-rg"
4-
storage_account_name = "tfstateaccount"
5-
container_name = "tfstate"
3+
resource_group_name = var.resource_group_name
4+
storage_account_name = var.storage_account_name
5+
container_name = var.container_name
66
key = "qa.terraform.tfstate"
77
}
88
}

terraform/environments/qa/terraform.tfvars

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ key_vault_name = "ecommerce-qa-kv"
55
event_hub_namespace_name = "ecommerce-qa-eh"
66
postgres_name = "ecommerce-qa-db"
77
db_admin_password = "SuperSecretPassword@123"
8+
storage_account_name = "qatfstateaccount"
9+
container_name = "qatfstate"
810
tags = {
911
environment = "qa"
1012
}

terraform/environments/qa/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ variable "key_vault_name" {}
55
variable "event_hub_namespace_name" {}
66
variable "postgres_name" {}
77
variable "db_admin_password" {}
8+
variable "storage_account_name" {
9+
default = "qatfstateaccount"
10+
}
11+
variable "container_name" {
12+
default = "qatfstate"
13+
}
814
variable "tags" {
915
type = map(string)
1016
default = {}

0 commit comments

Comments
 (0)