Introduction
Microsoft's Azure Services in the Preview stage can, sometimes take a while to be added to its stable API and SDK - which the Terraform AzureRM provider depends on, but as an early adopter, you might like to launch those services using Terraform.
For example, if you'd like to use userAssigned identities in the azurerm_search_service
resource, you'll find that the feature isn't available yet in the AzureRM provider (at this time of writing) because it is currently in Azure Preview status; and since the AzureRM provider mostly tracks the Azure stable API, the service would need to be in GA status and added to the Azure API (by Microsoft) before we can enable it in the AzureRM provider for first class support.
SO, if the feature isn't available in the AzureRM provider, how can we still use Terraform to provision the resource?
Procedure
We can do so by deploying the service's equivalent Azure ARM template in a resource group. You can do that in the new azurerm_resource_group_template_deployment
resource -- which will also track any additional resources created for you in a terraform destroy situation.
In keeping up with our azurerm_search_service
resource example, the equivalent Azure ARM template can be found here.
NOTE: There are 2 other options for deploying Azure Preview Services, using the Microsoft Bicep platform or the Microsoft's AzAPI provider, but since those are 3rd party solutions (& not offically supported by HashiCorp), we are not covering them in this article.
* Please also note that to use Azure services in Preview stage, you need to have accepted the Supplemental Terms of Use for Microsoft Azure Previews agreement on your Azure account.