Bridge any gaps in the Terraform AzureRM provider (and the Go SDK for Azure) with the Terraform AzAPI provider.
One of the arguments against using Terraform is that it sometimes lags behind ARM templates or Bicep in terms of supporting all Azure resources and being up to date with new and preview functionality.
A look at the changelogs (3.x, 2.x) for the azurerm provider repo shows the amount of work that goes in for new resources, enhancements and big fixes. Many of the most used resources are very actively updated to make sure that the gap is negligible. However, a scan of the requested enhancements quickly shows that there may always be some gaps for certain services or features.
The release of the new AzAPI provider gives new options to bridge those gaps.
There are two resources:
The resources drive the Azure REST API.
You should be familiar with the REST API before using AzApi.
You will time travel a little in these labs as we move through time to emulate a real world example. You are using Terraform for your infrastructure as code on Azure and have been asked by the developer group whether you can provision the new Azure Web PubSub service.
Here is the timeline for the lab scenario.
|2021-04-29||Azure Web PubSub in Public Preview|
|2021-08-02||Developers start testing the preview functionality|
|2021-11-16||Azure Web PubSub goes GA|
|2021-12-06||Developers ask to include Web PubSub in the Terraform config|
|2022-01-28||azurerm v2.94: new resource
|2022-02-07||Switch to native support for the resource|
|2022-02-14||Asked to add system assigned managed identity|
|2022-02-21||Switch to native support for the managed identity|
Using the REST API
Work out how to create a Web PubSub resource with the REST API before trying to use the Terraform AzAPI provider.
Add an azapi_resource block into your Terraform config to create the Web PubSub resource.
How do you safely remove an azapi_resource block and switch to a native resource without creating issues with your Terraform state?
Add an azapi_update_resource block into your Terraform config to configure properties that are not yet supported in the azurerm provider.
Data sources and outputs
Learn how to use the azapi_resource data source and the response_export_values to access additional information.
Safely remove an azapi_update_resource block once the property is supported in the azurerm provider.