1

I am trying to use my organisation cert in my terraform code here.

crt.tf

resource "aws_iam_server_certificate" "acm_crt" {
    name = "acm_crt"
    certificate_body = "s3://cicd-storage/csr_keys_crts/crt.txt"
    private_key = "s3://cicd-storage/csr_keys_crts/csr.pem"
}

Error: Error applying plan:

1 error(s) occurred:

  • aws_iam_server_certificate.acm_crt: 1 error(s) occurred:

  • aws_iam_server_certificate.acm_crt: Error uploading server certificate, error: MalformedCertificate: Unable to parse certificate. Please ensure the certificate is in PEM format.

asur
  • 1,759
  • 7
  • 38
  • 81
  • What makes you think you can specify an S3 path? – ydaetskcoR Jun 08 '19 at 18:08
  • @ydaetskcoR S3 would be lil secured instead keeping certs under files.. – asur Jun 10 '19 at 08:41
  • Yes but the resource doesn't allow you to specify an S3 path like that. You must reference either the plain text directly in the resource or use the `file()` function to specify the contents of a local file. – ydaetskcoR Jun 10 '19 at 08:44
  • @ydaetskcoR Could you suggest any better solution instead of `file()` – asur Jun 10 '19 at 09:33
  • No because there aren't any better options unfortunately. – ydaetskcoR Jun 10 '19 at 10:11
  • Also you should probably be using ACM to upload server certificates instead of the deprecated IAM server certificates. It still doesn't allow you to specify a certificate and key pair in S3 though. – ydaetskcoR Jun 10 '19 at 10:13

0 Answers0