Skip to content

Commit 590ea39

Browse files
committed
Add config for jenkins container
1 parent faf8345 commit 590ea39

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ module "td" {
115115

116116
name_prefix = "${var.name_prefix}-jenkins"
117117
container_name = local.container_name
118-
container_image = "cnservices/jenkins-master"
119-
container_cpu = 2048 # 2 vCPU - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
120-
container_memory = 4096 # 4 GB - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
118+
container_image = var.container_image
119+
container_cpu = var.container_cpu # 2 vCPU - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
120+
container_memory = var.container_memory # 4 GB - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
121121
port_mappings = local.td_port_mappings
122122
healthcheck = local.healthcheck
123123
log_configuration = {

variables.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,32 @@ variable "enable_autoscaling" {
4444
default = true
4545
}
4646

47+
#------------------------------------------------------------------------------
48+
# AWS ECS
49+
#------------------------------------------------------------------------------
50+
variable "container_image" {
51+
description = "Name of the docker image used for deploy jenkins"
52+
type = string
53+
default = "cnservices/jenkins-master"
54+
}
55+
56+
#------------------------------------------------------------------------------
57+
# AWS ECS Container Definition Variables
58+
#------------------------------------------------------------------------------
59+
60+
variable "container_memory" {
61+
type = number
62+
description = "(Optional) The amount of memory (in MiB) to allow the container to use. This is a hard limit, if the container attempts to exceed the container_memory, the container is killed. This field is optional for Fargate launch type and the total amount of container_memory of all containers in a task will need to be lower than the task memory value"
63+
default = 4096 # 4 GB
64+
}
65+
66+
variable "container_cpu" {
67+
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
68+
type = number
69+
description = "(Optional) The number of cpu units to reserve for the container. This is optional for tasks using Fargate launch type and the total amount of container_cpu of all containers in a task will need to be lower than the task-level cpu value"
70+
default = 2048 # 2 vCPU
71+
}
72+
4773
#------------------------------------------------------------------------------
4874
# CloudWatch logs
4975
#------------------------------------------------------------------------------

0 commit comments

Comments
 (0)