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.
»
r 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"
»
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.
»
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.
»
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.