Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module "ecs_apps" {

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| alb_only | Whether to deploy only an alb and no cloudFront or not with the cluster | string | `"false"` | no |
| alb | Whether to deploy an ALB or not with the cluster | string | `"true"` | no |
| asg\_max | Max number of instances for autoscaling group | string | `"4"` | no |
| asg\_memory\_target | Target average memory percentage to track for autoscaling | string | `"60"` | no |
Expand Down
6 changes: 5 additions & 1 deletion _variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ variable "alb" {
default = true
description = "Whether to deploy an ALB or not with the cluster"
}
variable "alb_only" {
default = false
description = "Whether to deploy only an alb and no cloudFront or not with the cluster"
}

variable "asg_min" {
default = 1
Expand Down Expand Up @@ -89,4 +93,4 @@ variable "target_group_arns" {
default = []
type = "list"
description = "List of target groups for ASG to register"
}
}
8 changes: 4 additions & 4 deletions waf.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
resource "aws_wafregional_web_acl_association" "alb" {
count = "${var.alb ? 1 : 0}"
count = "${var.alb && !var.alb_only ? 1 : 0}"

resource_arn = aws_lb.ecs[0].arn
web_acl_id = aws_wafregional_web_acl.alb[0].id
}

resource "aws_wafregional_web_acl" "alb" {
count = "${var.alb ? 1 : 0}"
count = "${var.alb && !var.alb_only ? 1 : 0}"

depends_on = ["aws_wafregional_rule.alb_header"]
name = "alb_ecs_${var.name}"
Expand All @@ -28,7 +28,7 @@ resource "aws_wafregional_web_acl" "alb" {
}

resource "aws_wafregional_rule" "alb_header" {
count = "${var.alb ? 1 : 0}"
count = "${var.alb && !var.alb_only ? 1 : 0}"

depends_on = ["aws_wafregional_byte_match_set.alb_header"]
name = "alb_cloudfront_header_ecs_${var.name}"
Expand All @@ -47,7 +47,7 @@ resource "random_string" "alb_cloudfront_key" {
}

resource "aws_wafregional_byte_match_set" "alb_header" {
count = "${var.alb ? 1 : 0}"
count = "${var.alb && !var.alb_only ? 1 : 0}"

name = "alb_cloudfront_header_ecs_${var.name}"

Expand Down