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

Updating doc for PEM fields that underlying Golang libraries append a \n to #198

Merged
merged 1 commit into from
May 3, 2022
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
4 changes: 2 additions & 2 deletions docs/data-sources/public_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ data "tls_public_key" "private_key_openssh-example" {
- `id` (String) Unique identifier for this data source: hexadecimal representation of the SHA1 checksum of the data source.
- `public_key_fingerprint_md5` (String) The fingerprint of the public key data in OpenSSH MD5 hash format, e.g. `aa:bb:cc:...`. Only available if the selected private key format is compatible, as per the rules for `public_key_openssh` and [ECDSA P224 limitations](../../docs#limitations).
- `public_key_fingerprint_sha256` (String) The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g. `SHA256:...`. Only available if the selected private key format is compatible, as per the rules for `public_key_openssh` and [ECDSA P224 limitations](../../docs#limitations).
- `public_key_openssh` (String) The public key, in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format. This is also known as ['Authorized Keys'](https://www.ssh.com/academy/ssh/authorized_keys/openssh#format-of-the-authorized-keys-file) format. This is populated only if the configured private key is supported: this includes all `RSA` and `ED25519` keys, as well as `ECDSA` keys with curves `P256`, `P384` and `P521`; `ECDSA` with curve `P224` [is not supported](../../docs#limitations).
- `public_key_pem` (String) The public key, in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.
- `public_key_openssh` (String) The public key, in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format. This is also known as ['Authorized Keys'](https://www.ssh.com/academy/ssh/authorized_keys/openssh#format-of-the-authorized-keys-file) format. This is populated only if the configured private key is supported: this includes all `RSA` and `ED25519` keys, as well as `ECDSA` keys with curves `P256`, `P384` and `P521`; `ECDSA` with curve `P224` [is not supported](../../docs#limitations). **NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) [libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this value append a `\n` at the end of the PEM. In case this disrupts your use case, we recommend using [`trimspace()`](https://www.terraform.io/language/functions/trimspace).
- `public_key_pem` (String) The public key, in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. **NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) [libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this value append a `\n` at the end of the PEM. In case this disrupts your use case, we recommend using [`trimspace()`](https://www.terraform.io/language/functions/trimspace).


2 changes: 1 addition & 1 deletion docs/resources/cert_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ resource "tls_cert_request" "example" {

### Read-Only

- `cert_request_pem` (String) The certificate request data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.
- `cert_request_pem` (String) The certificate request data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. **NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) [libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this value append a `\n` at the end of the PEM. In case this disrupts your use case, we recommend using [`trimspace()`](https://www.terraform.io/language/functions/trimspace).
- `id` (String) Unique identifier for this resource: hexadecimal representation of the SHA1 checksum of the resource.

<a id="nestedblock--subject"></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/locally_signed_cert.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "tls_locally_signed_cert" "example" {

### Read-Only

- `cert_pem` (String) Certificate data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.
- `cert_pem` (String) Certificate data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. **NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) [libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this value append a `\n` at the end of the PEM. In case this disrupts your use case, we recommend using [`trimspace()`](https://www.terraform.io/language/functions/trimspace).
- `id` (String) Unique identifier for this resource: the certificate serial number.
- `ready_for_renewal` (Boolean) Is the certificate either expired (i.e. beyond the `validity_period_hours`) or ready for an early renewal (i.e. within the `early_renewal_hours`)?
- `validity_end_time` (String) The time until which the certificate is invalid, expressed as an [RFC3339](https://tools.ietf.org/html/rfc3339) timestamp.
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/private_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ resource "tls_private_key" "ed25519-example" {
- `private_key_pem` (String, Sensitive) Private key data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.
- `public_key_fingerprint_md5` (String) The fingerprint of the public key data in OpenSSH MD5 hash format, e.g. `aa:bb:cc:...`. Only available if the selected private key format is compatible, similarly to `public_key_openssh` and the [ECDSA P224 limitations](../../docs#limitations).
- `public_key_fingerprint_sha256` (String) The fingerprint of the public key data in OpenSSH SHA256 hash format, e.g. `SHA256:...`. Only available if the selected private key format is compatible, similarly to `public_key_openssh` and the [ECDSA P224 limitations](../../docs#limitations).
- `public_key_openssh` (String) The public key data in ["Authorized Keys"](https://www.ssh.com/academy/ssh/authorized_keys/openssh#format-of-the-authorized-keys-file) format. This is populated only if the configured private key is supported: this includes all `RSA` and `ED25519` keys, as well as `ECDSA` keys with curves `P256`, `P384` and `P521`. `ECDSA` with curve `P224` [is not supported](../../docs#limitations).
- `public_key_pem` (String) Public key data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.
- `public_key_openssh` (String) The public key data in ["Authorized Keys"](https://www.ssh.com/academy/ssh/authorized_keys/openssh#format-of-the-authorized-keys-file) format. This is populated only if the configured private key is supported: this includes all `RSA` and `ED25519` keys, as well as `ECDSA` keys with curves `P256`, `P384` and `P521`. `ECDSA` with curve `P224` [is not supported](../../docs#limitations). **NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) [libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this value append a `\n` at the end of the PEM. In case this disrupts your use case, we recommend using [`trimspace()`](https://www.terraform.io/language/functions/trimspace).
- `public_key_pem` (String) Public key data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. **NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) [libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this value append a `\n` at the end of the PEM. In case this disrupts your use case, we recommend using [`trimspace()`](https://www.terraform.io/language/functions/trimspace).



Expand Down
2 changes: 1 addition & 1 deletion docs/resources/self_signed_cert.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ resource "tls_self_signed_cert" "example" {

### Read-Only

- `cert_pem` (String) Certificate data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.
- `cert_pem` (String) Certificate data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. **NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) [libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this value append a `\n` at the end of the PEM. In case this disrupts your use case, we recommend using [`trimspace()`](https://www.terraform.io/language/functions/trimspace).
- `id` (String) Unique identifier for this resource: the certificate serial number.
- `ready_for_renewal` (Boolean) Is the certificate either expired (i.e. beyond the `validity_period_hours`) or ready for an early renewal (i.e. within the `early_renewal_hours`)?
- `validity_end_time` (String) The time until which the certificate is invalid, expressed as an [RFC3339](https://tools.ietf.org/html/rfc3339) timestamp.
Expand Down
11 changes: 8 additions & 3 deletions internal/provider/common_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,14 @@ func setCertificateCommonSchema(s map[string]*schema.Schema) {
}

s["cert_pem"] = &schema.Schema{
Type: schema.TypeString,
Computed: true,
Description: "Certificate data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.",
Type: schema.TypeString,
Computed: true,
Description: "Certificate data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. " +
"**NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) " +
"[libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this " +
"value append a `\\n` at the end of the PEM. " +
"In case this disrupts your use case, we recommend using " +
"[`trimspace()`](https://www.terraform.io/language/functions/trimspace).",
}

s["ready_for_renewal"] = &schema.Schema{
Expand Down
18 changes: 14 additions & 4 deletions internal/provider/data_source_public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@ func dataSourcePublicKey() *schema.Resource {
},

"public_key_pem": {
Type: schema.TypeString,
Computed: true,
Description: "The public key, in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.",
Type: schema.TypeString,
Computed: true,
Description: "The public key, in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. " +
"**NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) " +
"[libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this " +
"value append a `\\n` at the end of the PEM. " +
"In case this disrupts your use case, we recommend using " +
"[`trimspace()`](https://www.terraform.io/language/functions/trimspace).",
},

"public_key_openssh": {
Expand All @@ -56,7 +61,12 @@ func dataSourcePublicKey() *schema.Resource {
Description: "The public key, in [OpenSSH PEM (RFC 4716)](https://datatracker.ietf.org/doc/html/rfc4716) format. " +
"This is also known as ['Authorized Keys'](https://www.ssh.com/academy/ssh/authorized_keys/openssh#format-of-the-authorized-keys-file) format. " +
"This is populated only if the configured private key is supported: this includes all `RSA` and `ED25519` keys, as well as `ECDSA` keys " +
"with curves `P256`, `P384` and `P521`; `ECDSA` with curve `P224` [is not supported](../../docs#limitations).",
"with curves `P256`, `P384` and `P521`; `ECDSA` with curve `P224` [is not supported](../../docs#limitations). " +
"**NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) " +
"[libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this " +
"value append a `\\n` at the end of the PEM. " +
"In case this disrupts your use case, we recommend using " +
"[`trimspace()`](https://www.terraform.io/language/functions/trimspace).",
},

"public_key_fingerprint_md5": {
Expand Down
7 changes: 6 additions & 1 deletion internal/provider/resource_cert_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ func resourceCertRequest() *schema.Resource {
Type: schema.TypeString,
Computed: true,
Description: "The certificate request data in " +
"[PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.",
"[PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. " +
"**NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) " +
"[libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this " +
"value append a `\\n` at the end of the PEM. " +
"In case this disrupts your use case, we recommend using " +
"[`trimspace()`](https://www.terraform.io/language/functions/trimspace).",
},

"id": {
Expand Down
18 changes: 14 additions & 4 deletions internal/provider/resource_private_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,14 @@ func resourcePrivateKey() *schema.Resource {
},

"public_key_pem": {
Type: schema.TypeString,
Computed: true,
Description: "Public key data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format.",
Type: schema.TypeString,
Computed: true,
Description: "Public key data in [PEM (RFC 1421)](https://datatracker.ietf.org/doc/html/rfc1421) format. " +
"**NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) " +
"[libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this " +
"value append a `\\n` at the end of the PEM. " +
"In case this disrupts your use case, we recommend using " +
"[`trimspace()`](https://www.terraform.io/language/functions/trimspace).",
},

"public_key_openssh": {
Expand All @@ -81,7 +86,12 @@ func resourcePrivateKey() *schema.Resource {
"[\"Authorized Keys\"](https://www.ssh.com/academy/ssh/authorized_keys/openssh#format-of-the-authorized-keys-file) format. " +
"This is populated only if the configured private key is supported: " +
"this includes all `RSA` and `ED25519` keys, as well as `ECDSA` keys with curves " +
"`P256`, `P384` and `P521`. `ECDSA` with curve `P224` [is not supported](../../docs#limitations).",
"`P256`, `P384` and `P521`. `ECDSA` with curve `P224` [is not supported](../../docs#limitations). " +
"**NOTE**: the [underlying](https://pkg.go.dev/encoding/pem#Encode) " +
"[libraries](https://pkg.go.dev/golang.org/x/crypto/ssh#MarshalAuthorizedKey) that generate this " +
"value append a `\\n` at the end of the PEM. " +
"In case this disrupts your use case, we recommend using " +
"[`trimspace()`](https://www.terraform.io/language/functions/trimspace).",
},

"public_key_fingerprint_md5": {
Expand Down