Skip to content

Write-only attribute support for TLS managed resources #645

@JonasNuvibit

Description

@JonasNuvibit

Terraform CLI and Provider Versions

terraform >= 1.10
tls provider: v4.1.0 (to be relased) https://github.com/hashicorp/terraform-provider-tls/milestone/8
Tested with open PR: #637 #637
https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/self_signed_cert

Use Cases or Problem Statement

With ephemeral resources comming to the provider, write-only attribute support should be added to the existing resources.

While testing the ephemeral.tls_private_key feature I noticed that the tls_cert_request does not support the ephemeral key as private_key_pem attribute.

This impacts the following resources:

  • tls_cert_request
  • tls_locally_signed_cert
  • tls_self_signed_cert

Proposal

Write-only attribute support (private_key_pem) for the following resources:

  • tls_cert_request
  • tls_locally_signed_cert
  • tls_self_signed_cert

How much impact is this issue causing?

High

Additional Information

To reproduce

# The private key is generated using ephemeraltls provider
ephemeral "ephemeraltls_private_key" "key" {
  algorithm = "RSA"
  rsa_bits  = 4096
}

resource "tls_cert_request" "csr" {
  private_key_pem = ephemeral.ephemeraltls_private_key.key.private_key_pem
  subject {
    common_name = "foo-bar"
  }
}

Error message

Error: Invalid use of ephemeral value

Ephemeral values are not valid for "private_key_pem", because it is not a
write-only attribute and must be persisted to state.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions