Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variables for task and container CPU and memory #65

Merged
merged 5 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
leslie-corbalt marked this conversation as resolved.
Show resolved Hide resolved
}

variable "task_memory" {
description = "The ECS Task memroy size"
leslie-corbalt marked this conversation as resolved.
Show resolved Hide resolved
type = number
default = 1024
}

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

variable "container_memory" {
description = "The container memroy size"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just saw this typo!

type = number
default = 1024
}