Skip to content

Commit

Permalink
Merge pull request #65 from CMSgov/add-cpu-mem-vars
Browse files Browse the repository at this point in the history
Add variables for task and container CPU and memory
  • Loading branch information
crbudzeak authored Jan 12, 2022
2 parents 3db94a9 + 2454cc4 commit 1a0200b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-merge-conflict
- id: detect-private-key
- id: trailing-whitespace

- repo: git://github.com/igorshubovych/markdownlint-cli
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.28.1
hooks:
- id: markdownlint
Expand All @@ -17,12 +17,12 @@ repos:
- id: dockerfilelint
stages: [commit]

- repo: git://github.com/detailyang/pre-commit-shell
- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.5
hooks:
- id: shell-lint

- repo: git://github.com/antonbabenko/pre-commit-terraform
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.50.0
hooks:
- id: terraform_fmt
4 changes: 2 additions & 2 deletions container-definitions.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
"name": "gh-runner-${gh_name_hash}",
"image": "${ecr_repo_url}:${ecr_repo_tag}",
"cpu": 128,
"memory": 1024,
"cpu": ${container_cpu},
"memory": ${container_memory},
"essential": true,
"portMappings": [],
"environment": [
Expand Down
6 changes: 4 additions & 2 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,14 @@ resource "aws_ecs_task_definition" "runner_def" {
task_role_arn = aws_iam_role.task_role.arn

requires_compatibilities = ["FARGATE"]
cpu = "256"
memory = "1024"
cpu = var.task_cpu
memory = var.task_memory
execution_role_arn = aws_iam_role.task_role.arn

container_definitions = templatefile("${path.module}/container-definitions.tpl",
{
container_cpu = var.container_cpu,
container_memory = var.container_memory,
gh_name_hash = local.gh_name_hash,
ecr_repo_url = var.ecr_repo_url,
ecr_repo_tag = var.ecr_repo_tag,
Expand Down
24 changes: 24 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,28 @@ variable "permissions_boundary" {
description = "ARN of the policy that is used to set the permissions boundary for the role"
type = string
default = ""
}

variable "task_cpu" {
description = "The ECS Task CPU size"
type = number
default = 256
}

variable "task_memory" {
description = "The ECS Task memory size"
type = number
default = 1024
}

variable "container_cpu" {
description = "The container CPU size"
type = number
default = 128
}

variable "container_memory" {
description = "The container memory size"
type = number
default = 1024
}

0 comments on commit 1a0200b

Please sign in to comment.