Extract attributes from certificate.pem file?

is it possible to extract the expiry date from certificate.pem file in terraform

Hi @smartaquarius10,

Terraform itself does not have any built-in support for reading or writing TLS certificates, but this sort of thing can potentially be handled by providers.

The hashicorp/tls provider has a data source tls_certificate which seems like it might help you to achieve your goal. I believe the not_after attribute of its result is effectively the certificate’s expiration time.

1 Like