Skip to content

Commit 07fae50

Browse files
clivezaaknysh
authored andcommitted
Added conditional (#9)
* Output variable was referencing incorrect value * Removed option that sets cloudfront_default_certificate - According to terraform documentation you either have to set cloudfront_default_certificate or acm_certificate_arn for viewer_certificate in the aws_cloudfront_distribution resource, but not both. * Added a conditional to viewer_certificate block - This was needed because if you set acm_certificate_arn then cloudfront_default_certificate needs to be false otherwise it needs to be true.
1 parent 58181b9 commit 07fae50

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ resource "aws_cloudfront_distribution" "default" {
128128
acm_certificate_arn = "${var.acm_certificate_arn}"
129129
ssl_support_method = "sni-only"
130130
minimum_protocol_version = "TLSv1"
131-
cloudfront_default_certificate = true
131+
cloudfront_default_certificate = "${var.acm_certificate_arn == "" ? 1 : 0}"
132132
}
133133

134134
default_cache_behavior {

0 commit comments

Comments
 (0)