Skip to content

Commit

Permalink
default vpc
Browse files Browse the repository at this point in the history
  • Loading branch information
BEW111 committed Apr 28, 2024
1 parent 1f07d09 commit 7340fdd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion infrastructure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ resource "aws_ecs_task_definition" "app" {
])
}

// VPC configuration
data "aws_vpc" "default" {
default = true
}

data "aws_subnets" "default" {
filter {
name = "vpc-id"
values = [data.aws_vpc.default.id]
}
}


resource "aws_ecs_service" "app_service" {
name = "app-service"
cluster = aws_ecs_cluster.cluster.id
Expand All @@ -104,7 +117,7 @@ resource "aws_ecs_service" "app_service" {
launch_type = "FARGATE"

network_configuration {
subnets = ["subnet here", "subnet here"]
subnets = data.aws_subnets.default.ids
assign_public_ip = true
}
}
Expand Down

0 comments on commit 7340fdd

Please sign in to comment.