Skip to content

Commit

Permalink
support for VAULT_TLS_SERVER_NAME (#1145)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Ash <32777270+benashz@users.noreply.github.com>
  • Loading branch information
greut and benashz committed Apr 20, 2022
1 parent 57cb9b9 commit 837b143
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 10 additions & 3 deletions vault/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ func Provider() *schema.Provider {
DefaultFunc: schema.EnvDefaultFunc("VAULT_SKIP_VERIFY", false),
Description: "Set this to true only if the target Vault server is an insecure development instance.",
},
"tls_server_name": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc(api.EnvVaultTLSServerName, ""),
Description: "Name to use as the SNI host when connecting via TLS.",
},
"max_lease_ttl_seconds": {
Type: schema.TypeInt,
Optional: true,
Expand Down Expand Up @@ -808,9 +814,10 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
}

err := clientConfig.ConfigureTLS(&api.TLSConfig{
CACert: d.Get("ca_cert_file").(string),
CAPath: d.Get("ca_cert_dir").(string),
Insecure: d.Get("skip_tls_verify").(bool),
CACert: d.Get("ca_cert_file").(string),
CAPath: d.Get("ca_cert_dir").(string),
Insecure: d.Get("skip_tls_verify").(bool),
TLSServerName: d.Get("tls_server_name").(string),

ClientCert: clientAuthCert,
ClientKey: clientAuthKey,
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 @@ -142,6 +142,9 @@ variables in order to keep credential information out of the configuration.
that Terraform can be tricked into writing secrets to a server controlled
by an intruder. May be set via the `VAULT_SKIP_VERIFY` environment variable.

* `tls_server_name` - (Optional) Name to use as the SNI host when connecting
via TLS. May be set via the `VAULT_TLS_SERVER_NAME` environment variable.

* `skip_child_token` - (Optional) Set this to `true` to disable
creation of an intermediate ephemeral Vault token for Terraform to
use. Enabling this is strongly discouraged since it increases
Expand Down

0 comments on commit 837b143

Please sign in to comment.