Giter Club home page Giter Club logo

terraform-bluegreen's Introduction

terraform-bluegreen

Terraform module to setup blue / green deployments

##blue-green

Variables

See the blue-green/variables.tf file.

Outputs

  • blue_asg_id: (Number) blue autoscaling group id
  • green_asg_id: (Number) green autoscaling group id

Example

module "bluegreen" {
  source = "github.com/skyscrapers/terraform-bluegreen//blue-green"
  project = "example"
  name = "app"
  environment = "production"
  blue_ami = "ami-blabla"
  green_ami = "ami-blabla"
  instance_type = "t2.micro"
  loadbalancers = []
  blue_max_size = "5"
  blue_min_size = "2"
  blue_desired_capacity = "2"
  green_max_size = "0"
  green_min_size = "0"
  green_desired_capacity = "0"
  security_groups = []
}

cpu-scaling

Terraform module to setup alarms and autoscaling triggers for autoscaling

Variables

See the cpu-scaling/variables.tf file.

Outputs

/

Example

module "cpu-scaling" {
  source = "github.com/skyscrapers/terraform-bluegreen//cpu-scaling"
  project = "example"
  name = "app"
  environment = "production"
  autoscaling_group_name = ["my_asg_name1","my_asg_name2"]
}

Blue-green deployments

The bluegreen.py script performs a bluegreen deployment of the selected terraform stack. It only works with Python 2.7. The blue-green deployment script expects certain inputs and outputs in the Terraform project you want to deploy in a blue-green fashion.

Required outputs:

output "blue_asg_id" {
  value = "${module.<blue-green-module-name>.blue_asg_id}"
}

output "green_asg_id" {
  value = "${module.<blue-green-module-name>.green_asg_id}"
}

Required variables:

variable "blue_max_size" {
  description = "max instances blue"
}

variable "blue_min_size" {
  description = "min instances blue"
}

variable "blue_desired_capacity" {
  description = "desired instances blue"
}

variable "green_max_size" {
  description = "max instances green"
}

variable "green_min_size" {
  description = "min instances green"
}

variable "green_desired_capacity" {
  description = "desired instances green"
}

variable "blue_ami" {
  description = "blue ami"
}

variable "green_ami" {
  description = "green ami"
}

These input variables need to be assigned to your module. Make sure you do a terraform refresh to be sure that the terraform outputs are saved in the Terraform state file.

Usage

First you need to install the requirements:

pip install -r requirements.txt

Run ./bluegreen.py --help to see the available options.

Example:

./bluegreen.py -f stacks/test/application -a ami-xxxx -c apply -t 500

terraform-bluegreen's People

Contributors

iuriaranda avatar simonrondelez avatar ringods avatar minniux avatar venturel avatar mattiasgees avatar thomasvdberge avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.