File tree Expand file tree Collapse file tree
samples/aci-blob-storage/python/terraform Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
9799echo " Initializing Terraform..."
98100terraform 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
101108echo " Planning Terraform deployment..."
102109terraform plan -out=tfplan \
You can’t perform that action at this time.
0 commit comments