Skip to content

Commit

Permalink
Fixed error in null resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Abby Artagame committed Nov 13, 2024
1 parent f0eeec0 commit 63d31dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/tf-plan-apply-destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
id: tf-plan
run: |
export exitcode=0
terraform plan -var-file='variables/dev.tfvars' -var "client_id=$ARM_CLIENT_ID" -var "tenant_id=$ARM_TENANT_ID" -var "subscription_id=$ARM_SUBSCRIPTION_ID" -detailed-exitcode -no-color -out terraform.tfplan || export exitcode=$?
terraform plan -var-file='variables/dev.tfvars' -detailed-exitcode -no-color -out terraform.tfplan || export exitcode=$?
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -164,6 +164,13 @@ jobs:
path: tf
name: tfplan

- name: Azure CLI Login
uses: azure/login@v2
with:
client-id: $ARM_CLIENT_ID
tenant-id: $ARM_TENANT_ID
subscription-id: $ARM_SUBSCRIPTION_ID

# Terraform Apply
- name: Terraform Apply
run: |
Expand Down Expand Up @@ -209,7 +216,7 @@ jobs:
id: tf-plan
run: |
export exitcode=0
terraform plan -destroy -var-file='variables/dev.tfvars' -var "client_id=$ARM_CLIENT_ID" -var "tenant_id=$ARM_TENANT_ID" -var "subscription_id=$ARM_SUBSCRIPTION_ID" -detailed-exitcode -no-color -out terraform.tfplan || export exitcode=$?
terraform plan -destroy -var-file='variables/dev.tfvars' -detailed-exitcode -no-color -out terraform.tfplan || export exitcode=$?
echo "exitcode=$exitcode" >> $GITHUB_OUTPUT
Expand Down
5 changes: 0 additions & 5 deletions tf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,6 @@ resource "null_resource" "build_image_template" {
# imageTemplateName = var.imageTemplateName
# }
provisioner "local-exec" {
environment = {
ARM_CLIENT_ID = var.client_id
ARM_TENANT_ID = var.tenant_id
ARM_SUBSCRIPTION_ID = var.subscription_id
}
command = <<EOT
az image builder run -n ${var.imageTemplateName} -g ${data.azurerm_resource_group.rg.name} --no-wait
az image builder wait -n ${var.imageTemplateName} -g ${data.azurerm_resource_group.rg.name} --custom "lastRunStatus.runState!='Running'"
Expand Down
12 changes: 0 additions & 12 deletions tf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,4 @@ variable "imageTemplateName" {

variable "devBoxPoolName" {
type = string
}

variable "client_id" {
type = string
}

variable "tenant_id" {
type = string
}

variable "subscription_id" {
type = string
}

0 comments on commit 63d31dd

Please sign in to comment.