Skip to content

Commit

Permalink
Added error if only one of client_certificate_pem and client_private_…
Browse files Browse the repository at this point in the history
…key_pem are set.
  • Loading branch information
scr-oath committed Dec 8, 2022
1 parent daa4d85 commit 231c24f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/backend/remote-state/http/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ func (b *Backend) configureTLS(client *retryablehttp.Client, data *schema.Resour
if !skipCertVerification && clientCACertificatePem == "" && clientCertificatePem == "" && clientPrivateKeyPem == "" {
return nil
}
if clientCertificatePem != "" && clientPrivateKeyPem == "" {
return fmt.Errorf("client_certificate_pem is set but client_private_key_pem is not")
}
if clientPrivateKeyPem != "" && clientCertificatePem == "" {
return fmt.Errorf("client_private_key_pem is set but client_certificate_pem is not")
}

// TLS configuration is needed; create an object and configure it
var tlsConfig tls.Config
Expand Down

0 comments on commit 231c24f

Please sign in to comment.