Skip to content

Commit 921a28f

Browse files
author
damaya
authored
Merge pull request #1 from Nuagic/terraform-0.12
Upgrade syntax to terraform 0.12 specs
2 parents 5974381 + 40b823d commit 921a28f

File tree

5 files changed

+31
-23
lines changed

5 files changed

+31
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.terraform/

main.tf

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
resource "aws_acm_certificate" "this" {
2-
provider = "aws"
3-
domain_name = "${var.domain}"
4-
subject_alternative_names = ["${var.alternative_domains}"]
5-
validation_method = "DNS"
6-
tags = "${var.tags}"
2+
provider = aws
3+
domain_name = var.domain
4+
subject_alternative_names = var.alternative_domains
5+
validation_method = "DNS"
6+
tags = var.tags
77
}
88

99
resource "aws_route53_record" "this" {
10-
count = "${length(var.zone_ids)}"
11-
allow_overwrite = "${var.overwrite}"
12-
name = "${lookup(aws_acm_certificate.this.domain_validation_options[count.index], "resource_record_name")}"
13-
type = "${lookup(aws_acm_certificate.this.domain_validation_options[count.index], "resource_record_type")}"
14-
zone_id = "${element(var.zone_ids, count.index)}"
15-
records = ["${lookup(aws_acm_certificate.this.domain_validation_options[count.index], "resource_record_value")}"]
16-
ttl = 60
10+
count = length(var.zone_ids)
11+
allow_overwrite = var.overwrite
12+
name = aws_acm_certificate.this.domain_validation_options[count.index]["resource_record_name"]
13+
type = aws_acm_certificate.this.domain_validation_options[count.index]["resource_record_type"]
14+
zone_id = element(var.zone_ids, count.index)
15+
records = aws_acm_certificate.this.domain_validation_options[count.index]["resource_record_value"]
16+
ttl = 60
1717
}
1818

1919
resource "aws_acm_certificate_validation" "this" {
20-
provider = "aws"
21-
count = "${var.validate ? length(var.zone_ids) : 0}"
22-
certificate_arn = "${aws_acm_certificate.this.arn}"
23-
validation_record_fqdns = ["${aws_route53_record.this.*.fqdn}"]
20+
provider = aws
21+
count = var.validate ? length(var.zone_ids) : 0
22+
certificate_arn = aws_acm_certificate.this.arn
23+
validation_record_fqdns = aws_route53_record.this.*.fqdn
2424
}
25+

outputs.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
output "certificate_arn" {
2-
value = "${aws_acm_certificate.this.arn}"
2+
value = aws_acm_certificate.this.arn
33
}
4+

variables.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variable "tags" {
22
description = "Tags"
3-
default = {}
3+
default = {}
44
}
55

66
variable "domain" {
@@ -9,20 +9,21 @@ variable "domain" {
99

1010
variable "zone_ids" {
1111
description = "Zone Id"
12-
default = []
12+
default = []
1313
}
1414

1515
variable "alternative_domains" {
16-
description = "Domians name to request ACM certificates"
17-
default = []
16+
description = "Domains name to request ACM certificates"
17+
default = []
1818
}
1919

2020
variable "validate" {
2121
description = "Validate ACM certificates"
22-
default = true
22+
default = true
2323
}
2424

2525
variable "overwrite" {
2626
description = "Allow creation of this record in Terraform to overwrite an existing record"
27-
default = true
27+
default = true
2828
}
29+

versions.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
terraform {
3+
required_version = ">= 0.12"
4+
}

0 commit comments

Comments
 (0)