Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 3, 2023. It is now read-only.

Commit 5c8b479

Browse files
committed
Fix ELB without SSL and external domain
1 parent 753516e commit 5c8b479

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

web-service/elb/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ variable "ssl_certificate_id" {
5757
*/
5858

5959
resource "aws_elb" "main_with_ssl" {
60-
count = "${1 - (var.ssl_certificate_id == "")}"
60+
count = "${var.ssl_certificate_id != "" ? 1 : 0}"
6161

6262
name = "${var.name}"
6363

@@ -105,7 +105,7 @@ resource "aws_elb" "main_with_ssl" {
105105
}
106106

107107
resource "aws_elb" "main_without_ssl" {
108-
count = "${0 + (var.ssl_certificate_id == "")}"
108+
count = "${var.ssl_certificate_id == "" ? 1 : 0}"
109109

110110
name = "${var.name}"
111111

@@ -152,7 +152,7 @@ locals {
152152
}
153153

154154
resource "aws_route53_record" "external" {
155-
count = "${1 - (var.external_zone_id == "")}"
155+
count = "${var.external_zone_id != "" ? 1 : 0}"
156156

157157
zone_id = "${var.external_zone_id}"
158158
name = "${var.external_dns_name}"
@@ -198,7 +198,7 @@ output "dns" {
198198

199199
// FQDN built using the zone domain and name (external)
200200
output "external_fqdn" {
201-
value = "${aws_route53_record.external.fqdn}"
201+
value = "${var.external_zone_id != "" ? element(aws_route53_record.external.*.fqdn, 0) : ""}"
202202
}
203203

204204
// FQDN built using the zone domain and name (internal)

0 commit comments

Comments
 (0)