microsoft / commercial-marketplace-offer-deploy

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

Honor the deployment mode of the offer plan's technical configuration #506

Open bobjac opened 1 year ago

bobjac commented 1 year ago

Requirements

The deployment mode of the plan technical configuration should be honored down according to the capabilities of the deployment type.

manifest.json

Terraform

  1. Incremental Deployment (ARM) and Terraform:

    • This is the default behavior of Terraform.
    • When you run terraform apply, Terraform will create or update resources in your Azure environment to match your configuration. It won't delete resources that are not defined in your Terraform configuration, mimicking the Incremental deployment mode in ARM.
    • Terraform uses a state file to keep track of the resources it manages. If a resource exists in the state file but not in the configuration, it won't be automatically deleted.
  2. Complete Deployment (ARM) and Terraform:

    • Achieving a "complete" deployment behavior in Terraform requires some extra steps.
    • If you want Terraform to delete resources that are not in your configuration, you can use the -target flag to target specific resources or sets of resources. But this isn't exactly like ARM's complete mode because you have to specify what to target manually.
    • A more encompassing way is to maintain different state files for different sets of resources or environments. If you delete a resource from your configuration and run terraform apply, Terraform will notice the difference between the state file and your configuration and will delete the resource. This approach requires careful state management.
    • Another method is to entirely delete the Terraform state file and the associated resources, and then redeploy from scratch. This is a drastic measure and can be destructive.

Note: One key difference is that ARM's Complete mode is a built-in feature that automatically deletes any resources in the resource group that aren't in the template. Terraform doesn't have this behavior by default, and achieving it requires more deliberate management of your configurations and state.

For Terraform deployments with complete mode, the resource group may need to be wiped clean before executing a terraform apply against a new state file

Bicep

The deployment mode must be passed to the execution of the deploy.sh script. Example:

az deployment group create --mode Complete 

Implementation

References

Marketplace Portal UI

[docs for deployment mode](Reference: https://learn.microsoft.com/en-us/partner-center/marketplace/plan-azure-app-managed-app#deployment-mode)

kevinhillinger commented 1 year ago

Pending based on private preview results