Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for aws terraform provider 3.0 #335

Merged
merged 4 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 29 additions & 12 deletions terraform/alb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ resource "aws_alb_listener_rule" "bmlt_unstable" {
}

condition {
field = "host-header"
values = [aws_route53_record.bmlt_unstable.fqdn]
host_header {
values = [aws_route53_record.bmlt_unstable.fqdn]
}
}
}

Expand All @@ -142,16 +143,24 @@ resource "aws_acm_certificate" "bmlt_latest" {
}

resource "aws_route53_record" "cert_validation_bmlt_latest" {
name = aws_acm_certificate.bmlt_latest.domain_validation_options[0].resource_record_name
type = aws_acm_certificate.bmlt_latest.domain_validation_options[0].resource_record_type
zone_id = data.aws_route53_zone.bmlt.id
records = [aws_acm_certificate.bmlt_latest.domain_validation_options[0].resource_record_value]
for_each = {
for dvo in aws_acm_certificate.bmlt_latest.domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
zone_id = data.aws_route53_zone.bmlt.id
}
}
name = each.value.name
records = [each.value.record]
type = each.value.type
zone_id = each.value.zone_id
ttl = 60
}

resource "aws_acm_certificate_validation" "bmlt_latest" {
certificate_arn = aws_acm_certificate.bmlt_latest.arn
validation_record_fqdns = [aws_route53_record.cert_validation_bmlt_latest.fqdn]
validation_record_fqdns = [for record in aws_route53_record.cert_validation_bmlt_latest : record.fqdn]
}

resource "aws_acm_certificate" "bmlt_unstable" {
Expand All @@ -164,15 +173,23 @@ resource "aws_acm_certificate" "bmlt_unstable" {
}

resource "aws_route53_record" "cert_validation_bmlt_unstable" {
name = aws_acm_certificate.bmlt_unstable.domain_validation_options[0].resource_record_name
type = aws_acm_certificate.bmlt_unstable.domain_validation_options[0].resource_record_type
zone_id = data.aws_route53_zone.bmlt.id
records = [aws_acm_certificate.bmlt_unstable.domain_validation_options[0].resource_record_value]
for_each = {
for dvo in aws_acm_certificate.bmlt_unstable.domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
zone_id = data.aws_route53_zone.bmlt.id
}
}
name = each.value.name
records = [each.value.record]
type = each.value.type
zone_id = each.value.zone_id
ttl = 60
}

resource "aws_acm_certificate_validation" "bmlt_unstable" {
certificate_arn = aws_acm_certificate.bmlt_unstable.arn
validation_record_fqdns = [aws_route53_record.cert_validation_bmlt_unstable.fqdn]
validation_record_fqdns = [for record in aws_route53_record.cert_validation_bmlt_unstable : record.fqdn]
}

3 changes: 2 additions & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ terraform {
}

provider "aws" {
region = "us-east-1"
version = "~> 3.0"
region = "us-east-1"
}