Add comprehensive README and update module documentation

This commit is contained in:
Patrick de Ruiter 2025-11-01 10:19:32 +01:00
commit ddfb8888d5
Signed by: pderuiter
GPG Key ID: 5EBA7F21CF583321
5 changed files with 190 additions and 0 deletions

127
README.md Normal file
View File

@ -0,0 +1,127 @@
# 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
```hcl
# 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.

12
main.tf Executable file
View File

@ -0,0 +1,12 @@
resource "aws_autoscaling_group" "jenkins_autoscaling_group" {
name = ""
max_size = 1
min_size = 1
health_check_grace_period = 300
health_check_type = "ELB"
desired_capacity = 1
force_delete = true
placement_group = "aws_placement_group.jenkins-${env}.id"
launch_configuration = "aws_launch_configuration.jenkins.jenkins-${env}"
vpc_zone_identifier = [ "aws_subnet.jenkins1.id, aws_subnet.jenkins2.id, aws_subnet.jenkins3.id" ]
}

0
provider.tf Executable file
View File

0
terraform.tfvars Executable file
View File

51
variables.tf Executable file
View File

@ -0,0 +1,51 @@
variable "project" {
description = "Project name"
type = string
}
variable "env" {
description = "Environment/Stage"
type = string
}
variable "jenkins_version" {
description = "Define the version of Jenkins that needs to be installed"
type = string
default = ""
}
variable "jenkins_url" {
description = "Define the url on which Jenkins should be reachable"
type = string
default = "stg-jenkins.build.edubase.malmberg.nl"
}
variable "loadbalancer_name" {
description = "Define name for the ELB"
type = string
default = "stg-jenkins"
}
variable "loadbalancer_certificate" {
description = "Define certificate for ELB"
type = string
default = "arn:aws:acm:eu-west-1:439778125761:certificate/07ea8bf6-f5ae-4c65-ae87-921fc29c980f"
}
variable "ami_id" {
description = "Define the AMI for the Jenkins master"
type = string
default = "ami-03a779dec4508895a"
}
variable "instance_type" {
description = "EC2 Instance type for the Jenkins master"
type = string
default = "c5.xlarge"
}
variable "persistent_volume_id" {
description = "Define ID of the persistent volume"
type = string
default = "vol-03dde8c1fabe3de46"
}