Skip to content

Commit

Permalink
update outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jan 8, 2024
1 parent c32136e commit 6316b4f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions acmpca-eks-cert-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ This shows the module call with how you would use it.
| <a name="output_certificate_chain"></a> [certificate\_chain](#output\_certificate\_chain) | PEM format for certificate chain (issuer through root) |
| <a name="output_certificate_csr"></a> [certificate\_csr](#output\_certificate\_csr) | PEM format Certificate Signing Request |
| <a name="output_certificate_key"></a> [certificate\_key](#output\_certificate\_key) | PEM format RSA Key |
| <a name="output_certificate_tls_crt"></a> [certificate\_tls\_crt](#output\_certificate\_tls\_crt) | Base64 encoding of PEM format of certificate and chain for cert-manager tls.crt |
| <a name="output_certificate_tls_key"></a> [certificate\_tls\_key](#output\_certificate\_tls\_key) | Base64 encoding of PEM format RSA Key for cert-manager tls.key |
<!-- END_TF_DOCS -->
25 changes: 21 additions & 4 deletions acmpca-eks-cert-manager/output.tf
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 6316b4f

Please sign in to comment.