Skip to content

Commit 86b17f1

Browse files
Adamaknysh
authored andcommitted
Support latest version of terraform-null-label and its variables (#10)
* Support latest version of terraform-null-label and its variables. Bumps veresion of terraform-null-label to 0.5.3 (latest at time of writing). Copies variable descriptions from new version. Adds defaults for namespace and stage to match the default behavior of terraform-null-resource. Deduplicates label resource input vars with the new 'context' feature. The new version of terraform-null-label filters some characters out of its input variables, which may cause names of resources created by this module to change. * Apply output of `make readme`.
1 parent d7da47b commit 86b17f1

File tree

4 files changed

+148
-53
lines changed

4 files changed

+148
-53
lines changed

README.md

Lines changed: 90 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
2+
[![README Header][readme_header_img]][readme_header_link]
23

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

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

@@ -25,7 +26,17 @@ __NOTE:__ This module cannot be used to apply changes to the `mfa_delete` featur
2526

2627
---
2728

28-
This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps.
29+
This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
30+
[<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]
31+
[<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]
32+
[<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]
33+
[<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]
34+
[<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]
35+
[<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]
36+
37+
38+
[![Terraform Open Source Modules](https://docs.cloudposse.com/images/terraform-open-source-modules.svg)][terraform_modules]
39+
2940

3041

3142
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
@@ -36,6 +47,11 @@ It's 100% Open Source and licensed under the [APACHE2](LICENSE).
3647

3748

3849

50+
We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out!
51+
52+
53+
54+
3955

4056

4157

@@ -103,23 +119,26 @@ Available targets:
103119
lint Lint terraform code
104120
105121
```
106-
107122
## Inputs
108123

109124
| Name | Description | Type | Default | Required |
110125
|------|-------------|:----:|:-----:|:-----:|
111126
| acl | The canned ACL to apply to the S3 bucket | string | `private` | no |
127+
| additional_tag_map | Additional tags for appending to each tag map | map | `<map>` | no |
112128
| attributes | Additional attributes (e.g. `state`) | list | `<list>` | no |
113-
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
129+
| context | Default context to use for passing state between label invocations | map | `<map>` | no |
130+
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
114131
| enable_server_side_encryption | Enable DynamoDB server-side encryption | string | `true` | no |
132+
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
115133
| force_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | string | `false` | no |
134+
| label_order | The naming order of the id output and Name tag | list | `<list>` | no |
116135
| mfa_delete | A boolean that indicates that versions of S3 objects can only be deleted with MFA. ( Terraform cannot apply changes of this value; https://github.com/terraform-providers/terraform-provider-aws/issues/629 ) | string | `false` | no |
117-
| name | Name (e.g. `app` or `cluster`) | string | `terraform` | no |
118-
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
136+
| name | Solution name, e.g. 'app' or 'jenkins' | string | `terraform` | no |
137+
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
119138
| read_capacity | DynamoDB read capacity units | string | `5` | no |
120139
| region | AWS Region the S3 bucket should reside in | string | - | yes |
121-
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes |
122-
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `<map>` | no |
140+
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
141+
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map | `<map>` | no |
123142
| write_capacity | DynamoDB write capacity units | string | `5` | no |
124143

125144
## Outputs
@@ -136,6 +155,13 @@ Available targets:
136155

137156

138157

158+
## Share the Love
159+
160+
Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/terraform-aws-tfstate-backend)! (it helps us **a lot**)
161+
162+
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
163+
164+
139165
## Related Projects
140166

141167
Check out these related projects.
@@ -151,26 +177,38 @@ Check out these related projects.
151177

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

180+
[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
181+
154182
## Commercial Support
155183

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

158186
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.
159187

160-
[![E-Mail](https://img.shields.io/badge/[email protected])](mailto:[email protected])
188+
[![E-Mail](https://img.shields.io/badge/[email protected])][email]
161189

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

170198

171-
## Community Forum
172199

173-
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.
200+
## Terraform Module Development
201+
202+
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.
203+
204+
205+
## Slack Community
206+
207+
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.
208+
209+
## Newsletter
210+
211+
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.
174212

175213
## Contributing
176214

@@ -180,7 +218,7 @@ Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-tfsta
180218

181219
### Developing
182220

183-
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:[email protected]).
221+
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].
184222

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

@@ -195,7 +233,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
195233

196234
## Copyright
197235

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

200238

201239

@@ -236,26 +274,16 @@ All other trademarks referenced herein are the property of their respective owne
236274

237275
## About
238276

239-
This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at <[email protected]>
277+
This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know by [leaving a testimonial][testimonial]!
240278

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

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

245-
We offer paid support on all of our projects.
283+
We offer [paid support][commercial_support] on all of our projects.
246284

247-
Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.
285+
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.
248286

249-
[docs]: https://docs.cloudposse.com/
250-
[website]: https://cloudposse.com/
251-
[github]: https://github.com/cloudposse/
252-
[commercial_support]: https://github.com/orgs/cloudposse/projects
253-
[jobs]: https://cloudposse.com/jobs/
254-
[hire]: https://cloudposse.com/contact/
255-
[slack]: https://slack.cloudposse.com/
256-
[linkedin]: https://www.linkedin.com/company/cloudposse
257-
[twitter]: https://twitter.com/cloudposse/
258-
[email]: mailto:[email protected]
259287

260288

261289
### Contributors
@@ -271,3 +299,36 @@ Check out [our other projects][github], [apply for a job][jobs], or [hire us][hi
271299
[maartenvanderhoef_avatar]: https://github.com/maartenvanderhoef.png?size=150
272300

273301

302+
303+
[![README Footer][readme_footer_img]][readme_footer_link]
304+
[![Beacon][beacon]][website]
305+
306+
[logo]: https://cloudposse.com/logo-300x69.svg
307+
[docs]: https://cpco.io/docs
308+
[website]: https://cpco.io/homepage
309+
[github]: https://cpco.io/github
310+
[jobs]: https://cpco.io/jobs
311+
[hire]: https://cpco.io/hire
312+
[slack]: https://cpco.io/slack
313+
[linkedin]: https://cpco.io/linkedin
314+
[twitter]: https://cpco.io/twitter
315+
[testimonial]: https://cpco.io/leave-testimonial
316+
[newsletter]: https://cpco.io/newsletter
317+
[email]: https://cpco.io/email
318+
[commercial_support]: https://cpco.io/commercial-support
319+
[we_love_open_source]: https://cpco.io/we-love-open-source
320+
[module_development]: https://cpco.io/module-development
321+
[terraform_modules]: https://cpco.io/terraform-modules
322+
[readme_header_img]: https://cloudposse.com/readme/header/img?repo=cloudposse/terraform-aws-tfstate-backend
323+
[readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/terraform-aws-tfstate-backend
324+
[readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/terraform-aws-tfstate-backend
325+
[readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/terraform-aws-tfstate-backend
326+
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/terraform-aws-tfstate-backend
327+
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/terraform-aws-tfstate-backend
328+
[share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-tfstate-backend&url=https://github.com/cloudposse/terraform-aws-tfstate-backend
329+
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-tfstate-backend&url=https://github.com/cloudposse/terraform-aws-tfstate-backend
330+
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-tfstate-backend
331+
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/terraform-aws-tfstate-backend
332+
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-tfstate-backend
333+
[share_email]: mailto:?subject=terraform-aws-tfstate-backend&body=https://github.com/cloudposse/terraform-aws-tfstate-backend
334+
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-tfstate-backend?pixel&cs=github&cm=readme&an=terraform-aws-tfstate-backend

docs/terraform.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
21
## Inputs
32

43
| Name | Description | Type | Default | Required |
54
|------|-------------|:----:|:-----:|:-----:|
65
| acl | The canned ACL to apply to the S3 bucket | string | `private` | no |
6+
| additional_tag_map | Additional tags for appending to each tag map | map | `<map>` | no |
77
| attributes | Additional attributes (e.g. `state`) | list | `<list>` | no |
8-
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
8+
| context | Default context to use for passing state between label invocations | map | `<map>` | no |
9+
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
910
| enable_server_side_encryption | Enable DynamoDB server-side encryption | string | `true` | no |
11+
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
1012
| force_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | string | `false` | no |
13+
| label_order | The naming order of the id output and Name tag | list | `<list>` | no |
1114
| mfa_delete | A boolean that indicates that versions of S3 objects can only be deleted with MFA. ( Terraform cannot apply changes of this value; https://github.com/terraform-providers/terraform-provider-aws/issues/629 ) | string | `false` | no |
12-
| name | Name (e.g. `app` or `cluster`) | string | `terraform` | no |
13-
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
15+
| name | Solution name, e.g. 'app' or 'jenkins' | string | `terraform` | no |
16+
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
1417
| read_capacity | DynamoDB read capacity units | string | `5` | no |
1518
| region | AWS Region the S3 bucket should reside in | string | - | yes |
16-
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes |
17-
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `<map>` | no |
19+
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
20+
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map | `<map>` | no |
1821
| write_capacity | DynamoDB write capacity units | string | `5` | no |
1922

2023
## Outputs

main.tf

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
module "base_label" {
2+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
3+
namespace = "${var.namespace}"
4+
environment = "${var.environment}"
5+
stage = "${var.stage}"
6+
name = "${var.name}"
7+
delimiter = "${var.delimiter}"
8+
attributes = "${var.attributes}"
9+
tags = "${var.tags}"
10+
additional_tag_map = "${var.additional_tag_map}"
11+
context = "${var.context}"
12+
label_order = "${var.label_order}"
13+
}
14+
115
module "s3_bucket_label" {
2-
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
3-
namespace = "${var.namespace}"
4-
stage = "${var.stage}"
5-
name = "${var.name}"
6-
delimiter = "${var.delimiter}"
7-
attributes = "${var.attributes}"
8-
tags = "${var.tags}"
16+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
17+
context = "${module.base_label.context}"
918
}
1019

1120
resource "aws_s3_bucket" "default" {
@@ -31,13 +40,9 @@ resource "aws_s3_bucket" "default" {
3140
}
3241

3342
module "dynamodb_table_label" {
34-
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
35-
namespace = "${var.namespace}"
36-
stage = "${var.stage}"
37-
name = "${var.name}"
38-
delimiter = "${var.delimiter}"
43+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
44+
context = "${module.base_label.context}"
3945
attributes = ["${compact(concat(var.attributes, list("lock")))}"]
40-
tags = "${var.tags}"
4146
}
4247

4348
resource "aws_dynamodb_table" "with_server_side_encryption" {

variables.tf

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
variable "namespace" {
22
type = "string"
3-
description = "Namespace (e.g. `cp` or `cloudposse`)"
3+
default = ""
4+
description = "Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp'"
5+
}
6+
7+
variable "environment" {
8+
type = "string"
9+
default = ""
10+
description = "Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT'"
411
}
512

613
variable "stage" {
714
type = "string"
8-
description = "Stage (e.g. `prod`, `dev`, `staging`)"
15+
default = ""
16+
description = "Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release'"
917
}
1018

1119
variable "name" {
1220
type = "string"
1321
default = "terraform"
14-
description = "Name (e.g. `app` or `cluster`)"
22+
description = "Solution name, e.g. 'app' or 'jenkins'"
1523
}
1624

1725
variable "delimiter" {
1826
type = "string"
1927
default = "-"
20-
description = "Delimiter to be used between `namespace`, `stage`, `name`, and `attributes`"
28+
description = "Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`"
2129
}
2230

2331
variable "attributes" {
@@ -29,7 +37,25 @@ variable "attributes" {
2937
variable "tags" {
3038
type = "map"
3139
default = {}
32-
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)"
40+
description = "Additional tags (e.g. `map('BusinessUnit','XYZ')`"
41+
}
42+
43+
variable "additional_tag_map" {
44+
type = "map"
45+
default = {}
46+
description = "Additional tags for appending to each tag map"
47+
}
48+
49+
variable "context" {
50+
type = "map"
51+
default = {}
52+
description = "Default context to use for passing state between label invocations"
53+
}
54+
55+
variable "label_order" {
56+
type = "list"
57+
default = []
58+
description = "The naming order of the id output and Name tag"
3359
}
3460

3561
variable "region" {

0 commit comments

Comments
 (0)