Skip to content

Commit

Permalink
Pass attributes (#19)
Browse files Browse the repository at this point in the history
* Pass attributes

* add output

* Remove deprecated var

* Add attributes

* update readme

* increase label version

* Increase label ver

* Bump aws-ecs-alb-service to 0.6.3
  • Loading branch information
osterman authored and joshmyers committed Jan 11, 2019
1 parent db75afb commit fd2af7e
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 31 deletions.
109 changes: 85 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
[![README Header][readme_header_img]][readme_header_link]

[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com)
[![Cloud Posse][logo]](https://cpco.io/homepage)

# terraform-aws-ecs-web-app [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-ecs-web-app.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-ecs-web-app) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-ecs-web-app.svg)](https://github.com/cloudposse/terraform-aws-ecs-web-app/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)

Expand All @@ -10,7 +11,17 @@ A Terraform module which implements a web app on ECS and supporting AWS resource

---

This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps.
This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
[<img align="right" title="Share via Email" src="https://docs.cloudposse.com/images/ionicons/ios-email-outline-2.0.1-16x16-999999.svg"/>][share_email]
[<img align="right" title="Share on Google+" src="https://docs.cloudposse.com/images/ionicons/social-googleplus-outline-2.0.1-16x16-999999.svg" />][share_googleplus]
[<img align="right" title="Share on Facebook" src="https://docs.cloudposse.com/images/ionicons/social-facebook-outline-2.0.1-16x16-999999.svg" />][share_facebook]
[<img align="right" title="Share on Reddit" src="https://docs.cloudposse.com/images/ionicons/social-reddit-outline-2.0.1-16x16-999999.svg" />][share_reddit]
[<img align="right" title="Share on LinkedIn" src="https://docs.cloudposse.com/images/ionicons/social-linkedin-outline-2.0.1-16x16-999999.svg" />][share_linkedin]
[<img align="right" title="Share on Twitter" src="https://docs.cloudposse.com/images/ionicons/social-twitter-outline-2.0.1-16x16-999999.svg" />][share_twitter]


[![Terraform Open Source Modules](https://docs.cloudposse.com/images/terraform-open-source-modules.svg)][terraform_modules]



It's 100% Open Source and licensed under the [APACHE2](LICENSE).
Expand All @@ -21,6 +32,11 @@ It's 100% Open Source and licensed under the [APACHE2](LICENSE).



We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out!







Expand Down Expand Up @@ -71,7 +87,6 @@ Available targets:
lint Lint terraform code
```

## Inputs

| Name | Description | Type | Default | Required |
Expand All @@ -92,6 +107,7 @@ Available targets:
| alb_target_group_alarms_ok_actions | A list of ARNs (i.e. SNS Topic ARN) to execute when ALB Target Group alarms transition into an OK state from any other state. | list | `<list>` | no |
| alb_target_group_alarms_period | The period (in seconds) to analyze for ALB CloudWatch Alarms. | string | `300` | no |
| alb_target_group_alarms_response_time_threshold | The maximum ALB Target Group response time. | string | `0.5` | no |
| alb_target_group_arn | Pass target group down to module | string | `` | no |
| attributes | List of attributes to add to label. | list | `<list>` | no |
| autoscaling_dimension | Dimension to autoscale on (valid options: cpu, memory) | string | `memory` | no |
| autoscaling_enabled | A boolean to enable/disable Autoscaling policy for ECS Service. | string | `false` | no |
Expand Down Expand Up @@ -145,6 +161,7 @@ Available targets:
| listener_arns_count | Number of elements in list of ALB Listener ARNs for the ECS service. | string | - | yes |
| name | Name (unique identifier for app or service) | string | - | yes |
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
| port_mappings | The port mappings to configure for the container. This is a list of maps. Each map should contain "containerPort", "hostPort", and "protocol", where "protocol" is one of "tcp" or "udp". If using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort. | list | `<list>` | no |
| protocol | The protocol used for the port mapping. Options: tcp or udp. | string | `tcp` | no |
| repo_name | GitHub repository name of the application to be built and deployed to ECS. | string | `` | no |
| repo_owner | GitHub Organization or Username. | string | `` | no |
Expand All @@ -159,9 +176,18 @@ Available targets:
| scale_down_policy_arn | Autoscaling scale up policy ARN |
| scale_up_policy_arn | Autoscaling scale up policy ARN |
| service_name | ECS Service Name |
| service_security_group_id | Security Group id of the ECS task |
| task_role_arn | ECS Task role ARN |
| task_role_name | ECS Task role name |




## Share the Love

Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/terraform-aws-ecs-web-app)! (it helps us **a lot**)

Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)


## Related Projects
Expand All @@ -185,26 +211,38 @@ Check out these related projects.

File a GitHub [issue](https://github.com/cloudposse/terraform-aws-ecs-web-app/issues), send us an [email][email] or join our [Slack Community][slack].

[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]

## Commercial Support

Work directly with our team of DevOps experts via email, slack, and video conferencing.

We provide [*commercial support*][commercial_support] for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a full-time engineer.

[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)](mailto:hello@cloudposse.com)
[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)][email]

- **Questions.** We'll use a Shared Slack channel between your team and ours.
- **Troubleshooting.** We'll help you triage why things aren't working.
- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback.
- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects.
- **Build New Terraform Modules.** We'll develop original modules to provision infrastructure.
- **Build New Terraform Modules.** We'll [develop original modules][module_development] to provision infrastructure.
- **Cloud Architecture.** We'll assist with your cloud strategy and design.
- **Implementation.** We'll provide hands-on support to implement our reference architectures.


## Community Forum

Get access to our [Open Source Community Forum][slack] on Slack. It's **FREE** to join for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build *sweet* infrastructure.
## Terraform Module Development

Are you interested in custom Terraform module development? Submit your inquiry using [our form][module_development] today and we'll get back to you ASAP.


## Slack Community

Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.

## Newsletter

Signup for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.

## Contributing

Expand All @@ -214,7 +252,7 @@ Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-ecs-w

### Developing

If you are interested in being a contributor and want to get involved in developing this project or [help out](https://github.com/orgs/cloudposse/projects/3) with our other projects, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com).
If you are interested in being a contributor and want to get involved in developing this project or [help out](https://cpco.io/help-out) with our other projects, we would love to hear from you! Shoot us an [email][email].

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

Expand All @@ -229,7 +267,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

## Copyright

Copyright © 2017-2018 [Cloud Posse, LLC](https://cloudposse.com)
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)



Expand Down Expand Up @@ -270,26 +308,16 @@ All other trademarks referenced herein are the property of their respective owne

## About

This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at <hello@cloudposse.com>
This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know by [leaving a testimonial][testimonial]!

[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com)
[![Cloud Posse][logo]][website]

We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We love [Open Source Software](https://github.com/cloudposse/)!
We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️ [Open Source Software][we_love_open_source].

We offer paid support on all of our projects.
We offer [paid support][commercial_support] on all of our projects.

Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.
Check out [our other projects][github], [follow us on twitter][twitter], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.

[docs]: https://docs.cloudposse.com/
[website]: https://cloudposse.com/
[github]: https://github.com/cloudposse/
[commercial_support]: https://github.com/orgs/cloudposse/projects
[jobs]: https://cloudposse.com/jobs/
[hire]: https://cloudposse.com/contact/
[slack]: https://slack.cloudposse.com/
[linkedin]: https://www.linkedin.com/company/cloudposse
[twitter]: https://twitter.com/cloudposse/
[email]: mailto:hello@cloudposse.com


### Contributors
Expand All @@ -307,3 +335,36 @@ Check out [our other projects][github], [apply for a job][jobs], or [hire us][hi
[sarkis_avatar]: https://github.com/sarkis.png?size=150



[![README Footer][readme_footer_img]][readme_footer_link]
[![Beacon][beacon]][website]

[logo]: https://cloudposse.com/logo-300x69.svg
[docs]: https://cpco.io/docs
[website]: https://cpco.io/homepage
[github]: https://cpco.io/github
[jobs]: https://cpco.io/jobs
[hire]: https://cpco.io/hire
[slack]: https://cpco.io/slack
[linkedin]: https://cpco.io/linkedin
[twitter]: https://cpco.io/twitter
[testimonial]: https://cpco.io/leave-testimonial
[newsletter]: https://cpco.io/newsletter
[email]: https://cpco.io/email
[commercial_support]: https://cpco.io/commercial-support
[we_love_open_source]: https://cpco.io/we-love-open-source
[module_development]: https://cpco.io/module-development
[terraform_modules]: https://cpco.io/terraform-modules
[readme_header_img]: https://cloudposse.com/readme/header/img?repo=cloudposse/terraform-aws-ecs-web-app
[readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/terraform-aws-ecs-web-app
[readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/terraform-aws-ecs-web-app
[readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/terraform-aws-ecs-web-app
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/terraform-aws-ecs-web-app
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/terraform-aws-ecs-web-app
[share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-ecs-web-app&url=https://github.com/cloudposse/terraform-aws-ecs-web-app
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-ecs-web-app&url=https://github.com/cloudposse/terraform-aws-ecs-web-app
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-ecs-web-app
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/terraform-aws-ecs-web-app
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-ecs-web-app
[share_email]: mailto:?subject=terraform-aws-ecs-web-app&body=https://github.com/cloudposse/terraform-aws-ecs-web-app
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-ecs-web-app?pixel&cs=github&cm=readme&an=terraform-aws-ecs-web-app
5 changes: 4 additions & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## Inputs

| Name | Description | Type | Default | Required |
Expand All @@ -19,6 +18,7 @@
| alb_target_group_alarms_ok_actions | A list of ARNs (i.e. SNS Topic ARN) to execute when ALB Target Group alarms transition into an OK state from any other state. | list | `<list>` | no |
| alb_target_group_alarms_period | The period (in seconds) to analyze for ALB CloudWatch Alarms. | string | `300` | no |
| alb_target_group_alarms_response_time_threshold | The maximum ALB Target Group response time. | string | `0.5` | no |
| alb_target_group_arn | Pass target group down to module | string | `` | no |
| attributes | List of attributes to add to label. | list | `<list>` | no |
| autoscaling_dimension | Dimension to autoscale on (valid options: cpu, memory) | string | `memory` | no |
| autoscaling_enabled | A boolean to enable/disable Autoscaling policy for ECS Service. | string | `false` | no |
Expand Down Expand Up @@ -72,6 +72,7 @@
| listener_arns_count | Number of elements in list of ALB Listener ARNs for the ECS service. | string | - | yes |
| name | Name (unique identifier for app or service) | string | - | yes |
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
| port_mappings | The port mappings to configure for the container. This is a list of maps. Each map should contain "containerPort", "hostPort", and "protocol", where "protocol" is one of "tcp" or "udp". If using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort. | list | `<list>` | no |
| protocol | The protocol used for the port mapping. Options: tcp or udp. | string | `tcp` | no |
| repo_name | GitHub repository name of the application to be built and deployed to ECS. | string | `` | no |
| repo_owner | GitHub Organization or Username. | string | `` | no |
Expand All @@ -86,5 +87,7 @@
| scale_down_policy_arn | Autoscaling scale up policy ARN |
| scale_up_policy_arn | Autoscaling scale up policy ARN |
| service_name | ECS Service Name |
| service_security_group_id | Security Group id of the ECS task |
| task_role_arn | ECS Task role ARN |
| task_role_name | ECS Task role name |

16 changes: 10 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
module "default_label" {
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.1.4"
name = "${var.name}"
namespace = "${var.namespace}"
stage = "${var.stage}"
source = "git::https://github.com/cloudposse/terraform-terraform-label.git?ref=tags/0.2.1"
name = "${var.name}"
namespace = "${var.namespace}"
stage = "${var.stage}"
attributes = "${var.attributes}"
}

module "ecr" {
Expand Down Expand Up @@ -53,17 +54,17 @@ module "container_definition" {
}

module "ecs_alb_service_task" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-alb-service-task.git?ref=tags/0.6.0"
source = "git::https://github.com/cloudposse/terraform-aws-ecs-alb-service-task.git?ref=tags/0.6.3"
name = "${var.name}"
namespace = "${var.namespace}"
stage = "${var.stage}"
attributes = "${var.attributes}"
alb_target_group_arn = "${module.alb_ingress.target_group_arn}"
container_definition_json = "${module.container_definition.json}"
container_name = "${module.default_label.id}"
desired_count = "${var.desired_count}"
task_cpu = "${var.container_cpu}"
task_memory = "${var.container_memory}"
ecr_repository_name = "${module.ecr.repository_name}"
ecs_cluster_arn = "${var.ecs_cluster_arn}"
launch_type = "${var.launch_type}"
vpc_id = "${var.vpc_id}"
Expand All @@ -78,6 +79,7 @@ module "ecs_codepipeline" {
name = "${var.name}"
namespace = "${var.namespace}"
stage = "${var.stage}"
attributes = "${var.attributes}"
github_oauth_token = "${var.github_oauth_token}"
repo_owner = "${var.repo_owner}"
repo_name = "${var.repo_name}"
Expand All @@ -100,6 +102,7 @@ module "autoscaling" {
name = "${var.name}"
namespace = "${var.namespace}"
stage = "${var.stage}"
attributes = "${var.attributes}"
service_name = "${module.ecs_alb_service_task.service_name}"
cluster_name = "${var.ecs_cluster_name}"
min_capacity = "${var.autoscaling_min_capacity}"
Expand Down Expand Up @@ -160,6 +163,7 @@ module "alb_target_group_alarms" {
name = "${var.name}"
namespace = "${var.namespace}"
stage = "${var.stage}"
attributes = "${var.attributes}"
alarm_actions = ["${var.alb_target_group_alarms_alarm_actions}"]
ok_actions = ["${var.alb_target_group_alarms_ok_actions}"]
insufficient_data_actions = ["${var.alb_target_group_alarms_insufficient_data_actions}"]
Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ output "service_name" {
value = "${module.ecs_alb_service_task.service_name}"
}

output "task_role_name" {
description = "ECS Task role name"
value = "${module.ecs_alb_service_task.task_role_name}"
}

output "task_role_arn" {
description = "ECS Task role ARN"
value = "${module.ecs_alb_service_task.task_role_arn}"
Expand Down

0 comments on commit fd2af7e

Please sign in to comment.