Skip to content

Commit

Permalink
fix to apply clean
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-strong authored and nelg committed Sep 2, 2020
1 parent b49654a commit f0d7592
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 15 additions & 6 deletions ssl_cert.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@ resource "aws_acm_certificate" "myapp" {
# to each.value. The inner for loop is looping over each domain_validation_options and for each one, creating a
# map of name, record and type..
#
resource "aws_route53_record" "cert_validation" {
for_each = {
for dvo in aws_acm_certificate.myapp.domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
locals {
domain_cert_options = tolist(aws_acm_certificate.myapp.domain_validation_options)[0]
domain_validation_options = {
myapp = {
name = local.domain_cert_options.resource_record_name
record = local.domain_cert_options.resource_record_value
type = local.domain_cert_options.resource_record_type
}
}
}

output "domain_validation_options" {
value = local.domain_validation_options
}

resource "aws_route53_record" "cert_validation" {
for_each = local.domain_validation_options
allow_overwrite = true
name = each.value.name
records = [each.value.record]
Expand Down
2 changes: 2 additions & 0 deletions vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ variable "demo_dns_zone" {
description = "Specific to your setup, pick a domain you have in route53"
default = "lab.oss.nz."
}


variable "demo_dns_name" {
description = "Just a demo domain name"
default = "ssldemo"
Expand Down

0 comments on commit f0d7592

Please sign in to comment.