Code Monkey home page Code Monkey logo

terraform-aws-codepipeline-for-ecs's Introduction

terraform-aws-codepipeline-for-ecs

CircleCI GitHub tag License

Terraform module which creates CodePipeline for ECS resources on AWS.

Description

Provision CodePipeline and GitHub Webhooks.

This module provides recommended settings:

  • Integration with GitHub
  • Disable periodic checks
  • Securing webhooks

Usage

Minimal

module "codepipeline" {
  source               = "git::https://github.com/tmknom/terraform-aws-codepipeline-for-ecs.git?ref=tags/1.1.0"
  name                 = "example"
  artifact_bucket_name = "${var.artifact_bucket_name}"
  github_oauth_token   = "xxxxxxxx"
  repository_owner     = "tmknom"
  repository_name      = "terraform-aws-codepipeline-for-ecs"
  project_name         = "${var.project_name}"
  cluster_name         = "${var.cluster_name}"
  service_name         = "${var.service_name}"
}

Complete

module "codepipeline" {
  source               = "git::https://github.com/tmknom/terraform-aws-codepipeline-for-ecs.git?ref=tags/1.1.0"
  name                 = "example"
  artifact_bucket_name = "${var.artifact_bucket_name}"
  github_oauth_token   = "xxxxxxxx"
  repository_owner     = "tmknom"
  repository_name      = "terraform-aws-codepipeline-for-ecs"
  project_name         = "${var.project_name}"
  cluster_name         = "${var.cluster_name}"
  service_name         = "${var.service_name}"

  encryption_key_id       = ""
  branch                  = "develop"
  poll_for_source_changes = false
  file_name               = "image.json"
  secret_token            = "YouShouldSetVeryStrongSecretToken!"
  filter_json_path        = "$.ref"
  filter_match_equals     = "refs/heads/{Branch}"
  webhook_events          = ["push"]
  iam_path                = "/service-role/"
  description             = "This is example"

  tags = {
    Environment = "prod"
  }
}

Examples

Inputs

Name Description Type Default Required
artifact_bucket_name The S3 Bucket name of artifacts. string - yes
cluster_name The name of the ECS Cluster. string - yes
github_oauth_token The OAuth Token of GitHub. string - yes
name The name of the pipeline. string - yes
project_name The project name of the CodeBuild. string - yes
repository_name The name of the repository. string - yes
repository_owner The owner of the repository. string - yes
service_name The name of the ECS Service. string - yes
branch The name of the branch. string master no
description The description of the all resources. string Managed by Terraform no
encryption_key_id The KMS key ARN or ID. string `` no
file_name The file name of the image definitions. string imagedefinitions.json no
filter_json_path The JSON path to filter on. string $.ref no
filter_match_equals The value to match on (e.g. refs/heads/{Branch}). string refs/heads/{Branch} no
iam_path Path in which to create the IAM Role and the IAM Policy. string / no
poll_for_source_changes Specify true to indicate that periodic checks enabled. string false no
secret_token The secret token for the GitHub webhook. string `` no
tags A mapping of tags to assign to all resources. map {} no
webhook_events A list of events which should trigger the webhook. list [ "push" ] no

Outputs

Name Description
codepipeline_arn The codepipeline ARN.
codepipeline_id The codepipeline ID.
codepipeline_webhook_id The CodePipeline webhook's ARN.
codepipeline_webhook_url The CodePipeline webhook's URL. POST events to this endpoint to trigger the target.
github_repository_webhook_url URL of the webhook.
iam_policy_arn The ARN assigned by AWS to this IAM Policy.
iam_policy_description The description of the IAM Policy.
iam_policy_document The policy document of the IAM Policy.
iam_policy_id The IAM Policy's ID.
iam_policy_name The name of the IAM Policy.
iam_policy_path The path of the IAM Policy.
iam_role_arn The Amazon Resource Name (ARN) specifying the IAM Role.
iam_role_create_date The creation date of the IAM Role.
iam_role_description The description of the IAM Role.
iam_role_name The name of the IAM Role.
iam_role_unique_id The stable and unique string identifying the IAM Role.

Development

Requirements

Configure environment variables

export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=ap-northeast-1

Installation

git clone [email protected]:tmknom/terraform-aws-codepipeline-for-ecs.git
cd terraform-aws-codepipeline-for-ecs
make install

Makefile targets

check-format                   Check format code
cibuild                        Execute CI build
clean                          Clean .terraform
docs                           Generate docs
format                         Format code
help                           Show help
install                        Install requirements
lint                           Lint code
release                        Release GitHub and Terraform Module Registry
terraform-apply-complete       Run terraform apply examples/complete
terraform-apply-minimal        Run terraform apply examples/minimal
terraform-destroy-complete     Run terraform destroy examples/complete
terraform-destroy-minimal      Run terraform destroy examples/minimal
terraform-plan-complete        Run terraform plan examples/complete
terraform-plan-minimal         Run terraform plan examples/minimal
upgrade                        Upgrade makefile

Releasing new versions

Bump VERSION file, and run make release.

Terraform Module Registry

License

Apache 2 Licensed. See LICENSE for full details.

terraform-aws-codepipeline-for-ecs's People

Contributors

tmknom 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.