Skip to content

Commit 2bb0bf8

Browse files
authored
Merge pull request #4 from DNXLabs/feat-remove-cloudFront
Feat remove cloud front
2 parents 0592ffe + f102620 commit 2bb0bf8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module "ecs_apps" {
2828

2929
| Name | Description | Type | Default | Required |
3030
|------|-------------|:----:|:-----:|:-----:|
31+
| alb_only | Whether to deploy only an alb and no cloudFront or not with the cluster | string | `"false"` | no |
3132
| alb | Whether to deploy an ALB or not with the cluster | string | `"true"` | no |
3233
| asg\_max | Max number of instances for autoscaling group | string | `"4"` | no |
3334
| asg\_memory\_target | Target average memory percentage to track for autoscaling | string | `"60"` | no |

_variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ variable "alb" {
5959
default = true
6060
description = "Whether to deploy an ALB or not with the cluster"
6161
}
62+
variable "alb_only" {
63+
default = false
64+
description = "Whether to deploy only an alb and no cloudFront or not with the cluster"
65+
}
6266

6367
variable "asg_min" {
6468
default = 1
@@ -89,4 +93,4 @@ variable "target_group_arns" {
8993
default = []
9094
type = "list"
9195
description = "List of target groups for ASG to register"
92-
}
96+
}

waf.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
resource "aws_wafregional_web_acl_association" "alb" {
2-
count = "${var.alb ? 1 : 0}"
2+
count = "${var.alb && !var.alb_only ? 1 : 0}"
33

44
resource_arn = aws_lb.ecs[0].arn
55
web_acl_id = aws_wafregional_web_acl.alb[0].id
66
}
77

88
resource "aws_wafregional_web_acl" "alb" {
9-
count = "${var.alb ? 1 : 0}"
9+
count = "${var.alb && !var.alb_only ? 1 : 0}"
1010

1111
depends_on = ["aws_wafregional_rule.alb_header"]
1212
name = "alb_ecs_${var.name}"
@@ -28,7 +28,7 @@ resource "aws_wafregional_web_acl" "alb" {
2828
}
2929

3030
resource "aws_wafregional_rule" "alb_header" {
31-
count = "${var.alb ? 1 : 0}"
31+
count = "${var.alb && !var.alb_only ? 1 : 0}"
3232

3333
depends_on = ["aws_wafregional_byte_match_set.alb_header"]
3434
name = "alb_cloudfront_header_ecs_${var.name}"
@@ -47,7 +47,7 @@ resource "random_string" "alb_cloudfront_key" {
4747
}
4848

4949
resource "aws_wafregional_byte_match_set" "alb_header" {
50-
count = "${var.alb ? 1 : 0}"
50+
count = "${var.alb && !var.alb_only ? 1 : 0}"
5151

5252
name = "alb_cloudfront_header_ecs_${var.name}"
5353

0 commit comments

Comments
 (0)