Last active
January 13, 2021 19:20
-
-
Save flaudisio/9fa2c79514f83c9839f44c892e536afe to your computer and use it in GitHub Desktop.
terraform-acm-and-alb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See also: | |
# - https://github.com/terraform-aws-modules/terraform-aws-alb/blob/v5.10.0/examples/complete-alb/main.tf | |
variable "domain_name" { | |
default = "example.com" | |
} | |
variable "route53_zone_id" { | |
default = "Z01538412G5CUAEXAMPLE" | |
} | |
module "acm" { | |
source = "terraform-aws-modules/acm/aws" | |
version = "2.12.0" | |
domain_name = var.domain_name | |
zone_id = var.route53_zone_id | |
subject_alternative_names = [ | |
"*.${var.domain_name}", | |
] | |
wait_for_validation = true | |
tags = { | |
Name = "Wildcard for ${var.domain_name}" | |
} | |
} | |
module "alb" { | |
source = "terraform-aws-modules/alb/aws" | |
version = "5.10.0" | |
load_balancer_type = "application" | |
# ... omitted ... | |
https_listeners = [ | |
{ | |
target_group_index = 0 | |
port = 443 | |
protocol = "HTTPS" | |
certificate_arn = module.acm.this_acm_certificate_arn | |
ssl_policy = "ELBSecurityPolicy-2016-08" | |
action_type = "forward" | |
}, | |
] | |
# ... omitted ... | |
} | |
output "acm_certificate_arn" { | |
value = module.acm.this_acm_certificate_arn | |
} | |
output "acm_validation_domains" { | |
value = module.acm.validation_domains | |
} | |
output "acm_validation_route53_record_fqdns" { | |
value = module.acm.validation_route53_record_fqdns | |
} | |
output "alb_dns_name" { | |
value = module.alb.this_lb_dns_name | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment