Skip to content

Commit

Permalink
Trying to match the existing cloudfront_distribution API more closely
Browse files Browse the repository at this point in the history
  • Loading branch information
justnom committed Dec 23, 2021
1 parent 42690e4 commit ebe9c88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
9 changes: 6 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ resource "aws_cloudfront_distribution" "default" {
origin_read_timeout = var.origin_read_timeout
}

origin_shield {
enabled = var.origin_shield_enabled
origin_shield_region = var.origin_shield_region
dynamic "origin_shield" {
for_each = var.origin_shield ? ["true"] : []
content {
enabled = var.origin_shield.enabled
origin_shield_region = var.origin_shield.region
}
}

dynamic "custom_header" {
Expand Down
17 changes: 7 additions & 10 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,13 @@ variable "origin_protocol_policy" {
default = "match-viewer"
}

variable "origin_shield_enabled" {
type = bool
description = "Whether to use CloudFront Origin Shield"
default = false
}

variable "origin_shield_region" {
type = string
description = "The AWS Region for the Origin Shield"
default = "us-east-1"
variable "origin_shield" {
type = object({
enabled = bool
region = string
})
description = "The CloudFront Origin Shield settings"
default = null
}

variable "origin_ssl_protocols" {
Expand Down

0 comments on commit ebe9c88

Please sign in to comment.