Skip to content

Commit

Permalink
backend/azure: Source config from environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
omar committed Feb 22, 2019
1 parent a462d2e commit db9ee50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions backend/remote-state/azure/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions website/docs/backends/types/azurerm.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down

0 comments on commit db9ee50

Please sign in to comment.