diff --git a/acmpca-eks-cert-manager/README.md b/acmpca-eks-cert-manager/README.md index 49ce2b7..de7072c 100644 --- a/acmpca-eks-cert-manager/README.md +++ b/acmpca-eks-cert-manager/README.md @@ -62,4 +62,6 @@ This shows the module call with how you would use it. | [certificate\_chain](#output\_certificate\_chain) | PEM format for certificate chain (issuer through root) | | [certificate\_csr](#output\_certificate\_csr) | PEM format Certificate Signing Request | | [certificate\_key](#output\_certificate\_key) | PEM format RSA Key | +| [certificate\_tls\_crt](#output\_certificate\_tls\_crt) | Base64 encoding of PEM format of certificate and chain for cert-manager tls.crt | +| [certificate\_tls\_key](#output\_certificate\_tls\_key) | Base64 encoding of PEM format RSA Key for cert-manager tls.key | \ No newline at end of file diff --git a/acmpca-eks-cert-manager/output.tf b/acmpca-eks-cert-manager/output.tf index 77023e6..8a736c5 100644 --- a/acmpca-eks-cert-manager/output.tf +++ b/acmpca-eks-cert-manager/output.tf @@ -1,24 +1,41 @@ output "certificate_key" { description = "PEM format RSA Key" sensitive = true - value = tls_private_key.certificate.private_key_pem + value = module.certificate.certificate_key } output "certificate_csr" { description = "PEM format Certificate Signing Request" sensitive = false - value = tls_cert_request.certificate.cert_request_pem + value = module.certificate.certificate_csr } output "certificate" { description = "PEM format for signed certificate" sensitive = false - value = aws_acmpca_certificate.certificate.certificate + value = module.certificate.certificate } output "certificate_chain" { description = "PEM format for certificate chain (issuer through root)" sensitive = false - value = local.certificate_chain + value = module.certificate.certificate_chain } + +locals { + certificate_tls_key = base64encode(module.certificate.certificate_key) + certificate_chain = replace(module.certificate.certificate_chain, "/\r/", "") + certificate_crt = module.certificate.certificate + certificate_tls_crt = base64encode(join("\n", [local.certificate_crt, local.certificate_chain])) +} + +output "certificate_tls_key" { + description = "Base64 encoding of PEM format RSA Key for cert-manager tls.key" + value = local.certificate_tls_key +} + +output "certificate_tls_crt" { + description = "Base64 encoding of PEM format of certificate and chain for cert-manager tls.crt" + value = local.certificate_tls_crt +}