Skip to content

Commit ae34ecc

Browse files
committed
add option to include cloudfront arn
1 parent f8bae59 commit ae34ecc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

_variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ variable "name" {
33
type = string
44
}
55

6+
variable "cloudfront_web_acl_id" {
7+
default = ""
8+
description = "Optional web acl (WAF) to attach to CloudFront"
9+
}
10+
611
variable "hostnames" {
712
description = "Hostnames to create DNS record for this app that the cloudfront distribution will accept"
813
type = list(string)

cloudfront.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resource "aws_cloudfront_distribution" "default" {
1313

1414
depends_on = [aws_wafv2_web_acl.waf_cloudfront]
1515

16-
web_acl_id = var.waf_cloudfront_enable ? aws_wafv2_web_acl.waf_cloudfront[0].arn : null
16+
web_acl_id = var.waf_cloudfront_enable ? (var.cloudfront_web_acl_id != null ? var.cloudfront_web_acl_id : aws_wafv2_web_acl.waf_cloudfront[0].arn) : null
1717

1818
origin {
1919
domain_name = var.alb_dns_name

0 commit comments

Comments
 (0)