3.9 KiB

Terraform AWS Jenkins Module

Overview

The terraform-aws-jenkins module provisions a Jenkins CI/CD infrastructure on AWS with auto-scaling capabilities, load balancing, and persistent storage support.

⚠️ WARNING: This module is currently in an incomplete state and requires additional development before production use.

Intended Features

  • Jenkins master server on EC2
  • Auto Scaling Group for high availability
  • Elastic Load Balancer for traffic distribution
  • Persistent EBS volume for Jenkins data
  • SSL/TLS support via ACM certificates
  • Placement group for optimized network performance

Current Status

Known Issues

This module contains several implementation issues that need to be resolved:

  1. Syntax Errors:

    • Incorrect variable interpolation syntax
    • Malformed resource references
  2. Missing Resources:

    • Placement group resource not defined
    • Launch configuration resource not defined
    • Subnet resources referenced but not created
    • Security group configuration missing
  3. Missing Outputs:

    • No outputs.tf file
    • Load Balancer DNS, Auto Scaling Group details not exposed
  4. Hardcoded Values:

    • Environment-specific values embedded (region, AMI ID, volume ID)
    • Domain-specific Jenkins URL

Resources (Partial Implementation)

The module attempts to create:

  • AWS Auto Scaling Group - Single instance configuration
  • AWS Placement Group (referenced, not defined)
  • AWS Launch Configuration (referenced, not defined)
  • AWS Elastic Load Balancer (implied by health check)
  • AWS EBS Volume (referenced, not created)

Variables

Variable Type Default Description
project string Required Project name
env string Required Environment/Stage identifier
jenkins_version string "" Version of Jenkins to install
jenkins_url string stg-jenkins.build.edubase.malmberg.nl Jenkins URL
loadbalancer_name string stg-jenkins ELB name
loadbalancer_certificate string arn:aws:acm:... ACM certificate ARN for HTTPS
ami_id string ami-03a779dec4508895a AMI ID for Jenkins instance
instance_type string c5.xlarge EC2 instance type
persistent_volume_id string vol-03dde8c1fabe3de46 EBS volume ID for persistence

Prerequisites

  • Existing VPC with subnets
  • Pre-existing ACM SSL certificate
  • Pre-existing EBS volume for persistent storage
  • AMI with Jenkins pre-installed or provisioning script
  • Route53 DNS configuration

Development Roadmap

Before this module can be used in production:

  1. Fix syntax errors and variable interpolation
  2. Define missing resources (placement group, launch configuration)
  3. Implement security groups
  4. Create outputs.tf with essential values
  5. Parameterize hardcoded values
  6. Add IAM role configuration
  7. Implement proper error handling
  8. Add comprehensive examples
  9. Write integration tests

Intended Usage Pattern

# Example (NOT WORKING - for reference only)
module "jenkins" {
  source = "path/to/terraform-aws-jenkins"

  project                   = "myproject"
  env                       = "staging"
  jenkins_version           = "2.361.1"
  jenkins_url               = "jenkins.example.com"
  loadbalancer_name         = "jenkins-lb"
  loadbalancer_certificate  = "arn:aws:acm:region:account:certificate/..."
  ami_id                    = "ami-xxxxxxxxx"
  instance_type             = "c5.xlarge"
  persistent_volume_id      = "vol-xxxxxxxxx"
}

Contributing

Contributions to complete this module are welcome. Priority areas:

  • Fix existing syntax errors
  • Complete resource definitions
  • Add comprehensive documentation
  • Implement security best practices
  • Add examples and tests

License

See project license file.

Authors

Maintained by WebBuildYourCloud team.


Note: Do not use this module in production environments until the known issues have been resolved.