mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-01-26 06:00:17 -05:00
Also fixed tests failing auth caused by getStorageAccountAccessKey returning the key name rather than the value TF_ACC= go test ./state/remote -v -run=TestAz -timeout=10m -parallel=4 === RUN TestAzureClient_impl --- PASS: TestAzureClient_impl (0.00s) === RUN TestAzureClient 2016/11/18 13:57:34 [DEBUG] New state was assigned lineage "96037426-f95e-45c3-9183-6c39b49f590b" 2016/11/18 13:57:34 [TRACE] Preserving existing state lineage "96037426-f95e-45c3-9183-6c39b49f590b" --- PASS: TestAzureClient (130.60s) === RUN TestAzureClientEmptyLease 2016/11/18 13:59:44 [DEBUG] New state was assigned lineage "d9997445-1ebf-4b2c-b4df-15ae152f6417" 2016/11/18 13:59:44 [TRACE] Preserving existing state lineage "d9997445-1ebf-4b2c-b4df-15ae152f6417" --- PASS: TestAzureClientEmptyLease (128.15s) === RUN TestAzureClientLease 2016/11/18 14:01:55 [DEBUG] New state was assigned lineage "85912a12-2e0e-464c-9886-8add39ea3a87" 2016/11/18 14:01:55 [TRACE] Preserving existing state lineage "85912a12-2e0e-464c-9886-8add39ea3a87" --- PASS: TestAzureClientLease (138.09s) PASS ok github.com/hashicorp/terraform/state/remote 397.111s
1.6 KiB
1.6 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| remotestate | Remote State Backend: azure | docs-state-remote-azure | Terraform can store the state remotely, making it easier to version and work with in a team. |
azure
Stores the state as a given key in a given bucket on Microsoft Azure Storage.
-> Note: Passing credentials directly via config options will
make them included in cleartext inside the persisted state.
Access key should, ideally, be passed using the environment variable
ARM_ACCESS_KEY to follow this convention.
Example Usage
terraform remote config \
-backend=azure \
-backend-config="storage_account_name=terraform123abc" \
-backend-config="container_name=terraform-state" \
-backend-config="key=prod.terraform.tfstate"
Example Referencing
# setup remote state data source
data "terraform_remote_state" "foo" {
backend = "azure"
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- (Required) Storage account access keylease_id/ARM_LEASE_ID- (Optional) If set, will be used when writing to storage blob.