Skip to content

Commit

Permalink
Rename JSON Outputs (#89)
Browse files Browse the repository at this point in the history
* Update outputs.tf

* Update examples_complete_test.go

* Updated README.md

* Update outputs.tf

* Update main.tf

* Update main.tf

* Executed 'terraform fmt'

* Update outputs.tf

Co-authored-by: actions-bot <[email protected]>
  • Loading branch information
nitrocode and actions-bot authored Jul 28, 2020
1 parent 581492f commit b698e23
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 61 deletions.
71 changes: 27 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
<!--
# terraform-aws-ecs-container-definition

[![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-ecs-container-definition.svg)](https://github.com/cloudposse/terraform-aws-ecs-container-definition/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)

[![README Header][readme_header_img]][readme_header_link]

[![Cloud Posse][logo]](https://cpco.io/homepage)

<!--
** DO NOT EDIT THIS FILE
**
** This file was automatically generated by the `build-harness`.
** 1) Make all changes to `README.yaml`
**
** This file was automatically generated by the `build-harness`.
** 1) Make all changes to `README.yaml`
** 2) Run `make init` (you only need to do this once)
** 3) Run`make readme` to rebuild this file.
** 3) Run`make readme` to rebuild this file.
**
** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.)
**
Expand All @@ -27,32 +25,14 @@
-->
[![README Header][readme_header_img]][readme_header_link]

[![Cloud Posse][logo]](https://cpco.io/homepage)

# terraform-aws-ecs-container-definition

[![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-ecs-container-definition.svg)](https://github.com/cloudposse/terraform-aws-ecs-container-definition/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)

-->

Terraform module to generate well-formed JSON documents that are passed to the `aws_ecs_task_definition` Terraform resource as [container definitions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definitions).


---

This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) 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]
Expand All @@ -73,7 +53,7 @@ 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!
We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out!



Expand Down Expand Up @@ -104,8 +84,9 @@ For a complete example with automated tests, see [examples/complete](examples/co



<!-- markdownlint-disable -->
## Makefile Targets
```
```text
Available targets:
help Help screen
Expand All @@ -114,6 +95,7 @@ Available targets:
lint Lint terraform code
```
<!-- markdownlint-restore -->
## Requirements

| Name | Version |
Expand Down Expand Up @@ -169,15 +151,16 @@ No provider.

| Name | Description |
|------|-------------|
| json | JSON encoded list of container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map | JSON encoded container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map\_encoded | JSON string encoded container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map\_encoded\_list | JSON string encoded list of container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map\_object | JSON map encoded container definition |




## Share the Love
## Share the Love

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

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

Expand All @@ -200,7 +183,7 @@ Check out these related projects.

## Help

**Got a question?** We got answers.
**Got a question?** We got answers.

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

Expand All @@ -209,7 +192,7 @@ File a GitHub [issue](https://github.com/cloudposse/terraform-aws-ecs-container-
## DevOps Accelerator for Startups


We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.
We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.

[![Learn More](https://img.shields.io/badge/learn%20more-success.svg?style=for-the-badge)][commercial_support]

Expand Down Expand Up @@ -238,11 +221,11 @@ Participate in our [Discourse Forums][discourse]. Here you'll find answers to co

## Newsletter

Sign up 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.
Sign up 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.

## Office Hours

[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!
[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!

[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours]

Expand Down Expand Up @@ -273,9 +256,9 @@ Copyright © 2017-2020 [Cloud Posse, LLC](https://cpco.io/copyright)



## License
## License

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

See [LICENSE](LICENSE) for full details.

Expand Down Expand Up @@ -316,7 +299,7 @@ This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? P

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][commercial_support] on all of our projects.
We offer [paid support][commercial_support] on all of our projects.

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.

Expand Down
4 changes: 3 additions & 1 deletion docs/targets.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!-- markdownlint-disable -->
## Makefile Targets
```
```text
Available targets:
help Help screen
Expand All @@ -8,3 +9,4 @@ Available targets:
lint Lint terraform code
```
<!-- markdownlint-restore -->
5 changes: 3 additions & 2 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ No provider.

| Name | Description |
|------|-------------|
| json | JSON encoded list of container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map | JSON encoded container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map\_encoded | JSON string encoded container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map\_encoded\_list | JSON string encoded list of container definitions for use with other terraform resources such as aws\_ecs\_task\_definition |
| json\_map\_object | JSON map encoded container definition |

13 changes: 9 additions & 4 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
output "json" {
output "json_map_encoded_list" {
description = "JSON encoded list of container definitions for use with other terraform resources such as aws_ecs_task_definition"
value = module.container.json
value = module.container.json_map_encoded_list
}

output "json_map" {
output "json_map_encoded" {
description = "JSON encoded container definitions for use with other terraform resources such as aws_ecs_task_definition"
value = module.container.json_map
value = module.container.json_map_encoded
}

output "json_map_object" {
description = "JSON map encoded container definition"
value = module.container.json_map_object
}
4 changes: 2 additions & 2 deletions examples/env_vars_files/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "container" {
]
}

output "json" {
output "json_map_encoded" {
description = "Container definition in JSON format"
value = module.container.json_map
value = module.container.json_map_encoded
}
6 changes: 3 additions & 3 deletions examples/multiple_definitions/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ module "second_container" {

output "first_container_json" {
description = "Container definition in JSON format"
value = module.first_container.json
value = module.first_container.json_map_encoded_list
}

output "second_container_json" {
description = "Container definition in JSON format"
value = module.second_container.json
value = module.second_container.json_map_encoded_list
}

resource "aws_ecs_task_definition" "task" {
family = "foo"
container_definitions = "[${module.first_container.json_map},${module.second_container.json_map}]"
container_definitions = "[${module.first_container.json_map_encoded},${module.second_container.json_map_encoded}]"
}
13 changes: 9 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
output "json" {
description = "JSON encoded list of container definitions for use with other terraform resources such as aws_ecs_task_definition"
output "json_map_encoded_list" {
description = "JSON string encoded list of container definitions for use with other terraform resources such as aws_ecs_task_definition"
value = "[${local.json_map}]"
}

output "json_map" {
description = "JSON encoded container definitions for use with other terraform resources such as aws_ecs_task_definition"
output "json_map_encoded" {
description = "JSON string encoded container definitions for use with other terraform resources such as aws_ecs_task_definition"
value = local.json_map
}

output "json_map_object" {
description = "JSON map encoded container definition"
value = jsondecode(local.json_map)
}
2 changes: 1 addition & 1 deletion test/src/examples_complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestExamplesComplete(t *testing.T) {
terraform.InitAndApply(t, terraformOptions)

// Run `terraform output` to get the value of an output variable
jsonMap := terraform.OutputRequired(t, terraformOptions, "json_map")
jsonMap := terraform.OutputRequired(t, terraformOptions, "json_map_encoded")

// Verify we're getting back the outputs we expect
var jsonObject map[string]interface{}
Expand Down

0 comments on commit b698e23

Please sign in to comment.