Skip to content

Commit

Permalink
Add config for jenkins container (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktibi authored Apr 19, 2023
1 parent 979521d commit 8e0cfaa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ module "td" {

name_prefix = "${var.name_prefix}-jenkins"
container_name = local.container_name
container_image = "cnservices/jenkins-master"
container_cpu = 2048 # 2 vCPU - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
container_memory = 4096 # 4 GB - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
container_image = var.container_image
container_cpu = var.container_cpu
container_memory = var.container_memory
port_mappings = local.td_port_mappings
healthcheck = local.healthcheck
log_configuration = {
Expand All @@ -135,7 +135,7 @@ module "td" {
docker_volume_configuration = []
efs_volume_configuration = [{
file_system_id = aws_efs_file_system.jenkins_data.id
root_directory = "/var/jenkins_home"
root_directory = "/"
transit_encryption = "DISABLED"
transit_encryption_port = null
authorization_config = []
Expand Down
27 changes: 27 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,33 @@ variable "enable_autoscaling" {
default = true
}

#------------------------------------------------------------------------------
# AWS ECS
#------------------------------------------------------------------------------
variable "container_image" {
description = "Name of the docker image used for deploy jenkins"
type = string
default = "cnservices/jenkins-master"
}

#------------------------------------------------------------------------------
# AWS ECS Container Definition Variables
#------------------------------------------------------------------------------

# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
variable "container_memory" {
type = number
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"
default = 4096 # 4 GB
}

# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
variable "container_cpu" {
type = number
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"
default = 2048 # 2 vCPU
}

#------------------------------------------------------------------------------
# CloudWatch logs
#------------------------------------------------------------------------------
Expand Down

0 comments on commit 8e0cfaa

Please sign in to comment.