-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
394 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- "**/README.md" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[ | ||
{ | ||
"name": "SOAT-TC_ECS_${id}_SVC_Main_Container", | ||
"image": "registry.hub.docker.com/g0tn/soat-tech-challenge-service-${id}", | ||
"cpu": 512, | ||
"memory": 1024, | ||
"essential": true, | ||
"portMappings": [ | ||
{ | ||
"containerPort": 8002, | ||
"hostPort": 8002 | ||
} | ||
], | ||
"environment": [ | ||
{ | ||
"name": "DB_USERNAME", | ||
"value": "${db_username}" | ||
}, | ||
{ | ||
"name": "DB_PASSWORD", | ||
"value": "${db_password}" | ||
}, | ||
{ | ||
"name": "DB_NAME", | ||
"value": "${db_name}" | ||
}, | ||
{ | ||
"name": "DB_HOST", | ||
"value": "${db_host}" | ||
}, | ||
{ | ||
"name": "JWT_PUBLIC_KEY", | ||
"value": "${client_jwt_pub_key}" | ||
}, | ||
{ | ||
"name": "API_URL_IDENTIFICATION", | ||
"value": "${lb_dns_name}" | ||
} | ||
], | ||
"logConfiguration": { | ||
"logDriver": "awslogs", | ||
"options": { | ||
"awslogs-create-group": "true", | ||
"awslogs-group": "/aws/ecs/SOAT-TC_ECS_${id}_Service_Logs", | ||
"awslogs-region": "${aws_region}", | ||
"awslogs-stream-prefix": "${id}-svc" | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
[ | ||
{ | ||
"name": "SOAT-TC_ECS_${id}_SVC_Main_Container", | ||
"image": "registry.hub.docker.com/g0tn/soat-tech-challenge-service-${id}", | ||
"cpu": 512, | ||
"memory": 1024, | ||
"essential": true, | ||
"portMappings": [ | ||
{ | ||
"containerPort": 8002, | ||
"hostPort": 8002 | ||
} | ||
], | ||
"environment": [ | ||
{ | ||
"name": "DB_USERNAME", | ||
"value": "${db_username}" | ||
}, | ||
{ | ||
"name": "DB_PASSWORD", | ||
"value": "${db_password}" | ||
}, | ||
{ | ||
"name": "DB_NAME", | ||
"value": "${db_name}" | ||
}, | ||
{ | ||
"name": "DB_HOST", | ||
"value": "${db_host}" | ||
}, | ||
{ | ||
"name": "JWT_PUBLIC_KEY", | ||
"value": "${client_jwt_pub_key}" | ||
}, | ||
{ | ||
"name": "API_URL_IDENTIFICATION", | ||
"value": "${lb_dns_name}" | ||
} | ||
], | ||
"logConfiguration": { | ||
"logDriver": "awslogs", | ||
"options": { | ||
"awslogs-create-group": "true", | ||
"awslogs-group": "/aws/ecs/SOAT-TC_ECS_${id}_Service_Logs", | ||
"awslogs-region": "${aws_region}", | ||
"awslogs-stream-prefix": "${id}-svc" | ||
} | ||
} | ||
} | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
variable "order_svc_db_username" { | ||
description = "Order Service RDS Database instance master username" | ||
type = string | ||
} | ||
|
||
variable "order_svc_db_password" { | ||
description = "Order Service RDS Database instance master password" | ||
type = string | ||
sensitive = true | ||
} | ||
|
||
variable "order_svc_db_name" { | ||
description = "Order Service RDS Database instance name" | ||
type = string | ||
default = "postgres" | ||
} | ||
|
||
variable "order_svc_db_port" { | ||
description = "Order Service RDS Database instance port" | ||
type = number | ||
default = 5432 | ||
} | ||
|
||
// --- | ||
|
||
variable "payment_svc_db_username" { | ||
description = "Payment Service RDS Database instance master username" | ||
type = string | ||
} | ||
|
||
variable "payment_svc_db_password" { | ||
description = "Payment Service RDS Database instance master password" | ||
type = string | ||
sensitive = true | ||
} | ||
|
||
variable "payment_svc_db_name" { | ||
description = "Payment Service RDS Database instance name" | ||
type = string | ||
default = "postgres" | ||
} | ||
|
||
variable "payment_svc_db_port" { | ||
description = "Payment Service RDS Database instance port" | ||
type = number | ||
default = 5432 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,42 @@ | ||
data "aws_subnets" "private_subnets" { | ||
filter { | ||
name = "tag:Name" | ||
values = ["soat-tech-challenge-subnet-public*"] | ||
} | ||
# AWS Academy Vocareum AWS Learner Lab | ||
data "aws_iam_role" "lab_role" { | ||
name = "LabRole" | ||
} | ||
|
||
data "aws_security_group" "sg_default" { | ||
name = "default" | ||
data "tfe_outputs" "network" { | ||
organization = "soat-tech-challenge" | ||
workspace = "network-staging" | ||
} | ||
|
||
data "aws_alb_target_group" "tg_alb" { | ||
name = "soat-alb-target-group" | ||
data "tfe_outputs" "database" { | ||
organization = "soat-tech-challenge" | ||
workspace = "database-staging" | ||
} | ||
|
||
data "aws_db_instance" "db_instance" { | ||
db_instance_identifier = "soat-tc-rds-db" | ||
data "template_file" "order_svc_container_definition" { | ||
template = file("./container_definitions/order.json") | ||
vars = { | ||
id = "order" | ||
db_username = var.order_svc_db_username | ||
db_password = var.order_svc_db_password | ||
db_name = var.order_svc_db_name | ||
db_host = data.tfe_outputs.database.values.order_svc_db.endpoint | ||
client_jwt_pub_key = var.client_jwt_public_key | ||
lb_dns_name = data.tfe_outputs.network.values.lb_lb.dns_name | ||
aws_region = var.aws_region | ||
} | ||
} | ||
|
||
data "template_file" "payment_svc_container_definition" { | ||
template = file("./container_definitions/payment.json") | ||
vars = { | ||
id = "payment" | ||
db_username = var.payment_svc_db_username | ||
db_password = var.payment_svc_db_password | ||
db_name = var.payment_svc_db_name | ||
db_host = data.tfe_outputs.database.values.payment_svc_db.endpoint | ||
client_jwt_pub_key = var.client_jwt_public_key | ||
lb_dns_name = data.tfe_outputs.network.values.lb_lb.dns_name | ||
aws_region = var.aws_region | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "aws_ecs_cluster" "main" { | ||
name = "SOAT_Tech_Challenge_ECS_Cluster" | ||
|
||
tags = { | ||
Name : "SOAT Tech Challenge ECS Cluster" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
variable "client_jwt_public_key" { | ||
default = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqStd8n4SGNM0eZhV/hzU+urHA5/IMZPoP9YQ9ZcLKWiX33nI6bSuZMCrLZcJExf63xS+uxDpGxM8Mnk2zOdl+lPwANXLzP1us5P1PyA3YPycW9J7C5YTQW0GiEL3M93ZX7vMJiVoBYblP3JPlYnoYlBORuc0JPk33KtfEZP+78qXpPHM8imYrJLe8ceiDLLFDU/nh5KC2dWAy3ci1ahoJ1Q9ELhp3IZLvOTX57H/T2VKOYOya5+ST41h+JjzI+qGTVnLcKaW+k25YLlVnkSspvdx98+yQDi7kbOTS6yRZHUPD6wPk/nUozpD0nZKccoH4W+zMwmQVtsAA6JCA9gfGwIDAQAB" | ||
type = string | ||
} |
Oops, something went wrong.