Skip to content

Commit 98c991c

Browse files
pabloandres13Pablo Rojas
andauthored
Make egress rule configurable (#71)
* Make egress rule configurable * Added documentation in readme file --------- Co-authored-by: Pablo Rojas <[email protected]>
1 parent 4e19b40 commit 98c991c

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ No modules.
187187
| <a name="input_volume"></a> [volume](#input\_volume) | (Optional) A set of volume blocks that containers in your task may use. This is a list of maps, where each map should contain "name", "host\_path", "docker\_volume\_configuration" and "efs\_volume\_configuration". Full set of options can be found at https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html | `list(any)` | `[]` | no |
188188
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The VPC ID. | `string` | n/a | yes |
189189
| <a name="input_wait_for_steady_state"></a> [wait\_for\_steady\_state](#input\_wait\_for\_steady\_state) | If true, Terraform will wait for the service to reach a steady state (like aws ecs wait services-stable) before continuing. | `bool` | `false` | no |
190+
| <a name="deny_egress_to_anywhere"></a> [deny\_egress\_to\_anywhere](#deny\_egress\_to\_anywhere) | If true, Terraform will no create the default egress rule which allows all outgoing traffic. | `bool` | `false` | no |
190191

191192
## Outputs
192193

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ resource "aws_security_group" "ecs_service" {
8888
}
8989

9090
resource "aws_security_group_rule" "egress_service" {
91+
count = var.deny_egress_to_anywhere ? 0 : 1
9192
security_group_id = aws_security_group.ecs_service.id
9293
type = "egress"
9394
protocol = "-1"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,9 @@ variable "readonlyRootFilesystem" {
345345
description = "When this parameter is true, the container is given read-only access to its root file system"
346346
type = bool
347347
}
348+
349+
variable "deny_egress_to_anywhere" {
350+
default = false
351+
description = "When this parameter is true, no default egress rule will be created"
352+
type = bool
353+
}

0 commit comments

Comments
 (0)