• Stars
    star
    182
  • Rank 211,154 (Top 5 %)
  • Language HCL
  • License
    Apache License 2.0
  • Created almost 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Terraform module to create AWS ACM resources ๐Ÿ‡บ๐Ÿ‡ฆ

AWS Certificate Manager (ACM) Terraform module

Terraform module which creates ACM certificates and validates them using Route53 DNS (recommended) or e-mail.

SWUbanner

Usage with Route53 DNS validation (recommended)

module "acm" {
  source  = "terraform-aws-modules/acm/aws"
  version = "~> 4.0"

  domain_name  = "my-domain.com"
  zone_id      = "Z2ES7B9AZ6SHAE"

  subject_alternative_names = [
    "*.my-domain.com",
    "app.sub.my-domain.com",
  ]

  wait_for_validation = true

  tags = {
    Name = "my-domain.com"
  }
}

Usage with external DNS validation (e.g. CloudFlare)

module "acm" {
  source  = "terraform-aws-modules/acm/aws"
  version = "~> 4.0"

  domain_name = "weekly.tf"
  zone_id     = "b7d259641bf30b89887c943ffc9d2138"

  subject_alternative_names = [
    "*.weekly.tf",
  ]

  create_route53_records  = false
  validation_record_fqdns = [
    "_689571ee9a5f9ec307c512c5d851e25a.weekly.tf",
  ]

  tags = {
    Name = "weekly.tf"
  }
}

Usage with CloudFront

# CloudFront supports US East (N. Virginia) Region only.
provider "aws" {
  alias  = "us-east-1"
  region = "us-east-1"
}

module "acm" {
  source = "terraform-aws-modules/acm/aws"

  providers = {
    aws = aws.us-east-1
  }

  domain_name = "my-domain.com"
  zone_id     = "Z266PL4W4W6MSG"

  wait_for_validation = true

  tags = {
    Name = "my-domain.com"
  }
}

Usage with Route53 DNS validation and separate AWS providers

provider "aws" {
  alias = "acm"
}

provider "aws" {
  alias = "route53"
}

module "acm" {
  source  = "terraform-aws-modules/acm/aws"
  version = "~> 4.0"

  providers = {
    aws = aws.acm
  }

  domain_name  = "my-domain.com"

  subject_alternative_names = [
    "*.my-domain.com",
    "app.sub.my-domain.com",
  ]

  create_route53_records  = false
  validation_record_fqdns = module.route53_records.validation_route53_record_fqdns
}

module "route53_records" {
  source  = "terraform-aws-modules/acm/aws"
  version = "~> 4.0"

  providers = {
    aws = aws.route53
  }

  create_certificate          = false
  create_route53_records_only = true

  distinct_domain_names = module.acm.distinct_domain_names
  zone_id               = "Z266PL4W4W6MSG"

  acm_certificate_domain_validation_options = module.acm.acm_certificate_domain_validation_options
}

Examples

Conditional creation and validation

Sometimes you need to have a way to create ACM certificate conditionally but Terraform does not allow to use count inside module block, so the solution is to specify argument create_certificate.

module "acm" {
  source = "terraform-aws-modules/acm/aws"

  create_certificate = false
  # ... omitted
}

Similarly, to disable DNS validation of ACM certificate:

module "acm" {
  source = "terraform-aws-modules/acm/aws"

  validate_certificate = false
  # ... omitted
}

Notes

  • For use in an automated pipeline consider setting the wait_for_validation = false to avoid waiting for validation to complete or error after a 45 minute timeout.
  • If you're upgrading to v2.13.0 or above, you might be subject to off-by-one validation record issue. You can solve this without compromising existing validation records by issuing terraform state rm <your_module_name>.validation[1] where [1] can be a different index # depending on the number of validation records your module creates (you can check this with terraform state list module.<your_module_name>.validation).

Requirements

Name Version
terraform >= 1.0
aws >= 4.40

Providers

Name Version
aws >= 4.40

Modules

No modules.

Resources

Name Type
aws_acm_certificate.this resource
aws_acm_certificate_validation.this resource
aws_route53_record.validation resource

Inputs

Name Description Type Default Required
acm_certificate_domain_validation_options A list of domain_validation_options created by the ACM certificate to create required Route53 records from it (used when create_route53_records_only is set to true) any {} no
certificate_transparency_logging_preference Specifies whether certificate details should be added to a certificate transparency log bool true no
create_certificate Whether to create ACM certificate bool true no
create_route53_records When validation is set to DNS, define whether to create the DNS records internally via Route53 or externally using any DNS provider bool true no
create_route53_records_only Whether to create only Route53 records (e.g. using separate AWS provider) bool false no
distinct_domain_names List of distinct domains and SANs (used when create_route53_records_only is set to true) list(string) [] no
dns_ttl The TTL of DNS recursive resolvers to cache information about this record. number 60 no
domain_name A domain name for which the certificate should be issued string "" no
key_algorithm Specifies the algorithm of the public and private key pair that your Amazon issued certificate uses to encrypt data string null no
putin_khuylo Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! bool true no
subject_alternative_names A list of domains that should be SANs in the issued certificate list(string) [] no
tags A mapping of tags to assign to the resource map(string) {} no
validate_certificate Whether to validate certificate by creating Route53 record bool true no
validation_allow_overwrite_records Whether to allow overwrite of Route53 records bool true no
validation_method Which method to use for validation. DNS or EMAIL are valid, NONE can be used for certificates that were imported into ACM and then into Terraform. string "DNS" no
validation_option The domain name that you want ACM to use to send you validation emails. This domain name is the suffix of the email addresses that you want ACM to use. any {} no
validation_record_fqdns When validation is set to DNS and the DNS validation records are set externally, provide the fqdns for the validation list(string) [] no
validation_timeout Define maximum timeout to wait for the validation to complete string null no
wait_for_validation Whether to wait for the validation to complete bool true no
zone_id The ID of the hosted zone to contain this record. Required when validating via Route53 string "" no

Outputs

Name Description
acm_certificate_arn The ARN of the certificate
acm_certificate_domain_validation_options A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if DNS-validation was used.
acm_certificate_status Status of the certificate.
acm_certificate_validation_emails A list of addresses that received a validation E-Mail. Only set if EMAIL-validation was used.
distinct_domain_names List of distinct domains names used for the validation.
validation_domains List of distinct domain validation options. This is useful if subject alternative names contain wildcards.
validation_route53_record_fqdns List of FQDNs built using the zone domain and name.

Authors

Module is maintained by Anton Babenko with help from these awesome contributors.

License

Apache 2 Licensed. See LICENSE for full details.

Additional information for users from Russia and Belarus

More Repositories

1

terraform-aws-eks

Terraform module to create Amazon Elastic Kubernetes (EKS) resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
4,372
star
2

terraform-aws-vpc

Terraform module to create AWS VPC resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
2,949
star
3

terraform-aws-lambda

Terraform module, which takes care of a lot of AWS Lambda/serverless tasks (build dependencies, packages, updates, deployments) in countless combinations ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
899
star
4

terraform-aws-rds

Terraform module to create AWS RDS resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
879
star
5

terraform-aws-iam

Terraform module to create AWS IAM resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
779
star
6

terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
751
star
7

terraform-aws-security-group

Terraform module to create AWS Security Group resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
563
star
8

terraform-aws-ecs

Terraform module to create AWS ECS resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
555
star
9

terraform-aws-atlantis

Terraform module to deploy Atlantis on AWS Fargate ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
519
star
10

terraform-aws-s3-bucket

Terraform module to create AWS S3 resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
511
star
11

terraform-aws-notify-slack

Terraform module to create AWS resources for sending notifications to Slack ๐Ÿ‡บ๐Ÿ‡ฆ
Python
466
star
12

terraform-aws-alb

Terraform module to create AWS Application/Network Load Balancer (ALB/NLB) resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
433
star
13

terraform-aws-rds-aurora

Terraform module to create AWS RDS Aurora resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
384
star
14

terraform-aws-autoscaling

Terraform module to create AWS Auto Scaling resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
292
star
15

terraform-aws-pricing

Terraform module which calculates price of AWS infrastructure (from Terraform state and plan) ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
183
star
16

terraform-aws-cloudwatch

Terraform module to create AWS Cloudwatch resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
163
star
17

terraform-aws-elb

Terraform module to create AWS ELB resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
148
star
18

terraform-aws-apigateway-v2

Terraform module to create AWS API Gateway v2 (HTTP/WebSocket) ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
146
star
19

terraform-aws-eventbridge

Terraform module to create AWS EventBridge resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
142
star
20

terraform-aws-transit-gateway

Terraform module to create AWS Transit Gateway resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
141
star
21

terraform-aws-route53

Terraform module to create AWS Route53 resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
126
star
22

terraform-aws-cloudfront

Terraform module to create AWS CloudFront resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
119
star
23

terraform-aws-vpn-gateway

Terraform module to create AWS VPN gateway resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
111
star
24

terraform-aws-dynamodb-table

Terraform module to create AWS DynamoDB resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
100
star
25

terraform-aws-sns

Terraform module to create AWS SNS resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
95
star
26

terraform-aws-sqs

Terraform module to create AWS SQS resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
92
star
27

terraform-aws-key-pair

Terraform module to create AWS EC2 key pair resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
83
star
28

terraform-aws-redshift

Terraform module to create AWS Redshift resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
81
star
29

meta

Meta-configurations for repositories, teams, files in terraform-aws-modules organization ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
76
star
30

terraform-aws-solutions

Set of standalone and reusable AWS/DevOps solutions implemented as Terraform modules ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
75
star
31

terraform-aws-step-functions

Terraform module to create AWS Step Functions ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
70
star
32

terraform-aws-dms

Terraform module to create AWS DMS (Database Migration Service) resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
62
star
33

terraform-aws-rds-proxy

Terraform module to create AWS RDS Proxy resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
56
star
34

terraform-aws-msk-kafka-cluster

Terraform module to create AWS MSK (Managed Streaming for Kafka) resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
55
star
35

terraform-aws-datadog-forwarders

Terraform module to create resources on AWS to forward logs/metrics to Datadog ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
53
star
36

terraform-aws-eks-pod-identity

Terraform module to create AWS EKS Pod Identity resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
52
star
37

terraform-aws-appsync

Terraform module to create AWS AWS AppSync resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
50
star
38

terraform-aws-kms

Terraform module to create AWS KMS resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
49
star
39

terraform-aws-ecr

Terraform module to create AWS ECR resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
49
star
40

terraform-aws-managed-service-grafana

Terraform module to create AWS Managed Service for Grafana (AMG) resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
36
star
41

terraform-aws-batch

Terraform module to create AWS Batch resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
35
star
42

terraform-aws-app-runner

Terraform module to create AWS App Runner resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
32
star
43

terraform-aws-secrets-manager

Terraform module to create AWS Secrets Manager resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
28
star
44

terraform-aws-appconfig

Terraform module to create AWS AppConfig resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
27
star
45

terraform-aws-managed-service-prometheus

Terraform module to create AWS Managed Service for Prometheus (AMP) resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
26
star
46

terraform-aws-efs

Terraform module to create AWS EFS resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
24
star
47

terraform-aws-emr

Terraform module to create AWS EMR resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
23
star
48

.github

Meta-GitHub repository for all terraform-aws-modules repositories ๐Ÿ‡บ๐Ÿ‡ฆ
22
star
49

terraform-aws-ssm-parameter

Terraform module to create AWS SSM Parameter resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
20
star
50

terraform-aws-s3-object

Terraform module which creates S3 object resources on AWS
HCL
17
star
51

terraform-aws-ebs-optimized

Terraform module to determine if an instance can be flagged for EBS optimization
HCL
17
star
52

terraform-aws-customer-gateway

Terraform module to create AWS Customer Gateway resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
17
star
53

terraform-aws-global-accelerator

Terraform module to create AWS Global Accelerator resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
16
star
54

terraform-aws-memory-db

Terraform module to create AWS MemoryDB resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
16
star
55

terraform-aws-opensearch

Terraform module to create AWS OpenSearch resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
15
star
56

terraform-aws-elasticache

Terraform module to create AWS ElastiCache resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
12
star
57

terraform-aws-network-firewall

Terraform module to create AWS Network Firewall resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
12
star
58

terraform-aws-fsx

Terraform module to create AWS FSx resources ๐Ÿ‡บ๐Ÿ‡ฆ
HCL
4
star
59

atlantis-demo

Demo repository for Atlantis
3
star