aarongorka / terraform-aws-jenkins

A Terraform module for deploying Jenkins master and build agents in AWS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jenkins Terraform Module

A Terraform module that deploys a multi-az master using ebs-pin and a spot ASG for build agents using Self-Organizing Swarm Plug-in. The build agents scale preemtively based on demand using jenkins-autoscaler.

Inputs

Name Description Type Default Required
agents_disk_size Size of root volume on Jenkins agents string "50" no
agents_instance_type Instance type of agents string "c5.large" no
agents_max_size Max size of agents ASG string "20" no
agents_min_size Minimum size of agents ASG string "2" no
agents_spot_price Max price for spot bids on agents string "0.5" no
agents_subnet_ids Subnet IDs for the Jenkins agents. list n/a yes
ami_id AMI ID used by the Jenkins master instance string "ami-08589eca6dcc9b39c" no
asg_tags Tags used for ASGs, has an addition attribute propagate_at_launch on every map. Do not include 'Name'. list n/a yes
aws_key_pair_name Keypair for the Jenkins master instance string n/a yes
aws_key_pair_public_key Public Key in authorized_keys format string n/a yes
dns_base_name DNS base zone, e.g. example.com string n/a yes
dns_name DNS record created for Jenkins master in dns_zone string n/a yes
dns_zone DNS zone ID used for Jenkins records string n/a yes
http_proxy HTTP Proxy used in the Jenkins userdata script string n/a yes
instance_type Instance type used by Jenkins master instance string "t3.medium" no
jenkins-cert ACM Certificate Domain Name for Jenkins string n/a yes
jenkins_unique_id Unique ID used to identify the EBS volume accross instance terminations string n/a yes
lb_subnet_ids Subnet IDs for the ALB. list n/a yes
master_ebs_jenkinshome_size Size of the master jenkins home volume string "50" no
master_ebs_root_size Size of the master EBS root volume string "20" no
master_subnet_ids Subnet ID for the Jenkins master instance. Multi AZ is supported :) list n/a yes
no_proxy Proxy exceptions used in the Jenkins userdata script string n/a yes
tags Tags used for all resources except asgs map n/a yes
vpc_id VPC ID used by the Jenkins master instance string n/a yes

Outputs

Name Description
master_ssh SSH to access the Jenkins master instance
url URL to access the Jenkins UI

Manual Steps Required

  1. Go through Jenkins setup, install recommended plugins and configure the proxy if required
  2. Install Self-Organizing Swarm Plug-in Modules and Blue Ocean plugin
  3. Enable JNLP port on 43863
  4. Create a local Jenkins service account called "agents" and put password in SSM with the key JENKINS_AGENTS_PASSWORD.
  5. Terminate agents and ensure they connect. Set number of build executors on the master to 0 (Manage Jenkins -> Manage Nodes -> Master).
  6. Terminate the master and ensure that it reboots with the correct data, and that metrics from jenkins-autoscaler are being output to CloudWatch Metrics
  7. Configure SCM plugins if required

About

A Terraform module for deploying Jenkins master and build agents in AWS.

License:GNU General Public License v3.0


Languages

Language:HCL 68.1%Language:Shell 31.9%