From 09e0a4b123a7412c5b19da4926dd615d314a8c7b Mon Sep 17 00:00:00 2001 From: Brett McHargue Date: Fri, 6 Oct 2023 16:36:49 +0100 Subject: [PATCH] Add terraform import --- .github/workflows/tf-azure-deploy.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tf-azure-deploy.yml b/.github/workflows/tf-azure-deploy.yml index 4b2ee25f9..372adbdbe 100644 --- a/.github/workflows/tf-azure-deploy.yml +++ b/.github/workflows/tf-azure-deploy.yml @@ -82,13 +82,13 @@ jobs: run: | export exitcode=0 terraform plan -detailed-exitcode -no-color -out tfplan || export exitcode=$? - + echo "exitcode=$exitcode" >> $GITHUB_OUTPUT - + if [ $exitcode -eq 1 ]; then echo Terraform Plan Failed! exit 1 - else + else exit 0 fi @@ -104,7 +104,7 @@ jobs: id: tf-plan-string run: | TERRAFORM_PLAN=$(terraform show -no-color tfplan) - + delimiter="$(openssl rand -hex 8)" echo "summary<<${delimiter}" >> $GITHUB_OUTPUT echo "## Terraform Plan Output" >> $GITHUB_OUTPUT @@ -162,6 +162,11 @@ jobs: jq 'with_entries(.key |= ascii_downcase)' tmp-secrets.json > web-secrets.auto.tfvars.json jq 'with_entries(.key |= ascii_downcase)' tmp-vars.json > web-vars.auto.tfvars.json + - name: Terraform import + id: tf-import + run: > + terraform import azurerm_resource_group.rg /subscriptions/***/resourceGroups/s195d01-hfeyp-rg + # Download saved plan from artifacts - name: Download Terraform Plan uses: actions/download-artifact@v3 @@ -171,4 +176,4 @@ jobs: # Terraform Apply - name: Terraform Apply - run: terraform apply -auto-approve tfplan/tfplan \ No newline at end of file + run: terraform apply -auto-approve tfplan/tfplan