Skip to content

Commit

Permalink
Fix names, reduce resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ha7315 committed Mar 26, 2024
1 parent 099c122 commit a51a03c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module "create_user_task" {
module "create_tester_user_task" {
source = "../../resource-groups/ecs-fargate-task-definition"

aws_account_id = var.aws_account_id
aws_region = var.aws_region
container_definitions = {
pg_restore = {
cpu = var.load_task_cpu
cpu = var.create_tester_user_task_cpu
environment_variables = []
essential = true
healthcheck_command = null
image = var.postgres_docker_image
memory = var.load_task_memory
memory = var.create_tester_user_task_memory
mounts = []
# N.B. $DUMP_FILENAME is injected by the Step Function task
override_command = [
Expand All @@ -24,8 +24,8 @@ module "create_user_task" {
}
}
ecs_execution_role_arn = var.ecs_execution_role.arn
family_name = "pg_migrate_${var.migrator_name}_load"
task_cpu = var.load_task_cpu
task_memory = var.load_task_memory
family_name = "${var.db_name}-postgres-create-tester-user-sql"
task_cpu = var.create_tester_user_task_cpu
task_memory = var.create_tester_user_task_memory
volumes = []
}
2 changes: 1 addition & 1 deletion modules/create-rds-postgres-tester/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ resource "aws_iam_role_policy_attachment" "step_function_policy" {
}

resource "aws_iam_role_policy_attachment" "ecs_task__ssm_policy" {
role = module.create_user_task.task_role_name
role = module.create_tester_user_task.task_role_name
policy_arn = aws_iam_policy.ssm_policy.arn
}

Expand Down
8 changes: 4 additions & 4 deletions modules/create-rds-postgres-tester/main.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
resource "aws_sfn_state_machine" "create_rds_postgres_tester" {
name = "create-rds-postgres-tester"
resource "aws_sfn_state_machine" "create-tester-user" {
name = "create-tester-user"
role_arn = aws_iam_role.step_function.arn

definition = <<EOF
{
"StartAt": "CreateUser",
"StartAt": "create-tester-user",
"States": {
"CreateUser": {
"Type": "Task",
"Resource": "arn:aws:states:::ecs:runTask.sync",
"Parameters": {
"Cluster": "${aws_ecs_cluster.ecs_cluster.arn}",
"LaunchType": "FARGATE",
"TaskDefinition": "${aws_ecs_task_definition.create_user_task.arn}",
"TaskDefinition": "${aws_ecs_task_definition.create_tester_user_task.arn}",
"NetworkConfiguration": {
"awsvpcConfiguration": {
"Subnets": ["${var.subnet_id}"],
Expand Down
10 changes: 5 additions & 5 deletions modules/create-rds-postgres-tester/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ variable "db_name" {
description = "Database name"
}

variable "load_task_cpu" {
variable "create_tester_user_task_cpu" {
type = number
default = 8192
default = 256 # 0.25 vCPU
description = "CPU resource to allocate to the load task, in millicores"
}

variable "load_task_memory" {
variable "create_tester_user_task_memory" {
type = number
default = 16384
default = 512 # 0.5GB
description = "Memory resource to allocate to the load task, in MiB"
}

variable "load_task_pgrestore_workers" {
variable "create_tester_user_task_pgrestore_workers" {
type = number
default = 8
description = "Number of pgrestore workers, one per CPU core"
Expand Down

0 comments on commit a51a03c

Please sign in to comment.