Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
feat: add env variables on ecs task definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark2000 committed Mar 1, 2024
1 parent 8524daa commit 1454911
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
18 changes: 10 additions & 8 deletions aws/royals/ecs-api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,16 @@ resource "aws_ecs_task_definition" "api" {
memory = 512

container_definitions = templatefile("${path.module}/task-definition.tftpl", {
task_name = "skku-royals-api",
database_url = "postgresql://${var.postgres_username}:${var.postgres_password}@${aws_instance.database.private_ip}:${var.postgres_port}/royals?schema=public",
ecr_uri = aws_ecr_repository.main.repository_url,
container_port = 4000,
cloudwatch_region = var.region,
redis_host = aws_instance.cache.private_ip,
redis_port = var.redis_port,
jwt_secret = var.jwt_secret
task_name = "skku-royals-api",
database_url = "postgresql://${var.postgres_username}:${var.postgres_password}@${aws_instance.database.private_ip}:${var.postgres_port}/royals?schema=public",
ecr_uri = aws_ecr_repository.main.repository_url,
container_port = 4000,
cloudwatch_region = var.region,
redis_host = aws_instance.cache.private_ip,
redis_port = var.redis_port,
jwt_secret = var.jwt_secret,
cdn_base_url = var.cdn_base_url,
aws_cdn_bucket_name = var.aws_cdn_bucket_name
})

execution_role_arn = aws_iam_role.ecs_task_execution_role.arn
Expand Down
8 changes: 8 additions & 0 deletions aws/royals/task-definition.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
{
"name": "JWT_SECRET",
"value": "${jwt_secret}"
},
{
"name": "AWS_CDN_BUCKET_NAME",
"value": "${aws_cdn_bucket_name}"
},
{
"name": "CDN_BASE_URL",
"value": "${cnd_base_url}"
}
],
"logConfiguration": {
Expand Down
10 changes: 10 additions & 0 deletions aws/royals/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@ variable "redis_port" {
type = number
default = 6379
}

variable "cdn_base_url" {
type = string
default = "cdn.skku-royals.com"
}

variable "aws_cdn_bucket_name" {
type = string
default = "royals-cdn-bucket"
}

0 comments on commit 1454911

Please sign in to comment.