Skip to content

Commit a3179d0

Browse files
authored
fix: Adds public subnet IDs and private subnet IDs (#15)
* BREAKING CHANGE: Remove subnet_ids, adds public subnet IDs and private subnet IDs * docs: Updates documentation
1 parent 2be0d67 commit a3179d0

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ Before using this module, ensure you have the following:
184184
| <a name="input_load_balancer_allowed_cidr_blocks"></a> [load\_balancer\_allowed\_cidr\_blocks](#input\_load\_balancer\_allowed\_cidr\_blocks) | The CIDR blocks allowed to access the Load Balancer | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
185185
| <a name="input_load_balancer_prefix_list_ids"></a> [load\_balancer\_prefix\_list\_ids](#input\_load\_balancer\_prefix\_list\_ids) | The prefix list IDs allowed to access the Load Balancer | `list(string)` | `[]` | no |
186186
| <a name="input_memory"></a> [memory](#input\_memory) | The amount of memory to reserve for the Directus service | `number` | `4096` | no |
187+
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | The IDs of the private subnets used by the ECS service to run tasks | `list(string)` | n/a | yes |
188+
| <a name="input_public_subnet_ids"></a> [public\_subnet\_ids](#input\_public\_subnet\_ids) | The IDs of the public subnets used by the Load Balancer to serve traffic | `list(string)` | n/a | yes |
187189
| <a name="input_public_url"></a> [public\_url](#input\_public\_url) | The public URL of the Directus service | `string` | `""` | no |
188190
| <a name="input_rds_database_engine"></a> [rds\_database\_engine](#input\_rds\_database\_engine) | The engine of the RDS database | `string` | n/a | yes |
189191
| <a name="input_rds_database_host"></a> [rds\_database\_host](#input\_rds\_database\_host) | The host of the RDS database | `string` | n/a | yes |
@@ -197,7 +199,6 @@ Before using this module, ensure you have the following:
197199
| <a name="input_s3_bucket_name"></a> [s3\_bucket\_name](#input\_s3\_bucket\_name) | The name of the S3 bucket | `string` | `""` | no |
198200
| <a name="input_s3_bucket_versioning_configuration"></a> [s3\_bucket\_versioning\_configuration](#input\_s3\_bucket\_versioning\_configuration) | S3 bucket versioning configuration | <pre>object({<br> mfa_delete = string<br> })</pre> | <pre>{<br> "mfa_delete": "Disabled"<br>}</pre> | no |
199201
| <a name="input_ssl_certificate_arn"></a> [ssl\_certificate\_arn](#input\_ssl\_certificate\_arn) | The ARN of the SSL certificate | `string` | `""` | no |
200-
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | The IDs of the subnets | `list(string)` | n/a | yes |
201202
| <a name="input_tags"></a> [tags](#input\_tags) | The tags to apply to the resources | `map(string)` | `{}` | no |
202203
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The ID of the VPC | `string` | n/a | yes |
203204

examples/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ locals {
3636
module "directus" {
3737
source = "./.."
3838

39-
application_name = local.name # Change this to your application name
40-
admin_email = "[email protected]" # Change this to your email address
41-
vpc_id = module.vpc.vpc_id # Change this to your VPC ID
42-
subnet_ids = module.vpc.public_subnets # Change this to your subnet IDs
39+
application_name = local.name # Change this to your application name
40+
admin_email = "[email protected]" # Change this to your email address
41+
vpc_id = module.vpc.vpc_id # Change this to your VPC ID
42+
public_subnet_ids = module.vpc.public_subnets # Change this to your subnet IDs
43+
private_subnet_ids = module.vpc.private_subnets # Change this to your subnet IDs
4344

4445
public_url = "https://${local.application_domain_name}"
4546

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ resource "aws_lb" "directus" {
381381
name = "${local.truncated_application_name}-${local.service_name}-lb"
382382
internal = false
383383
load_balancer_type = "application"
384-
subnets = var.subnet_ids
384+
subnets = var.public_subnet_ids
385385
security_groups = [aws_security_group.lb_sg.id]
386386

387387
enable_deletion_protection = false
@@ -470,8 +470,8 @@ resource "aws_ecs_service" "directus" {
470470
}
471471

472472
network_configuration {
473-
assign_public_ip = true
474-
subnets = var.subnet_ids
473+
assign_public_ip = false
474+
subnets = var.private_subnet_ids
475475
security_groups = [aws_security_group.ecs_sg.id]
476476
}
477477

variables.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,13 @@ variable "vpc_id" {
251251
type = string
252252
}
253253

254-
variable "subnet_ids" {
255-
description = "The IDs of the subnets"
254+
variable "public_subnet_ids" {
255+
description = "The IDs of the public subnets used by the Load Balancer to serve traffic"
256+
type = list(string)
257+
}
258+
259+
variable "private_subnet_ids" {
260+
description = "The IDs of the private subnets used by the ECS service to run tasks"
256261
type = list(string)
257262
}
258263

0 commit comments

Comments
 (0)