简体   繁体   中英

When testing ARM templates, what is the difference between using --what-if and deploymentMode: 'Validate'?

I'm creating a GitHub actions workflow that tests a bicep file for deploying Azure resources. While looking into template testing, I saw two different versions to use:

1.

- uses: azure/arm-deploy@v1
    with:
      scope: subscription
      template: main.bicep
      additionalArguments: "--what-if"
- uses: azure/arm-deploy@v1
    with:
      scope: subscription
      template: main.bicep
      deploymentMode: 'Validate'

Here is the link to arm-deploy docs: https://github.com/marketplace/actions/deploy-azure-resource-manager-arm-template

I tried using both of the versions but want to understand if one of these is enough. I assume one is a subset of the other, but can't seem to find the answer which one is more comprehensive. Any input would be appreciated.

Bicep 'validate' checks the Bicep code for compilation errors, ie validates that the code is correct in terms of syntax and dependencies. A runtime error can still be encountered, regardless of whether the validation succeeds or not.

A 'what-if' gives a complete readout of your templates changes, should it be deployed. As such it is both a validation and a printout of your changes.

For our deployments, we only use validate to stop any syntax errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM