microsoft / commercial-marketplace-offer-deploy

Deployment Manager for the Azure Marketplace
Other
21 stars 13 forks source link

doc: Complex Terraform Redeploy Failure #669

Closed bobjac closed 2 months ago

bobjac commented 2 months ago

Summary

When executing a redeploy operation on the Terraform Complex sample, there is a failure due to the state name of the OS disk.

Reproduce

Deploy a complex terraform solution. Modify the "location" from eastus to eastus2 and execute a redeploy.

During the redeploy, there will be a failure because of the static dame of the os disk already belonging to the easy region.

The template containing the issue is located at https://github.com/microsoft/commercial-marketplace-offer-deploy/blob/main/build/managedapp/terraform/complex/templates/main.tf.

To Resolve

Create a dymamic name of the osdisk on the virtual machine. The line number should be 79.

bobjac commented 2 months ago

@JerryMSFT - you can just clone the repo then do the following:

  1. go to you local directory that corresponds to build/managedapp/terraform/complex/templates
  2. create a vars file called terraform.tfvars.json that has the following values: {"resourceGroupName":"[RESOURCEGROUP]","artifactsLocationSasToken":"","location":"eastus","sql_admin_password":"[PASSWORD]","sql_admin_username":"adminuser"}
  3. run the following commands:
    • terraform init -backend=false
    • terraform apply -auto-approve
  4. modify terraform.tfvars.json file so that it contains: {"resourceGroupName":"[RESOURCEGROUP]","artifactsLocationSasToken":"","location":"eastus2","sql_admin_password":"[PASSWORD]","sql_admin_username":"adminuser"}
  5. Re-run the following commands:
    • terraform init -backend=false
    • terraform apply -auto-approve

We want the re-deployment to succeed without error.

bobjac commented 2 months ago

This is resolved.