Skip to content

shamimice03/terraform-aws-acm-route53

Repository files navigation

Request SSL/TLS Certficate

Usage

module "acm_route53" {
    source  = "shamimice03/acm-route53/aws"

    create = true
    domain_names = [
        "awsref.kubecloud.net",
        "www.awsref.kubecloud.net",
    ]
    hosted_zone_name       = "kubecloud.net"
    private_zone           = false
    validation_method      = "DNS"
    allow_record_overwrite = true
    ttl                    = 60
    tags = {
        "Name" = "ssl-cert"
    }
}

How to use:

module "acm_route53" {
  source = "shamimice03/acm-route53/aws"

  create = true
  domain_names = [
    "awsref.kubecloud.net",
    "www.awsref.kubecloud.net",
  ]

  # ... omitted
}

module "alb" {
  source  = "terraform-aws-modules/alb/aws"
  version = "8.7.0"

  create_lb          = true
  load_balancer_type = "application"

  # skipped for brevity
  target_groups = [...]

  https_listeners = [
    {
      port               = 443
      protocol           = "HTTPS"
      certificate_arn    = module.acm_route53.domain_certificate_arns["awsref.kubecloud.net"]  # <------
      action_type        = "forward"
      target_group_index = 0
    }
  ]

  # ... omitted
}

Details on /examples/complete/

Requirements

Name Version
terraform >= 1.0.0
aws >= 5.0.0

Providers

Name Version
aws 5.17.0

Modules

No modules.

Resources

Name Type
aws_acm_certificate.cert resource
aws_acm_certificate_validation.valid_cert resource
aws_route53_record.validation resource
aws_route53_zone.public_zone data source

Inputs

Name Description Type Default Required
allow_record_overwrite Determine Record Overwite bool true no
create Controls if certificate should be generated bool true no
domain_names Define Domain name list(string) [] no
hosted_zone_name Define Hosted Zone Name string "" no
private_zone Determine Zone Type. false leads to public zone and true for private zone bool false no
tags Define Tags map(any) {} no
ttl Define ttl number 60 no
validation_method Define Validation Method. DNS or EMAIL string "DNS" no

Outputs

Name Description
certificate_arns certificate arns
domain_certificate_arns domain with certificate arn

Outputs format:

certificate_arns = [
  "arn:aws:acm:ap-northeast-1:...",
  "arn:aws:acm:ap-northeast-1:...",
]

domain_certificate_arns = {
  "awsref.kubecloud.net" = "arn:aws:acm:ap-northeast-1:..."
  "www.awsref.kubecloud.net" = "arn:aws:acm:ap-northeast-1:..."
}