Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for namespaces #262

Merged
merged 1 commit into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions vault/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ func Provider() terraform.ResourceProvider {

Description: "Maximum TTL for secret leases requested by this provider",
},
"namespace": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("VAULT_NAMESPACE", ""),
Description: "The namespace to use. Available only for Vault Enterprise",
},
},

ConfigureFunc: providerConfigure,
Expand Down Expand Up @@ -196,6 +202,11 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
return nil, errors.New("no vault token found")
}

namespace := d.Get("namespace").(string)
if namespace != "" {
client.SetNamespace(namespace)
}

// In order to enforce our relatively-short lease TTL, we derive a
// temporary child token that inherits all of the policies of the
// token we were given but expires after max_lease_ttl_seconds.
Expand Down
3 changes: 3 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ variables in order to keep credential information out of the configuration.
See the section above on *Using Vault credentials in Terraform configuration*
for the implications of this setting.

* `namespace` - (Optional) Set the namespace to use. May be set via the
`VAULT_NAMESPACE` environment variable. *Available only for Vault Enterprise*.

The `client_auth` configuration block accepts the following arguments:

* `cert_file` - (Required) Path to a file on local disk that contains the
Expand Down