Skip to content

Commit

Permalink
Run application
Browse files Browse the repository at this point in the history
  • Loading branch information
1Mill committed Mar 9, 2023
1 parent d61fcbf commit fb93e58
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/terraform-aws-modules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const app = express()

app.get('/', (_req, res) => {
res.send(`
Hello World!
This "Hello world!" is powered by Terraform AWS Modules!
The NODE_ENV is ${process.env.NODE_ENV}.
Datetime now: ${new Date().toISOString()}.
The MY_INPUT_ENV_VAR is ${process.env.MY_INPUT_ENV_VAR}.
Expand Down
24 changes: 24 additions & 0 deletions examples/terraform-aws-modules/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,30 @@ resource "aws_ecs_task_definition" "this" {
requires_compatibilities = ["FARGATE"]
}

# * Step 7 - Run our application.
resource "aws_ecs_service" "this" {
cluster = module.ecs.cluster_id
desired_count = 1
launch_type = "FARGATE"
name = "${local.example}-service"
task_definition = resource.aws_ecs_task_definition.this.arn

lifecycle {
ignore_changes = [desired_count] # Allow external changes to happen without Terraform conflicts, particularly around auto-scaling.
}

load_balancer {
container_name = local.container_name
container_port = local.container_port
target_group_arn = module.alb.target_group_arns[0]
}

network_configuration {
security_groups = [module.vpc.default_security_group_id]
subnets = module.vpc.private_subnets
}
}

# TODO: Update Step number
# * Step XXX - See our application working.
# * Output the URL of our Application Load Balancer so that we can connect to
Expand Down

0 comments on commit fb93e58

Please sign in to comment.