Skip to content

Commit 727920b

Browse files
Add var.create_cloudfront_origin_access_identity
In some circumstances, it wasn't possible to automatically determine if an Origin Access Identity should be created. Because of this, Terraform requires us to always explicitly specify if the OAI should be created.
1 parent 2802ae3 commit 727920b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ locals {
99
s3_access_logging_enabled = local.enabled && (var.s3_access_logging_enabled == null ? length(var.s3_access_log_bucket_name) > 0 : var.s3_access_logging_enabled)
1010
create_cf_log_bucket = local.cloudfront_access_logging_enabled && local.cloudfront_access_log_create_bucket
1111

12-
create_cloudfront_origin_access_identity = local.enabled && length(compact([var.cloudfront_origin_access_identity_iam_arn])) == 0 # "" or null
12+
create_cloudfront_origin_access_identity = local.enabled && var.create_cloudfront_origin_access_identity
1313

1414
origin_id = module.this.id
1515
origin_path = coalesce(var.origin_path, "/")

variables.tf

+7-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ variable "deployment_actions" {
492492
variable "cloudfront_origin_access_identity_iam_arn" {
493493
type = string
494494
default = ""
495-
description = "Existing cloudfront origin access identity iam arn that is supplied in the s3 bucket policy"
495+
description = "Existing cloudfront origin access identity iam arn that is supplied in the s3 bucket policy. If you set this, disable `create_cloudfront_origin_access_identity`"
496496
}
497497

498498
variable "cloudfront_origin_access_identity_path" {
@@ -662,3 +662,9 @@ variable "allow_ssl_requests_only" {
662662
default = true
663663
description = "Set to `true` to require requests to use Secure Socket Layer (HTTPS/SSL). This will explicitly deny access to HTTP requests"
664664
}
665+
666+
variable "create_cloudfront_origin_access_identity" {
667+
type = bool
668+
default = true
669+
description = "Set to `true` to create a CloudFront Origin Access Identity. You should disable this if you set `cloudfront_origin_access_identity_iam_arn`"
670+
}

0 commit comments

Comments
 (0)