Today, we are announcing the general availability of the HashiCorp Terraform AzureRM provider 4.0. This version includes new capabilities to improve the extensibility and flexibility of the provider: provider-defined functions and improved resource provider registration. Initially launched in April 2024, provider-defined functions allow anyone in the Terraform community to build custom functions within providers to extend the capabilities of Terraform.
This post reviews the details and benefits of this new major version of the provider and also covers a handful of new features released this year.
»
Since the provider’s last major release in March 2022, we’ve added support for some 340 resources and 120 data sources, bringing the totals to more than 1,101 resources and almost 360 data sources as of mid-August, 2024. As the Terraform AzureRM provider download count tops 660 million, Microsoft and HashiCorp continue to develop new, innovative integrations that further ease the cloud adoption journey for enterprise organizations. This year we focused on improving the user experience for practitioners by adding new services to the AzureRM provider including:
»Provider-defined functions
The normalise_resource_id
function attempts to normalize the case-sensitive system segments of a resource ID as required by the Azure APIs:.
output "test" {
value = provider::azurerm::normalise_resource_id("/Subscriptions/12345678-1234-9876-4563-123456789012/ResourceGroups/resGroup1/PROVIDERS/microsoft.apimanagement/service/service1/gateWays/gateway1/hostnameconfigurations/config1")
}
Â
# Result: /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ApiManagement/service/service1/gateways/gateway1/hostnameConfigurations/config1
The parse_resource_id
function takes an Azure resource ID and splits it into its component parts:
locals {
parsed_id = provider::azurerm::parse_resource_id("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ApiManagement/service/service1/gateways/gateway1/hostnameConfigurations/config1")
}
Â
output "resource_group_name" {
value = local.parsed_id["resource_group_name"]
}
Â
output "resource_name" {
value = local.parsed_id["resource_name"]
}
Â
# Result:
# Outputs:
#
# resource_group_name = "resGroup1"
# resource_name = "config1"
»
Previously, the AzureRM provider took an all-or-nothing approach to Azure resource provider registration, where the Terraform provider would either attempt to register a fixed set of 68 providers upon initialization or registration could be skipped entirely by setting skip_provider_registration = true
in the provider block. This limitation didn’t match Microsoft’s recommendations, which is to register resource providers only as needed to enable the services you’re actively using. With the addition of two new feature flags, resource_provider_registrations and resource_providers_to_register, users now have more control over which providers to automatically register or whether to continue managing a subscription’s resource provider registrations outside of Terraform.
»
Since the last major release, the AzureRM provider has accumulated resources and properties that have been deprecated, renamed, or are no longer supported by Azure. As version 4.0 is a major release, we have removed a number of resources and data sources that have been deprecated over the course of the provider’s lifetime. A complete list of behavior changes and removed properties can be found in the AzureRM provider 4.0 upgrade guide.
»
The latest version of the AzureRM provider is available today. These features and enhancements will help simplify configurations and improve the overall experience of using the provider. Because this release introduces breaking changes, we recommend pinning your provider version to protect against unexpected results. For a complete list of the changes in 4.0, please review the AzureRM provider upgrade guide.
Please share any bugs or enhancement requests with us via GitHub issues. We are thankful to our partners and community members for their valuable contributions to the HashiCorp Terraform ecosystem.