Click on each book below to review & buy on Amazon.
As an Amazon Associate, I earn from qualifying purchases.
Terraform Providers - AzureRM
Guide to using the AzureRM Terraform provider.
This guide was written when version 3.52.0 was the latest azurerm provider version.
Purpose
To configure infrastructure in Microsoft Azure using the Azure Resource Manager API's.
Install
To install the azurerm provider, it needs including within the main terraform configuration block, under required_providers.
The main Terraform configuration block is typically found in main.tf.
The local name is azurerm.
The source address is hashicorp/azurerm.
The version is optional, however it is recommended.
See Terraform Version Constraints for version configuration.
terraform {
required_providers {
# Local name
azurerm = {
# Source address (global identifier)
source = "hashicorp/azurerm"
# Version Constraints
version = ">=3.52.0, <3.53"
}
}
required_version = ">=1.4.5, <1.5.0"
}
Configuration
To configure the AzureRM provider, a provider block is used.
Arguments
features
The only required argument is the features block, which can be left empty if the defaults are being used.
provider "azurerm" {
features {}
}
Below is how the provider block would look when specifiying all features default settings.
provider "azurerm" {
features {
api_management {
purge_soft_delete_on_destroy = true
recover_soft_deleted = true
}
app_configuration {
purge_soft_delete_on_destroy = true
recover_soft_deleted = true
}
application_insights {
disable_generated_rule = false
}
cognitive_account {
purge_soft_delete_on_destroy = true
}
key_vault {
purge_soft_delete_on_destroy = true
recover_soft_deleted_key_vaults = true
}
log_analytics_workspace {
permanently_delete_on_destroy = true
}
managed_disk {
expand_without_downtime = true
}
resource_group {
prevent_deletion_if_contains_resources = true
}
template_deployment {
delete_nested_items_during_deletion = true
}
virtual_machine {
delete_os_disk_on_deletion = true
graceful_shutdown = false
skip_shutdown_and_force_delete = false
}
virtual_machine_scale_set {
force_delete = false
roll_instances_when_required = true
scale_to_zero_before_deletion = true
}
}
}
subscription_id
The subscription_id argument can be useful to ensure that Terraform runs against the right subscription.
You can find you Azure subscription ID's by following runbook Azure - View Subscriptions
provider "azurerm" {
features {
resource_group {}
}
subscription_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Support DTV Linux
Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.
NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.