This template issues a certificate using AWS Certificate Manager Private Certificate Authority (ACM PCA) with a validity of one year.

Terraform Template

resource "aws_acmpca_certificate" "example" {
  certificate_authority_arn = aws_acmpca_certificate_authority.example.arn
  certificate_signing_request = tls_cert_request.csr.cert_request_pem
  signing_algorithm = "SHA256WITHRSA"

  validity {
    type = "YEARS"
    value = 1
  }
}

resource "aws_acmpca_certificate_authority" "example" {

  certificate_authority_configuration {
    key_algorithm = "RSA_4096"
    signing_algorithm = "SHA512WITHRSA"

    subject {
      common_name = "example.com"
    }
  }
  permanent_deletion_time_in_days = 7
}

resource "tls_cert_request" "csr" {
}

resource "tls_private_key" "key" {
}