terraform-provider-aws
terraform-provider-aws copied to clipboard
[Bug]: aws_acm_certificate error "certificate field contains more than one certificate"
Terraform Core Version
1.6.6
AWS Provider Version
5.49.0
Affected Resource(s)
aws_acm_certificate resource is provided either a single line escaped string, or a file()
call to a pem encoded certificate, returns the following error when importing a certificate:
api error ValidationException: The certificate field contains more than one certificate. You can specify only one certificate in this field.
This error is also returned when private_key
and certificate_body
are both empty strings, denoting a deeper issue afoot.
Expected Behavior
The ACM Certificate should be imported int AWS ACM.
Actual Behavior
An error stating I've provided multiple certificates when I have not.
Relevant Error/Panic Output Snippet
2024-05-15T15:11:46.359Z [ERROR] vertex "aws_acm_certificate.cert" error: importing ACM Certificate: operation error ACM: ImportCertificate, https response error StatusCode: 400, RequestID: 0ed51563-f2bf-40b7-9277-2f655896912d, api error ValidationException: The certificate field contains more than one certificate. You can specify only one certificate in this field.
This is the only error in the debug, its coming back from AWS but I'm wondering how its getting to AWS improperly.
Terraform Configuration Files
resource "aws_acm_certificate" "cert" {
private_key = var.private_key
certificate_body = var.certificate_body
certificate_chain = var.certificate_chain
}
have also attempted writing them to files like so:
resource "aws_acm_certificate" "cert" {
private_key = file("./key.pem")
certificate_body = file("./cert.pem")
certificate_chain = file("./chain.pem")
}
Steps to Reproduce
Import an SSL certificate via the aws_acm_certificate resource
Debug Output
2024-05-15T15:11:46.359Z [ERROR] vertex "aws_acm_certificate.cert" error: importing ACM Certificate: operation error ACM: ImportCertificate, https response error StatusCode: 400, RequestID: 0ed51563-f2bf-40b7-9277-2f655896912d, api error ValidationException: The certificate field contains more than one certificate. You can specify only one certificate in this field.
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None