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

Add provider argument: ca_cert_bytes #1565

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions internal/provider/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,15 @@ func NewProviderMeta(d *schema.ResourceData) (interface{}, error) {
clientAuthKey = clientAuth["key_file"].(string)
}

caCertBytes := []byte("")
if d.Get("ca_cert_bytes").(string) != "" {
caCertBytes = []byte(d.Get("ca_cert_bytes").(string))
}

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

Expand Down
6 changes: 6 additions & 0 deletions vault/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ func Provider() *schema.Provider {
DefaultFunc: schema.EnvDefaultFunc("VAULT_CAPATH", ""),
Description: "Path to directory containing CA certificate files to validate the server's certificate.",
},
"ca_cert_bytes": {
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("VAULT_CACERT_BYTES", ""),
Description: "CA certificate PEM string to validate the server's certificate.",
},
"auth_login": {
Type: schema.TypeList,
Optional: true,
Expand Down
4 changes: 4 additions & 0 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ variables in order to keep credential information out of the configuration.
the certificate presented by the Vault server. May be set via the
`VAULT_CAPATH` environment variable.

* `ca_cert_bytes` - (Optional) PEM-encoded string that will be used to validate
the certificate presented by the Vault server. May be set via the
`VAULT_CACERT_BYTES` environment variable.

* `auth_login` - (Optional) A configuration block, described below, that
attempts to authenticate using the `auth/<method>/login` path to
acquire a token which Terraform will use. Terraform still issues itself
Expand Down