2.1 KiB
2.1 KiB
layout | page_title | sidebar_current | description |
---|---|---|---|
backend-types | Backend Type: azurerm | docs-backends-types-standard-azurerm | Terraform can store state remotely in Azure Blob Storage. |
azurerm (formerly azure)
Kind: Standard (with state locking)
Stores the state as a given key in a given blob container on Microsoft Azure Storage. This backend also supports state locking and consistency checking via native capabilities of Microsoft Azure Storage.
Example Configuration
terraform {
backend "azurerm" {
storage_account_name = "abcd1234"
container_name = "tfstate"
key = "prod.terraform.tfstate"
}
}
Note that for the access credentials we recommend using a partial configuration.
Example Referencing
data "terraform_remote_state" "foo" {
backend = "azurerm"
config {
storage_account_name = "terraform123abc"
container_name = "terraform-state"
key = "prod.terraform.tfstate"
}
}
Configuration variables
The following configuration options are supported:
storage_account_name
- (Required) The name of the storage accountcontainer_name
- (Required) The name of the container to use within the storage accountkey
- (Required) The key where to place/look for state file inside the containeraccess_key
/ARM_ACCESS_KEY
- (Optional) Storage account access keyenvironment
/ARM_ENVIRONMENT
- (Optional) The cloud environment to use. Supported values are:public
(default)usgovernment
german
china
The following configuration options must be supplied if access_key
is not.
resource_group_name
- The resource group which contains the storage account.arm_subscription_id
/ARM_SUBSCRIPTION_ID
- The Azure Subscription ID.arm_client_id
/ARM_CLIENT_ID
- The Azure Client ID.arm_client_secret
/ARM_CLIENT_SECRET
- The Azure Client Secret.arm_tenant_id
/ARM_TENANT_ID
- The Azure Tenant ID.