diff --git a/main.tf b/main.tf index f7a13e3..bb31f3d 100644 --- a/main.tf +++ b/main.tf @@ -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 = { @@ -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 = [] diff --git a/variables.tf b/variables.tf index 69a028d..94b9e5d 100644 --- a/variables.tf +++ b/variables.tf @@ -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 #------------------------------------------------------------------------------