Skip to content

Commit aa33170

Browse files
committed
terraform fix
1 parent 6a4c45d commit aa33170

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • samples/aci-blob-storage/python/terraform

samples/aci-blob-storage/python/terraform/deploy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,16 @@ echo "Image pushed to ACR successfully."
9494
# Terraform init, plan, and apply
9595
# =============================================================================
9696

97+
TF_VARS="-var prefix=$PREFIX -var suffix=$SUFFIX -var location=$LOCATION -var image_name=$IMAGE_NAME -var image_tag=$IMAGE_TAG"
98+
9799
echo "Initializing Terraform..."
98100
terraform init -upgrade
99101

102+
# Import the resource group and ACR that were pre-created for the image push
103+
echo "Importing pre-created resources into Terraform state..."
104+
terraform import $TF_VARS azurerm_resource_group.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/${RESOURCE_GROUP_NAME}" 2>/dev/null || true
105+
terraform import $TF_VARS azurerm_container_registry.example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/${RESOURCE_GROUP_NAME}/providers/Microsoft.ContainerRegistry/registries/${ACR_NAME}" 2>/dev/null || true
106+
100107
# Run terraform plan and check for errors
101108
echo "Planning Terraform deployment..."
102109
terraform plan -out=tfplan \

0 commit comments

Comments
 (0)