terraform/website/docs/backends/types/azurerm.html.md

64 lines
1.9 KiB
Markdown
Raw Normal View History

2017-02-15 19:47:30 +01:00
---
2017-02-15 21:19:38 +01:00
layout: "backend-types"
page_title: "Backend Type: azurerm"
sidebar_current: "docs-backends-types-standard-azurerm"
2017-02-15 19:47:30 +01:00
description: |-
2017-02-15 21:19:38 +01:00
Terraform can store state remotely in Azure Storage.
2017-02-15 19:47:30 +01:00
---
# azurerm
2017-02-15 19:47:30 +01:00
**Kind: Standard (with state locking)**
2017-02-15 19:47:30 +01:00
2017-02-15 21:19:38 +01:00
Stores the state as a given key in a given bucket on [Microsoft Azure Storage](https://azure.microsoft.com/en-us/documentation/articles/storage-introduction/).
2017-02-15 19:47:30 +01:00
2017-02-15 21:19:38 +01:00
## Example Configuration
2017-02-15 19:47:30 +01:00
2017-02-15 21:19:38 +01:00
```hcl
terraform {
backend "azurerm" {
2017-02-15 21:19:38 +01:00
storage_account_name = "abcd1234"
container_name = "tfstate"
key = "prod.terraform.tfstate"
}
}
2017-02-15 19:47:30 +01:00
```
2017-02-15 21:19:38 +01:00
Note that for the access credentials we recommend using a
[partial configuration](/docs/backends/config.html).
2017-02-15 19:47:30 +01:00
## Example Referencing
```hcl
data "terraform_remote_state" "foo" {
backend = "azurerm"
2017-02-15 19:47:30 +01:00
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 account
* `container_name` - (Required) The name of the container to use within the storage account
* `key` - (Required) The key where to place/look for state file inside the container
* `access_key` / `ARM_ACCESS_KEY` - (Optional) Storage account access key
* `environment` / `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.
* `subscription_id` / `ARM_SUBSCRIPTION_ID` - The Azure Subscription ID.
* `client_id` / `ARM_CLIENT_ID` - The Azure Client ID.
* `client_secret` / `ARM_CLIENT_SECRET` - The Azure Client Secret.
* `tenant_id` / `ARM_TENANT_ID` - The Azure Tenant ID.