Git Product home page Git Product logo

terraform-aws-ecs-deploy-pipeline's Introduction

Terraform AWS ECS Deploy Pipeline

Introduction

If you have a github repository with Dockerfile, you can use this module to build an ECS that can be accessed from a custom domain. ย 

Mainly works as follows:

  • This module arranges CodePipeline using github as a hook and resources provisioned to it.
  • The deployment destination of CodePipeline is Fargate in ECS.
  • And ECS is linked to Load Balancer, enable access via its own domain.

Architecture

Usage

simple usage

You can publish the github source by customizing the four values.

  1. Application Name.
  2. Vpc and subnets to use.
  3. Port to Use(Internal and public).
  4. Github repository to use.
provider "aws" {
  region = "ap-northeast-1"
}

locals {
  # 1. Your app name.
  application_name       = "simple-go-ping-api"
  application_name_lower = replace(lower(local.application_name), "/[^a-z0-9]/", "")
}

module "ecs-deployline" {
  source  = "ispec-inc/ecs-deployline/aws"
  version = "0.4.3"

  # 2. Your vpc and subnets id.
  vpc_id         = "vpc-0000000"
  public_subnets = ["subnet-1112", "subnet-2222"]

  cluster_name        = local.application_name
  app_repository_name = local.application_name
  container_name      = local.application_name

  # 3. Port to use
  alb_port         = "8005"
  container_port   = "8005"
  helth_check_path = "/ping"

  # 4. Your github repository.
  git_repository = {
    owner  = "murawakimitsuhiro"
    name   = "go-simple-RESTful-api"
    branch = "feature/only-ping"
  }
}

warning

  • Dockerfile should be placed at the root of the git repository to be used, and be ready to build.
  • In this simple sample, we do not link the domain or use SSL.

For a complete example, including a custom domain. see โ†’ examples/api-server-ssl

Inputs

Name Description Type Default Required
alb_port origin application load balancer port string n/a yes
app_repository_name ecr repository name string "" no
build_args docker build args. map(string) {} no
cluster_name ecs cluster name string "" no
container_name container app name string "" no
container_port destination application load balancer port string n/a yes
cpu_to_scale_down cpu % to scale down the number of containers number 30 no
cpu_to_scale_up cpu % to scale up the number of containers number 80 no
desired_task_cpu desired cpu to run your tasks string "256" no
desired_task_memory desired memory to run your tasks string "512" no
desired_tasks number of containers desired to run app task number 2 no
domain_name domain name. (must be created in route53) string "" no
environment_variables ecs task environment variables map(string)
{
"KEY": "value"
}
no
git_repository git repository. It must contain the following key: owner, name, branch map(string) n/a yes
helth_check_path target group helth check path string "/" no
max_tasks maximum number 4 no
min_tasks minimum number 2 no
public_subnets public subnet array (length>=2) list(string) n/a yes
ssl_certificate_arn ssl certification arn string "" no
vpc_id vpc for provisioning resources string n/a yes

Outputs

Name Description
alb_dns_name DNS address linked to ALB. (automatically)
alb_sg_id ID of ALB security group.
app_sg_id ID of application security group. (ALB and ECS adapted)
cloudwatch_log_group_arn ARN of ecs cloudwatch log group.
code_pipeline_artifact_s3_id ID of s3 bucket for code pipeline artifact store.
code_pipeline_id ID of code pipeline.
ecs-repository-url URL of ECR with build artifacts.
ecs_sg_id ID of ECS security group.
enable_custom_domain Bool value of domain is valid or not.
enable_ssl Bool value of ssl is valid or not.
vpc_id vpc id.
vpc_public_subnet_ids List of IDs of VPC public subnets.

License

Apache 2 Licensed. See LICENSE for full details.

terraform-aws-ecs-deploy-pipeline's People

Contributors

murawakimitsuhiro avatar yamad07 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.