From db9ee50adac5e3cc24653e8af76615367a1f15a2 Mon Sep 17 00:00:00 2001 From: Omar Khudeira Date: Thu, 21 Feb 2019 21:13:01 -0600 Subject: [PATCH] backend/azure: Source config from environment variables --- backend/remote-state/azure/backend.go | 3 +++ website/docs/backends/types/azurerm.html.md | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/remote-state/azure/backend.go b/backend/remote-state/azure/backend.go index a2135c44196a..ebb5247e922f 100644 --- a/backend/remote-state/azure/backend.go +++ b/backend/remote-state/azure/backend.go @@ -16,18 +16,21 @@ func New() backend.Backend { Type: schema.TypeString, Required: true, Description: "The name of the storage account.", + DefaultFunc: schema.EnvDefaultFunc("ARM_STORAGE_ACCOUNT_NAME", nil), }, "container_name": { Type: schema.TypeString, Required: true, Description: "The container name.", + DefaultFunc: schema.EnvDefaultFunc("ARM_STORAGE_CONTAINER_NAME", nil), }, "key": { Type: schema.TypeString, Required: true, Description: "The blob key.", + DefaultFunc: schema.EnvDefaultFunc("ARM_STORAGE_BLOB_KEY", nil), }, "environment": { diff --git a/website/docs/backends/types/azurerm.html.md b/website/docs/backends/types/azurerm.html.md index 76caa26b7a5c..48bc8724cd1c 100644 --- a/website/docs/backends/types/azurerm.html.md +++ b/website/docs/backends/types/azurerm.html.md @@ -145,11 +145,11 @@ data "terraform_remote_state" "foo" { The following configuration options are supported: -* `storage_account_name` - (Required) The Name of [the Storage Account](https://www.terraform.io/docs/providers/azurerm/r/storage_account.html). +* `storage_account_name` - (Required) The Name of [the Storage Account](https://www.terraform.io/docs/providers/azurerm/r/storage_account.html). This can also be sourced from the `ARM_STORAGE_ACCOUNT_NAME` environment variable. -* `container_name` - (Required) The Name of [the Storage Container](https://www.terraform.io/docs/providers/azurerm/r/storage_container.html) within the Storage Account. +* `container_name` - (Required) The Name of [the Storage Container](https://www.terraform.io/docs/providers/azurerm/r/storage_container.html) within the Storage Account. This can also be sourced from the `ARM_STORAGE_CONTAINER_NAME` environment variable. -* `key` - (Required) The name of the Blob used to retrieve/store Terraform's State file inside the Storage Container. +* `key` - (Required) The name of the Blob used to retrieve/store Terraform's State file inside the Storage Container. When using workspaces, the workspace state blob key will be prefixed with this value. This can also be sourced from the `ARM_STORAGE_BLOB_KEY` environment variable. * `environment` - (Optional) The Azure Environment which should be used. This can also be sourced from the `ARM_ENVIRONMENT` environment variable. Possible values are `public`, `china`, `german`, `stack` and `usgovernment`. Defaults to `public`.