Skip to content

Commit

Permalink
Support latest version of terraform-null-label and its variables (#10)
Browse files Browse the repository at this point in the history
* 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`.
  • Loading branch information
Adam authored and aknysh committed Dec 21, 2018
1 parent d7da47b commit 86b17f1
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 53 deletions.
119 changes: 90 additions & 29 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-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)

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

---

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 @@ -36,6 +47,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 @@ -103,23 +119,26 @@ Available targets:
lint Lint terraform code
```

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| acl | The canned ACL to apply to the S3 bucket | string | `private` | no |
| additional_tag_map | Additional tags for appending to each tag map | map | `<map>` | no |
| attributes | Additional attributes (e.g. `state`) | list | `<list>` | no |
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
| context | Default context to use for passing state between label invocations | map | `<map>` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
| enable_server_side_encryption | Enable DynamoDB server-side encryption | string | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
| 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 |
| label_order | The naming order of the id output and Name tag | list | `<list>` | no |
| 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 |
| name | Name (e.g. `app` or `cluster`) | string | `terraform` | no |
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
| name | Solution name, e.g. 'app' or 'jenkins' | string | `terraform` | no |
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
| read_capacity | DynamoDB read capacity units | string | `5` | no |
| region | AWS Region the S3 bucket should reside in | string | - | yes |
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes |
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `<map>` | no |
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map | `<map>` | no |
| write_capacity | DynamoDB write capacity units | string | `5` | no |

## Outputs
Expand All @@ -136,6 +155,13 @@ Available targets:



## Share the Love

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

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


## Related Projects

Check out these related projects.
Expand All @@ -151,26 +177,38 @@ Check out these related projects.

File a GitHub [issue](https://github.com/cloudposse/terraform-aws-tfstate-backend/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 protected])](mailto:[email protected])
[![E-Mail](https://img.shields.io/badge/[email protected])][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 @@ -180,7 +218,7 @@ Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-tfsta

### 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:[email protected]).
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 @@ -195,7 +233,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-2018 [Cloud Posse, LLC](https://cpco.io/copyright)



Expand Down Expand Up @@ -236,26 +274,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 <[email protected]>
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:[email protected]


### Contributors
Expand All @@ -271,3 +299,36 @@ Check out [our other projects][github], [apply for a job][jobs], or [hire us][hi
[maartenvanderhoef_avatar]: https://github.com/maartenvanderhoef.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-tfstate-backend
[readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/terraform-aws-tfstate-backend
[readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/terraform-aws-tfstate-backend
[readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/terraform-aws-tfstate-backend
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/terraform-aws-tfstate-backend
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/terraform-aws-tfstate-backend
[share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-tfstate-backend&url=https://github.com/cloudposse/terraform-aws-tfstate-backend
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-tfstate-backend&url=https://github.com/cloudposse/terraform-aws-tfstate-backend
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-tfstate-backend
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/terraform-aws-tfstate-backend
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-tfstate-backend
[share_email]: mailto:?subject=terraform-aws-tfstate-backend&body=https://github.com/cloudposse/terraform-aws-tfstate-backend
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-tfstate-backend?pixel&cs=github&cm=readme&an=terraform-aws-tfstate-backend
15 changes: 9 additions & 6 deletions docs/terraform.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| acl | The canned ACL to apply to the S3 bucket | string | `private` | no |
| additional_tag_map | Additional tags for appending to each tag map | map | `<map>` | no |
| attributes | Additional attributes (e.g. `state`) | list | `<list>` | no |
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
| context | Default context to use for passing state between label invocations | map | `<map>` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
| enable_server_side_encryption | Enable DynamoDB server-side encryption | string | `true` | no |
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
| 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 |
| label_order | The naming order of the id output and Name tag | list | `<list>` | no |
| 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 |
| name | Name (e.g. `app` or `cluster`) | string | `terraform` | no |
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
| name | Solution name, e.g. 'app' or 'jenkins' | string | `terraform` | no |
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
| read_capacity | DynamoDB read capacity units | string | `5` | no |
| region | AWS Region the S3 bucket should reside in | string | - | yes |
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes |
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`) | map | `<map>` | no |
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map | `<map>` | no |
| write_capacity | DynamoDB write capacity units | string | `5` | no |

## Outputs
Expand Down
31 changes: 18 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
module "base_label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
namespace = "${var.namespace}"
environment = "${var.environment}"
stage = "${var.stage}"
name = "${var.name}"
delimiter = "${var.delimiter}"
attributes = "${var.attributes}"
tags = "${var.tags}"
additional_tag_map = "${var.additional_tag_map}"
context = "${var.context}"
label_order = "${var.label_order}"
}

module "s3_bucket_label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
namespace = "${var.namespace}"
stage = "${var.stage}"
name = "${var.name}"
delimiter = "${var.delimiter}"
attributes = "${var.attributes}"
tags = "${var.tags}"
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
context = "${module.base_label.context}"
}

resource "aws_s3_bucket" "default" {
Expand All @@ -31,13 +40,9 @@ resource "aws_s3_bucket" "default" {
}

module "dynamodb_table_label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
namespace = "${var.namespace}"
stage = "${var.stage}"
name = "${var.name}"
delimiter = "${var.delimiter}"
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.5.3"
context = "${module.base_label.context}"
attributes = ["${compact(concat(var.attributes, list("lock")))}"]
tags = "${var.tags}"
}

resource "aws_dynamodb_table" "with_server_side_encryption" {
Expand Down
36 changes: 31 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
variable "namespace" {
type = "string"
description = "Namespace (e.g. `cp` or `cloudposse`)"
default = ""
description = "Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp'"
}

variable "environment" {
type = "string"
default = ""
description = "Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT'"
}

variable "stage" {
type = "string"
description = "Stage (e.g. `prod`, `dev`, `staging`)"
default = ""
description = "Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release'"
}

variable "name" {
type = "string"
default = "terraform"
description = "Name (e.g. `app` or `cluster`)"
description = "Solution name, e.g. 'app' or 'jenkins'"
}

variable "delimiter" {
type = "string"
default = "-"
description = "Delimiter to be used between `namespace`, `stage`, `name`, and `attributes`"
description = "Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`"
}

variable "attributes" {
Expand All @@ -29,7 +37,25 @@ variable "attributes" {
variable "tags" {
type = "map"
default = {}
description = "Additional tags (e.g. map(`BusinessUnit`,`XYZ`)"
description = "Additional tags (e.g. `map('BusinessUnit','XYZ')`"
}

variable "additional_tag_map" {
type = "map"
default = {}
description = "Additional tags for appending to each tag map"
}

variable "context" {
type = "map"
default = {}
description = "Default context to use for passing state between label invocations"
}

variable "label_order" {
type = "list"
default = []
description = "The naming order of the id output and Name tag"
}

variable "region" {
Expand Down

0 comments on commit 86b17f1

Please sign in to comment.