terraform-aws-mcaf-certificate

Terraform module to manage certificates in AWS Certificate Manager

APACHE-2.0 License

Stars
0
Committers
3

terraform-aws-mcaf-certificate

Terraform module to manage certificates in AWS Certificate Manager.

Usage

DNS validation with Route 53

This module supports creating validation records in zones hosted in the same account as the certificate and for zones hosted in a different account. To support this use case, an additional provider needs to be passed to the module as shown below.

Creating a certificate using a local Route 53 zone for validation

provider "aws" {}

data "aws_route53_zone" "selected" {
  name = "myzone.com."
}

module "certificate" {
  source  = "schubergphilis/mcaf-certificate/aws"

  providers = { aws.route53 = aws }

  common_name = "www.myzone.com"
  zone_id     = data.aws_route53_zone.selected.zone_id
}

Creating a certificate using a remote Route 53 zone for validation

provider "aws" {}

provider "aws" {
  alias = "route53"
  // Configuration for the remote account
  // ...
}

data "aws_route53_zone" "selected" {
  name = "myzone.com."
}

module "certificate" {
  source  = "schubergphilis/mcaf-certificate/aws"

  providers = { aws.route53 = aws.route53 }

  common_name = "www.myzone.com"
  zone_id     = data.aws_route53_zone.selected.zone_id
}

Requirements

Name Version
terraform >= 1.7
aws ~> 5.0

Providers

Name Version
aws ~> 5.0
aws.route53 ~> 5.0

Modules

No modules.

Resources

Name Type
aws_acm_certificate.default resource
aws_route53_record.default resource

Inputs

Name Description Type Default Required
common_name Certificate common name string n/a yes
zone_id Route53 Zone ID to create validation records in string n/a yes
subject_alternative_names List of Subject Alternative Names (SANs) to include in the certificate list(string) null no
tags Map of tags to add to resources map(string) null no

Outputs

Name Description
arn Certificate ARN
domain_name Domain name for which the certificate is issued
id Certificate ID
not_after Expiration date and time of the certificate
not_before Start of the validity period of the certificate
status Status of the certificate

License

Copyright: Schuberg Philis

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Related Projects