-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert to TF 0.12. Add tests. Add Codefresh test pipeline (#49)
* Convert to TF 0.12 * Convert to TF 0.12 * Convert to TF 0.12 * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Convert to TF 0.12. Add tests. Add Codefresh test pipeline * Update tests * Update tests * Update tests * Update `terraform-aws-elastic-beanstalk-application` version
- Loading branch information
Showing
27 changed files
with
1,813 additions
and
754 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
*.iml | ||
|
||
.build-harness | ||
build-harness | ||
build-harness |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,9 +38,9 @@ github_repo: cloudposse/terraform-aws-jenkins | |
|
||
# Badges to display | ||
badges: | ||
- name: "Build Status" | ||
image: "https://travis-ci.org/cloudposse/terraform-aws-jenkins.svg?branch=master" | ||
url: "https://travis-ci.org/cloudposse/terraform-aws-jenkins" | ||
- name: "Codefresh Build Status" | ||
image: "https://g.codefresh.io/api/badges/pipeline/cloudposse/terraform-modules%2Fterraform-aws-jenkins?type=cf-1" | ||
url: "https://g.codefresh.io/public/accounts/cloudposse/pipelines/5d9fea1192fba6201f04faca" | ||
- name: "Latest Release" | ||
image: "https://img.shields.io/github/release/cloudposse/terraform-aws-jenkins.svg" | ||
url: "https://github.com/cloudposse/terraform-aws-jenkins/releases/latest" | ||
|
@@ -49,7 +49,7 @@ badges: | |
url: "https://slack.cloudposse.com" | ||
|
||
related: | ||
- name: "terraform-aws-elastic-beanstalk-applicationl" | ||
- name: "terraform-aws-elastic-beanstalk-application" | ||
description: "Terraform module to provision AWS Elastic Beanstalk application" | ||
url: "https://github.com/cloudposse/terraform-aws-elastic-beanstalk-application" | ||
- name: "terraform-aws-elastic-beanstalk-environment" | ||
|
@@ -77,6 +77,7 @@ description: |- | |
and deploy to [Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/) running [Docker](https://www.docker.com/). | ||
This is an enterprise-ready, scalable and highly-available architecture and the CI/CD pattern to build and deploy Jenkins. | ||
## Features | ||
The module will create the following AWS resources: | ||
|
@@ -85,9 +86,8 @@ description: |- | |
* Elastic Beanstalk Environment with Docker stack to run the Jenkins master | ||
* ECR repository to store the Jenkins Docker image | ||
* EFS filesystem to store Jenkins config and jobs (it will be mounted to a directory on the EC2 host, and then to the Docker container) | ||
* AWS Backup stack to automatically backup the EFS | ||
* CodePipeline with CodeBuild to build and deploy Jenkins so even Jenkins itself follows the CI/CD pattern | ||
* CloudFormation stack to run a DataPipeline to automatically backup the EFS to S3 | ||
* CloudFormation stack for SNS notifications about the status of each backup | ||
After all of the AWS resources are created, | ||
|
@@ -101,225 +101,92 @@ description: |- | |
* Monitor the GitHub repo for changes and re-run the steps above if new commits are pushed | ||
__DataPipeline__ will run on the specified schedule and will backup all Jenkins files to an S3 bucket by doing the following: | ||
* Spawn an EC2 instance | ||
* Mount the EFS filesystem to a directory on the EC2 instance | ||
* Backup the directory to an S3 bucket | ||
* Notify about the status of the backup (Success or Failure) via email | ||
* Destroy the EC2 instance | ||
 | ||
# How to use this project | ||
usage: |- | ||
For complete examples, see [examples](examples). | ||
For a complete example, see [examples/complete](examples/complete). | ||
# Example usage | ||
|
||
examples: |- | ||
### Deploy Jenkins into an existing VPC with existing subnets | ||
For automatic tests of the complete example, see [test](test). | ||
```hcl | ||
variable "max_availability_zones" { | ||
default = "2" | ||
provider "aws" { | ||
region = var.region | ||
} | ||
data "aws_availability_zones" "available" {} | ||
module "jenkins" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-jenkins.git?ref=master" | ||
namespace = "cp" | ||
name = "jenkins" | ||
stage = "prod" | ||
description = "Jenkins server as Docker container running on Elastic Beanstalk" | ||
master_instance_type = "t2.medium" | ||
aws_account_id = "000111222333" | ||
aws_region = "us-west-2" | ||
availability_zones = ["${slice(data.aws_availability_zones.available.names, 0, var.max_availability_zones)}"] | ||
vpc_id = "vpc-a22222ee" | ||
zone_id = "ZXXXXXXXXXXX" | ||
public_subnets = ["subnet-e63f82cb", "subnet-e66f44ab", "subnet-e88f42bd"] | ||
private_subnets = ["subnet-e99d23eb", "subnet-e77e12bb", "subnet-e58a52bc"] | ||
loadbalancer_certificate_arn = "XXXXXXXXXXXXXXXXX" | ||
ssh_key_pair = "ssh-key-jenkins" | ||
github_oauth_token = "" | ||
github_organization = "cloudposse" | ||
github_repo_name = "jenkins" | ||
github_branch = "master" | ||
datapipeline_config = { | ||
instance_type = "t2.medium" | ||
email = "[email protected]" | ||
period = "12 hours" | ||
timeout = "60 Minutes" | ||
} | ||
env_vars = { | ||
JENKINS_USER = "admin" | ||
JENKINS_PASS = "123456" | ||
JENKINS_NUM_EXECUTORS = 4 | ||
} | ||
tags = { | ||
BusinessUnit = "ABC" | ||
Department = "XYZ" | ||
} | ||
} | ||
``` | ||
### Deploy Jenkins into an existing VPC and new subnets | ||
```hcl | ||
variable "max_availability_zones" { | ||
default = "2" | ||
} | ||
data "aws_availability_zones" "available" {} | ||
module "jenkins" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-jenkins.git?ref=master" | ||
namespace = "cp" | ||
name = "jenkins" | ||
stage = "prod" | ||
description = "Jenkins server as Docker container running on Elastic Beanstalk" | ||
master_instance_type = "t2.medium" | ||
aws_account_id = "000111222333" | ||
aws_region = "us-west-2" | ||
availability_zones = ["${slice(data.aws_availability_zones.available.names, 0, var.max_availability_zones)}"] | ||
vpc_id = "vpc-a22222ee" | ||
zone_id = "ZXXXXXXXXXXX" | ||
public_subnets = "${module.subnets.public_subnet_ids}" | ||
private_subnets = "${module.subnets.private_subnet_ids}" | ||
loadbalancer_certificate_arn = "XXXXXXXXXXXXXXXXX" | ||
ssh_key_pair = "ssh-key-jenkins" | ||
github_oauth_token = "" | ||
github_organization = "cloudposse" | ||
github_repo_name = "jenkins" | ||
github_branch = "master" | ||
datapipeline_config = { | ||
instance_type = "t2.medium" | ||
email = "[email protected]" | ||
period = "12 hours" | ||
timeout = "60 Minutes" | ||
} | ||
env_vars = { | ||
JENKINS_USER = "admin" | ||
JENKINS_PASS = "123456" | ||
JENKINS_NUM_EXECUTORS = 4 | ||
} | ||
tags = { | ||
BusinessUnit = "ABC" | ||
Department = "XYZ" | ||
} | ||
module "vpc" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=tags/0.8.0" | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
attributes = var.attributes | ||
tags = var.tags | ||
delimiter = var.delimiter | ||
cidr_block = "172.16.0.0/16" | ||
} | ||
module "subnets" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=master" | ||
availability_zones = ["${slice(data.aws_availability_zones.available.names, 0, var.max_availability_zones)}"] | ||
namespace = "cp" | ||
name = "jenkins" | ||
stage = "prod" | ||
region = "us-west-2" | ||
vpc_id = "vpc-a22222ee" | ||
igw_id = "igw-s32321vd" | ||
cidr_block = "10.0.0.0/16" | ||
nat_gateway_enabled = "true" | ||
tags = { | ||
BusinessUnit = "ABC" | ||
Department = "XYZ" | ||
} | ||
} | ||
``` | ||
### Deploy Jenkins into a new VPC and new subnets | ||
```hcl | ||
variable "max_availability_zones" { | ||
default = "2" | ||
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=tags/0.16.0" | ||
availability_zones = var.availability_zones | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
attributes = var.attributes | ||
tags = var.tags | ||
delimiter = var.delimiter | ||
vpc_id = module.vpc.vpc_id | ||
igw_id = module.vpc.igw_id | ||
cidr_block = module.vpc.vpc_cidr_block | ||
nat_gateway_enabled = true | ||
nat_instance_enabled = false | ||
} | ||
data "aws_availability_zones" "available" {} | ||
module "jenkins" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-jenkins.git?ref=master" | ||
namespace = "cp" | ||
name = "jenkins" | ||
stage = "prod" | ||
description = "Jenkins server as Docker container running on Elastic Beanstalk" | ||
master_instance_type = "t2.medium" | ||
aws_account_id = "000111222333" | ||
aws_region = "us-west-2" | ||
availability_zones = ["${slice(data.aws_availability_zones.available.names, 0, var.max_availability_zones)}"] | ||
vpc_id = "${module.vpc.vpc_id}" | ||
zone_id = "ZXXXXXXXXXXX" | ||
public_subnets = "${module.subnets.public_subnet_ids}" | ||
private_subnets = "${module.subnets.private_subnet_ids}" | ||
loadbalancer_certificate_arn = "XXXXXXXXXXXXXXXXX" | ||
ssh_key_pair = "ssh-key-jenkins" | ||
github_oauth_token = "" | ||
github_organization = "cloudposse" | ||
github_repo_name = "jenkins" | ||
github_branch = "master" | ||
datapipeline_config = { | ||
instance_type = "t2.medium" | ||
email = "[email protected]" | ||
period = "12 hours" | ||
timeout = "60 Minutes" | ||
} | ||
namespace = var.namespace | ||
stage = var.stage | ||
name = var.name | ||
description = var.description | ||
master_instance_type = var.master_instance_type | ||
aws_account_id = var.aws_account_id | ||
region = var.region | ||
availability_zones = var.availability_zones | ||
vpc_id = module.vpc.vpc_id | ||
dns_zone_id = var.dns_zone_id | ||
loadbalancer_subnets = module.subnets.public_subnet_ids | ||
application_subnets = module.subnets.private_subnet_ids | ||
environment_type = var.environment_type | ||
loadbalancer_type = var.loadbalancer_type | ||
loadbalancer_certificate_arn = var.loadbalancer_certificate_arn | ||
availability_zone_selector = var.availability_zone_selector | ||
rolling_update_type = var.rolling_update_type | ||
loadbalancer_logs_bucket_force_destroy = var.loadbalancer_logs_bucket_force_destroy | ||
cicd_bucket_force_destroy = var.cicd_bucket_force_destroy | ||
github_oauth_token = var.github_oauth_token | ||
github_organization = var.github_organization | ||
github_repo_name = var.github_repo_name | ||
github_branch = var.github_branch | ||
image_tag = var.image_tag | ||
healthcheck_url = var.healthcheck_url | ||
build_image = var.build_image | ||
build_compute_type = var.build_compute_type | ||
efs_backup_schedule = var.efs_backup_schedule | ||
efs_backup_start_window = var.efs_backup_start_window | ||
efs_backup_completion_window = var.efs_backup_completion_window | ||
efs_backup_cold_storage_after = var.efs_backup_cold_storage_after | ||
efs_backup_delete_after = var.efs_backup_delete_after | ||
env_vars = { | ||
JENKINS_USER = "admin" | ||
JENKINS_PASS = "123456" | ||
JENKINS_NUM_EXECUTORS = 4 | ||
} | ||
tags = { | ||
BusinessUnit = "ABC" | ||
Department = "XYZ" | ||
} | ||
} | ||
module "vpc" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-vpc.git?ref=master" | ||
namespace = "cp" | ||
name = "jenkins" | ||
stage = "prod" | ||
cidr_block = "10.0.0.0/16" | ||
tags = { | ||
BusinessUnit = "ABC" | ||
Department = "XYZ" | ||
} | ||
} | ||
module "subnets" { | ||
source = "git::https://github.com/cloudposse/terraform-aws-dynamic-subnets.git?ref=master" | ||
availability_zones = ["${slice(data.aws_availability_zones.available.names, 0, var.max_availability_zones)}"] | ||
namespace = "cp" | ||
name = "jenkins" | ||
stage = "prod" | ||
region = "us-west-2" | ||
vpc_id = "${module.vpc.vpc_id}" | ||
igw_id = "${module.vpc.igw_id}" | ||
cidr_block = "${module.vpc.vpc_cidr_block}" | ||
nat_gateway_enabled = "true" | ||
tags = { | ||
BusinessUnit = "ABC" | ||
Department = "XYZ" | ||
"JENKINS_USER" = var.jenkins_username | ||
"JENKINS_PASS" = var.jenkins_password | ||
"JENKINS_NUM_EXECUTORS" = var.jenkins_num_executors | ||
} | ||
} | ||
``` | ||
|
@@ -335,9 +202,18 @@ include: | |
|
||
# Contributors to this project | ||
contributors: | ||
- name: "Erik Osterman" | ||
homepage: "https://github.com/osterman" | ||
github: "osterman" | ||
- name: "Andriy Knysh" | ||
homepage: "https://github.com/aknysh/" | ||
github: "aknysh" | ||
- name: "Igor Rodionov" | ||
homepage: "https://github.com/goruha/" | ||
github: "goruha" | ||
- name: "Ivan Pinatti" | ||
homepage: "https://github.com/ivan-pinatti/" | ||
github: "ivan-pinatti" | ||
- name: "Sergey Vasilyev" | ||
github: "s2504s" | ||
homepage: "https://github.com/s2504s/" | ||
github: "s2504s" |
Oops, something went wrong.