Create environment and deployment pipelines to ECS Fargate with CodePipeline, CodeBuild and Github using Terraform
MIT License
Create environment and deployment pipelines using ECS, ECR, CodePipeline and Git with Terraform
Edit variables.tf
file to customize application preferences like Github account, repo and owner, Load Balancer ports and cluster preferences.
# Customize the Cluster Name
variable "cluster_name" {
description = "ECS Cluster Name"
default = "web-app"
}
# Customize your ECR Registry Name
variable "app_repository_name" {
description = "ECR Repository Name"
default = "web-app"
}
###### APPLICATION OPTIONS ######
variable "container_name" {
description = "Container app name"
default = "micro-api"
}
Edit the Github preferences in the same file to specify infos like repo, owner or organization, branches e etc.
# Github Repository Owner
variable "git_repository_owner" {
description = "Github Repository Owner"
default = "msfidelis"
}
# Github Repository Project Name
variable "git_repository_name" {
description = "Project name on Github"
default = "micro-api"
}
# Default Branch
variable "git_repository_branch" {
description = "Github Project Branch"
default = "master"
}
# Number of containers
variable "desired_tasks" {
description = "Number of containers desired to run app task"
default = 2
}
variable "min_tasks" {
description = "Minimum"
default = 2
}
variable "max_tasks" {
description = "Maximum"
default = 4
}
variable "cpu_to_scale_up" {
description = "CPU % to Scale Up the number of containers"
default = 80
}
variable "cpu_to_scale_down" {
description = "CPU % to Scale Down the number of containers"
default = 30
}
This demo build, dockerize and deploy a simple Node.JS application. Customize your build steps on modules/pipeline/templates/buildspec.yml
file.
Create your Github Access Token to Command Line. This link have all information about this.
Export Github Token as an environment variable.
export GITHUB_TOKEN=YOUR_TOKEN
terraform init
terraform plan
terraform apply