Skip to content

Module used to automate ACM creation, Route53 record creation, and certificate validation.

License

Notifications You must be signed in to change notification settings

StratusGrid/terraform-aws-acm-certificate-creation

Repository files navigation

Contact Us | Stratusphere FinOps | StratusGrid Home | Blog

terraform-aws-acm-certificate-creation

GitHub: StratusGrid/terraform-aws-terraform-aws-acm-certificate-creation

This module is used to create a certificate using Route53 DNS validation. It requires a hosted zone to which the IAM principal creating the resource has access.

Examples

# Variables definition
variable "acm_certificate_name" {
  description = "Certificate name prefix which will be trailed by the hosted-zone name"
  type = list(string)
}

variable "hosted_zone_name" {
  description = "Route53 hosted zone name"
  type        = string
}

acm_certificate_name  = ["engineering", "sales"]
hosted_zone_name      = "example.com"

# Data resource retrieving the provided hosted-zone's ID
data "aws_route53_zone" "hosted_zone_id" {
  name = var.hosted_zone_name
  private_zone = false
}

# Module call
module "new_record_and_certificate" {
  source = "github.com/StratusGrid/terraform-aws-acm-certificate-creation"
  
  for_each        = toset(var.acm_certificate_name)
  acm_domain_name = "${each.key}.${var.hosted_zone_name}"
  zone_id         = data.aws_route53_zone.hosted_zone_id.zone_id
  
  input_tags      = {
    "Name" = "${each.key}.${var.hosted_zone_name}"
    }
}

Requirements

Name Version
terraform >= 1.0
aws >= 3.75

Resources

Name Type
aws_acm_certificate.acm_module_certificate resource
aws_acm_certificate_validation.acm_module_cert_validation resource
aws_route53_record.domain_validation_record resource

Inputs

Name Description Type Default Required
acm_domain_name Name of the certificate to be created in AWS ACM / FQDN string n/a yes
input_tags A map of tags to add to all resources map(string) {} no
zone_id Route53 zone ID string n/a yes

Outputs

Name Description
acm_certificate_arn The ARN of the certificate created by this module

Note, manual changes to the README will be overwritten when the documentation is updated. To update the documentation, run terraform-docs -c .config/.terraform-docs.yml

About

Module used to automate ACM creation, Route53 record creation, and certificate validation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages