{"id":26959319,"url":"https://github.com/tmknom/terraform-aws-codedeploy-for-ecs","last_synced_at":"2025-04-03T04:37:30.130Z","repository":{"id":56664067,"uuid":"161986216","full_name":"tmknom/terraform-aws-codedeploy-for-ecs","owner":"tmknom","description":"Terraform module which creates CodeDeploy for ECS resources on AWS.","archived":false,"fork":false,"pushed_at":"2021-04-22T09:52:38.000Z","size":34,"stargazers_count":44,"open_issues_count":5,"forks_count":51,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-08-15T19:38:06.562Z","etag":null,"topics":["aws","codedeploy","ecs","terraform","terraform-module"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmknom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-16T09:32:56.000Z","updated_at":"2023-06-17T13:18:01.000Z","dependencies_parsed_at":"2022-08-15T22:50:47.385Z","dependency_job_id":null,"html_url":"https://github.com/tmknom/terraform-aws-codedeploy-for-ecs","commit_stats":null,"previous_names":[],"tags_count":3,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmknom%2Fterraform-aws-codedeploy-for-ecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmknom%2Fterraform-aws-codedeploy-for-ecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmknom%2Fterraform-aws-codedeploy-for-ecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmknom%2Fterraform-aws-codedeploy-for-ecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmknom","download_url":"https://codeload.github.com/tmknom/terraform-aws-codedeploy-for-ecs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246939173,"owners_count":20857916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","codedeploy","ecs","terraform","terraform-module"],"created_at":"2025-04-03T04:37:29.638Z","updated_at":"2025-04-03T04:37:30.112Z","avatar_url":"https://github.com/tmknom.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-aws-codedeploy-for-ecs\n\n[![CircleCI](https://circleci.com/gh/tmknom/terraform-aws-codedeploy-for-ecs.svg?style=svg)](https://circleci.com/gh/tmknom/terraform-aws-codedeploy-for-ecs)\n[![GitHub tag](https://img.shields.io/github/tag/tmknom/terraform-aws-codedeploy-for-ecs.svg)](https://registry.terraform.io/modules/tmknom/codedeploy-for-ecs/aws)\n[![License](https://img.shields.io/github/license/tmknom/terraform-aws-codedeploy-for-ecs.svg)](https://opensource.org/licenses/Apache-2.0)\n\nTerraform module which creates CodeDeploy for ECS resources on AWS.\n\n## Description\n\nProvision [Applications](https://docs.aws.amazon.com/codedeploy/latest/userguide/applications.html),\n[Deployment Groups](https://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-groups.html) and\n[AWS CodeDeploy IAM Role](https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/codedeploy_IAM_role.html).\n\nThis module provides recommended settings:\n\n- ECS Blue/Green deployment\n- Enable automatically rollback\n\n## Usage\n\n### Minimal\n\n```hcl\nmodule \"codedeploy\" {\n  source                     = \"git::https://github.com/tmknom/terraform-aws-codedeploy-for-ecs.git?ref=tags/1.2.0\"\n  name                       = \"example\"\n  ecs_cluster_name           = \"${var.ecs_cluster_name}\"\n  ecs_service_name           = \"${var.ecs_service_name}\"\n  lb_listener_arns           = [\"${var.lb_listener_arns}\"]\n  blue_lb_target_group_name  = \"${var.blue_lb_target_group_name}\"\n  green_lb_target_group_name = \"${var.green_lb_target_group_name}\"\n}\n```\n\n### Complete\n\n```hcl\nmodule \"codedeploy\" {\n  source                     = \"git::https://github.com/tmknom/terraform-aws-codedeploy-for-ecs.git?ref=tags/1.2.0\"\n  name                       = \"example\"\n  ecs_cluster_name           = \"${var.ecs_cluster_name}\"\n  ecs_service_name           = \"${var.ecs_service_name}\"\n  lb_listener_arns           = [\"${var.lb_listener_arns}\"]\n  blue_lb_target_group_name  = \"${var.blue_lb_target_group_name}\"\n  green_lb_target_group_name = \"${var.green_lb_target_group_name}\"\n\n  auto_rollback_enabled            = true\n  auto_rollback_events             = [\"DEPLOYMENT_FAILURE\"]\n  action_on_timeout                = \"STOP_DEPLOYMENT\"\n  wait_time_in_minutes             = 20\n  termination_wait_time_in_minutes = 20\n  test_traffic_route_listener_arns = []\n  iam_path                         = \"/service-role/\"\n  description                      = \"This is example\"\n\n  tags = {\n    Environment = \"prod\"\n  }\n}\n```\n\n## Examples\n\n- [Minimal](https://github.com/tmknom/terraform-aws-codedeploy-for-ecs/tree/master/examples/minimal)\n- [Complete](https://github.com/tmknom/terraform-aws-codedeploy-for-ecs/tree/master/examples/complete)\n\n## Inputs\n\n| Name                             | Description                                                                                                                         |  Type  |                        Default                         | Required |\n| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | :----: | :----------------------------------------------------: | :------: |\n| blue_lb_target_group_name        | Name of the blue target group.                                                                                                      | string |                           -                            |   yes    |\n| ecs_cluster_name                 | The ECS Cluster name.                                                                                                               | string |                           -                            |   yes    |\n| ecs_service_name                 | The ECS Service name.                                                                                                               | string |                           -                            |   yes    |\n| green_lb_target_group_name       | Name of the green target group.                                                                                                     | string |                           -                            |   yes    |\n| lb_listener_arns                 | List of Amazon Resource Names (ARNs) of the load balancer listeners.                                                                |  list  |                           -                            |   yes    |\n| name                             | The name of the application.                                                                                                        | string |                           -                            |   yes    |\n| action_on_timeout                | When to reroute traffic from an original environment to a replacement environment in a blue/green deployment.                       | string |                 `CONTINUE_DEPLOYMENT`                  |    no    |\n| auto_rollback_enabled            | Indicates whether a defined automatic rollback configuration is currently enabled for this Deployment Group.                        | string |                         `true`                         |    no    |\n| auto_rollback_events             | The event type or types that trigger a rollback.                                                                                    |  list  | `[ \"DEPLOYMENT_FAILURE\", \"DEPLOYMENT_STOP_ON_ALARM\" ]` |    no    |\n| description                      | The description of the all resources.                                                                                               | string |                 `Managed by Terraform`                 |    no    |\n| iam_path                         | Path in which to create the IAM Role and the IAM Policy.                                                                            | string |                          `/`                           |    no    |\n| tags                             | A mapping of tags to assign to all resources.                                                                                       |  map   |                          `{}`                          |    no    |\n| termination_wait_time_in_minutes | The number of minutes to wait after a successful blue/green deployment before terminating instances from the original environment.  | string |                          `5`                           |    no    |\n| test_traffic_route_listener_arns | List of Amazon Resource Names (ARNs) of the load balancer to route test traffic listeners.                                          |  list  |                          `[]`                          |    no    |\n| wait_time_in_minutes             | The number of minutes to wait before the status of a blue/green deployment changed to Stopped if rerouting is not started manually. | string |                          `0`                           |    no    |\n\n## Outputs\n\n| Name                           | Description                                             |\n| ------------------------------ | ------------------------------------------------------- |\n| codedeploy_app_id              | Amazon's assigned ID for the application.               |\n| codedeploy_app_name            | The application's name.                                 |\n| codedeploy_deployment_group_id | Application name and deployment group name.             |\n| iam_policy_arn                 | The ARN assigned by AWS to this IAM Policy.             |\n| iam_policy_description         | The description of the IAM Policy.                      |\n| iam_policy_document            | The policy document of the IAM Policy.                  |\n| iam_policy_id                  | The IAM Policy's ID.                                    |\n| iam_policy_name                | The name of the IAM Policy.                             |\n| iam_policy_path                | The path of the IAM Policy.                             |\n| iam_role_arn                   | The Amazon Resource Name (ARN) specifying the IAM Role. |\n| iam_role_create_date           | The creation date of the IAM Role.                      |\n| iam_role_description           | The description of the IAM Role.                        |\n| iam_role_name                  | The name of the IAM Role.                               |\n| iam_role_unique_id             | The stable and unique string identifying the IAM Role.  |\n\n## Troubleshooting\n\n### Invalid ECS Service's DeploymentController\n\nIf you receive the following error message, ECS Service does not configured DeploymentController to CODE_DEPLOY.\n\n```shell\n* module.codedeploy.aws_codedeploy_deployment_group.default: 1 error(s) occurred:\n\n* aws_codedeploy_deployment_group.default: InvalidECSServiceException: Deployment group's ECS service must be configured for the external controller.\n    status code: 400, request id: 88404497-0379-11e9-88cd-9d6929f0e7ec\n```\n\nYou should configure ECS Service's DeploymentController to CODE_DEPLOY.\n\nFor Terraform:\n\n```hcl\nresource \"aws_ecs_service\" \"default\" {\n  ......\n\n  deployment_controller {\n    type = \"CODE_DEPLOY\"\n  }\n}\n```\n\nFor more information, see [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html)\nin the Amazon Elastic Container Service Developer Guide.\n\n## Development\n\n### Requirements\n\n- [Docker](https://www.docker.com/)\n\n### Configure environment variables\n\n```shell\nexport AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE\nexport AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\nexport AWS_DEFAULT_REGION=ap-northeast-1\n```\n\n### Installation\n\n```shell\ngit clone git@github.com:tmknom/terraform-aws-codedeploy-for-ecs.git\ncd terraform-aws-codedeploy-for-ecs\nmake install\n```\n\n### Makefile targets\n\n```text\ncheck-format                   Check format code\ncibuild                        Execute CI build\nclean                          Clean .terraform\ndocs                           Generate docs\nformat                         Format code\nhelp                           Show help\ninstall                        Install requirements\nlint                           Lint code\nrelease                        Release GitHub and Terraform Module Registry\nterraform-apply-complete       Run terraform apply examples/complete\nterraform-apply-minimal        Run terraform apply examples/minimal\nterraform-destroy-complete     Run terraform destroy examples/complete\nterraform-destroy-minimal      Run terraform destroy examples/minimal\nterraform-plan-complete        Run terraform plan examples/complete\nterraform-plan-minimal         Run terraform plan examples/minimal\nupgrade                        Upgrade makefile\n```\n\n### Releasing new versions\n\nBump VERSION file, and run `make release`.\n\n### Terraform Module Registry\n\n- \u003chttps://registry.terraform.io/modules/tmknom/codedeploy-for-ecs/aws\u003e\n\n## License\n\nApache 2 Licensed. See LICENSE for full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmknom%2Fterraform-aws-codedeploy-for-ecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmknom%2Fterraform-aws-codedeploy-for-ecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmknom%2Fterraform-aws-codedeploy-for-ecs/lists"}