Skip to content

Commit

Permalink
Empty ssl_support_method when using cloudfront default certificate (#46)
Browse files Browse the repository at this point in the history
The current implementation always uses "sni-only" as
`ssl_support_method` in `viewer_certificate` configuration.
According to Terraform documentation [0] this option is required
only when using `acm_certificate_arn` or `iam_certificate_id`.
In our experience this leads to a situation where Terraform
tries to set `ssl_support_method` to "sni-only" at each
run spending several time trying to do it (~10 minutes) without
effectively setting anything (it doesn't fail though).
With this commit we check the value of `acm_certificate_arn` and set the
proper `ssl_support_method` only if such value is defined.

[0] https://www.terraform.io/docs/providers/aws/r/cloudfront_distribution.html#ssl_support_method

Co-authored-by: Andriy Knysh <[email protected]>
  • Loading branch information
cippaciong and aknysh committed Jan 15, 2020
1 parent b7221b0 commit e132823
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ resource "aws_cloudfront_distribution" "default" {

viewer_certificate {
acm_certificate_arn = var.acm_certificate_arn
ssl_support_method = "sni-only"
ssl_support_method = var.acm_certificate_arn == "" ? "" : "sni-only"
minimum_protocol_version = var.minimum_protocol_version
cloudfront_default_certificate = var.acm_certificate_arn == "" ? true : false
}
Expand Down

0 comments on commit e132823

Please sign in to comment.