Skip to content

Commit 444f956

Browse files
adamcrewsaknysh
authored andcommitted
Use the latest label module to support the environment attribute (#19)
1 parent 4c31ce9 commit 444f956

File tree

4 files changed

+133
-81
lines changed

4 files changed

+133
-81
lines changed

README.md

Lines changed: 92 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,43 @@
1-
<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
1+
<!--
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
** DO NOT EDIT THIS FILE
17+
**
18+
** This file was automatically generated by the `build-harness`.
19+
** 1) Make all changes to `README.yaml`
20+
** 2) Run `make init` (you only need to do this once)
21+
** 3) Run`make readme` to rebuild this file.
22+
**
23+
** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.)
24+
**
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
-->
241
[![README Header][readme_header_img]][readme_header_link]
342

443
[![Cloud Posse][logo]](https://cpco.io/homepage)
@@ -88,21 +127,22 @@ Available targets:
88127
| allow_encrypted_uploads_only | Set to `true` to prevent uploads of unencrypted objects to S3 bucket | bool | `false` | no |
89128
| allowed_bucket_actions | List of actions the user is permitted to perform on the S3 bucket | list(string) | `<list>` | no |
90129
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
91-
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no |
92-
| enabled | Set to `false` to prevent the module from creating any resources | bool | `true` | no |
130+
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
131+
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
132+
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
93133
| force_destroy | A boolean string that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable | bool | `false` | no |
94134
| kms_master_key_arn | The AWS KMS master key ARN used for the `SSE-KMS` encryption. This can only be used when you set the value of `sse_algorithm` as `aws:kms`. The default aws/s3 AWS KMS master key is used if this element is absent while the `sse_algorithm` is `aws:kms` | string | `` | no |
95135
| lifecycle_rule_enabled | Enable or disable lifecycle rule | bool | `false` | no |
96-
| name | Name (e.g. `app` or `cluster`) | string | - | yes |
97-
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |
136+
| name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no |
137+
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
98138
| noncurrent_version_expiration_days | Specifies when noncurrent object versions expire | number | `90` | no |
99139
| noncurrent_version_transition_days | Number of days to persist in the standard storage tier before moving to the glacier tier infrequent access tier | number | `30` | no |
100140
| policy | A valid bucket policy JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a terraform plan. In this case, please make sure you use the verbose/specific version of the policy | string | `` | no |
101141
| prefix | Prefix identifying one or more objects to which the rule applies | string | `` | no |
102142
| region | If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee | string | `` | no |
103143
| sse_algorithm | The server-side encryption algorithm to use. Valid values are `AES256` and `aws:kms` | string | `AES256` | no |
104-
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no |
105-
| tags | Additional tags (e.g. `{ BusinessUnit = "XYZ" }` | map(string) | `<map>` | no |
144+
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
145+
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map(string) | `<map>` | no |
106146
| user_enabled | Set to `true` to create an IAM user with permission to access the bucket | bool | `false` | no |
107147
| versioning_enabled | A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket | bool | `false` | no |
108148

@@ -146,42 +186,47 @@ Check out these related projects.
146186

147187
## Help
148188

149-
**Got a question?**
189+
**Got a question?** We got answers.
150190

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

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

155-
## Commercial Support
156-
157-
Work directly with our team of DevOps experts via email, slack, and video conferencing.
158-
159-
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.
195+
## DevOps Accelerator for Startups
160196

161-
[![E-Mail](https://img.shields.io/badge/[email protected])][email]
162197

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

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

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

173-
## Terraform Module Development
174-
175-
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.
204+
We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.
176205

206+
- **Reference Architecture.** You'll get everything you need from the ground up built using 100% infrastructure as code.
207+
- **Release Engineering.** You'll have end-to-end CI/CD with unlimited staging environments.
208+
- **Site Reliability Engineering.** You'll have total visibility into your apps and microservices.
209+
- **Security Baseline.** You'll have built-in governance with accountability and audit logs for all changes.
210+
- **GitOps.** You'll be able to operate your infrastructure via Pull Requests.
211+
- **Training.** You'll receive hands-on training so your team can operate what we build.
212+
- **Questions.** You'll have a direct line of communication between our teams via a Shared Slack channel.
213+
- **Troubleshooting.** You'll get help to triage when things aren't working.
214+
- **Code Reviews.** You'll receive constructive feedback on Pull Requests.
215+
- **Bug Fixes.** We'll rapidly work with you to fix any bugs in our projects.
177216

178217
## Slack Community
179218

180219
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.
181220

182221
## Newsletter
183222

184-
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.
223+
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.
224+
225+
## Office Hours
226+
227+
[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!
228+
229+
[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours]
185230

186231
## Contributing
187232

@@ -206,7 +251,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
206251

207252
## Copyright
208253

209-
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)
254+
Copyright © 2017-2020 [Cloud Posse, LLC](https://cpco.io/copyright)
210255

211256

212257

@@ -273,33 +318,31 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
273318
[joshmyers_homepage]: https://github.com/joshmyers
274319
[joshmyers_avatar]: https://img.cloudposse.com/150x150/https://github.com/joshmyers.png
275320

276-
277-
278321
[![README Footer][readme_footer_img]][readme_footer_link]
279322
[![Beacon][beacon]][website]
280323

281324
[logo]: https://cloudposse.com/logo-300x69.svg
282-
[docs]: https://cpco.io/docs
283-
[website]: https://cpco.io/homepage
284-
[github]: https://cpco.io/github
285-
[jobs]: https://cpco.io/jobs
286-
[hire]: https://cpco.io/hire
287-
[slack]: https://cpco.io/slack
288-
[linkedin]: https://cpco.io/linkedin
289-
[twitter]: https://cpco.io/twitter
290-
[testimonial]: https://cpco.io/leave-testimonial
291-
[newsletter]: https://cpco.io/newsletter
292-
[email]: https://cpco.io/email
293-
[commercial_support]: https://cpco.io/commercial-support
294-
[we_love_open_source]: https://cpco.io/we-love-open-source
295-
[module_development]: https://cpco.io/module-development
296-
[terraform_modules]: https://cpco.io/terraform-modules
297-
[readme_header_img]: https://cloudposse.com/readme/header/img?repo=cloudposse/terraform-aws-s3-bucket
298-
[readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/terraform-aws-s3-bucket
299-
[readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/terraform-aws-s3-bucket
300-
[readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/terraform-aws-s3-bucket
301-
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/terraform-aws-s3-bucket
302-
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/terraform-aws-s3-bucket
325+
[docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=docs
326+
[website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=website
327+
[github]: https://cpco.io/github?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=github
328+
[jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=jobs
329+
[hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=hire
330+
[slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=slack
331+
[linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=linkedin
332+
[twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=twitter
333+
[testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=testimonial
334+
[office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=office_hours
335+
[newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=newsletter
336+
[email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=email
337+
[commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=commercial_support
338+
[we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=we_love_open_source
339+
[terraform_modules]: https://cpco.io/terraform-modules?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=terraform_modules
340+
[readme_header_img]: https://cloudposse.com/readme/header/img
341+
[readme_header_link]: https://cloudposse.com/readme/header/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=readme_header_link
342+
[readme_footer_img]: https://cloudposse.com/readme/footer/img
343+
[readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=readme_footer_link
344+
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img
345+
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-s3-bucket&utm_content=readme_commercial_support_link
303346
[share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-s3-bucket&url=https://github.com/cloudposse/terraform-aws-s3-bucket
304347
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-s3-bucket&url=https://github.com/cloudposse/terraform-aws-s3-bucket
305348
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-s3-bucket

docs/terraform.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@
66
| allow_encrypted_uploads_only | Set to `true` to prevent uploads of unencrypted objects to S3 bucket | bool | `false` | no |
77
| allowed_bucket_actions | List of actions the user is permitted to perform on the S3 bucket | list(string) | `<list>` | no |
88
| attributes | Additional attributes (e.g. `1`) | list(string) | `<list>` | no |
9-
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no |
10-
| enabled | Set to `false` to prevent the module from creating any resources | bool | `true` | no |
9+
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes` | string | `-` | no |
10+
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
11+
| environment | Environment, e.g. 'prod', 'staging', 'dev', 'pre-prod', 'UAT' | string | `` | no |
1112
| force_destroy | A boolean string that indicates all objects should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable | bool | `false` | no |
1213
| kms_master_key_arn | The AWS KMS master key ARN used for the `SSE-KMS` encryption. This can only be used when you set the value of `sse_algorithm` as `aws:kms`. The default aws/s3 AWS KMS master key is used if this element is absent while the `sse_algorithm` is `aws:kms` | string | `` | no |
1314
| lifecycle_rule_enabled | Enable or disable lifecycle rule | bool | `false` | no |
14-
| name | Name (e.g. `app` or `cluster`) | string | - | yes |
15-
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |
15+
| name | Solution name, e.g. 'app' or 'jenkins' | string | `` | no |
16+
| namespace | Namespace, which could be your organization name or abbreviation, e.g. 'eg' or 'cp' | string | `` | no |
1617
| noncurrent_version_expiration_days | Specifies when noncurrent object versions expire | number | `90` | no |
1718
| noncurrent_version_transition_days | Number of days to persist in the standard storage tier before moving to the glacier tier infrequent access tier | number | `30` | no |
1819
| policy | A valid bucket policy JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy as constantly changing in a terraform plan. In this case, please make sure you use the verbose/specific version of the policy | string | `` | no |
1920
| prefix | Prefix identifying one or more objects to which the rule applies | string | `` | no |
2021
| region | If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee | string | `` | no |
2122
| sse_algorithm | The server-side encryption algorithm to use. Valid values are `AES256` and `aws:kms` | string | `AES256` | no |
22-
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no |
23-
| tags | Additional tags (e.g. `{ BusinessUnit = "XYZ" }` | map(string) | `<map>` | no |
23+
| stage | Stage, e.g. 'prod', 'staging', 'dev', OR 'source', 'build', 'test', 'deploy', 'release' | string | `` | no |
24+
| tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map(string) | `<map>` | no |
2425
| user_enabled | Set to `true` to create an IAM user with permission to access the bucket | bool | `false` | no |
2526
| versioning_enabled | A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket | bool | `false` | no |
2627

main.tf

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
module "default_label" {
2-
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.14.1"
3-
enabled = var.enabled
4-
namespace = var.namespace
5-
stage = var.stage
6-
name = var.name
7-
delimiter = var.delimiter
8-
attributes = var.attributes
9-
tags = var.tags
1+
module "label" {
2+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.16.0"
3+
enabled = var.enabled
4+
namespace = var.namespace
5+
environment = var.environment
6+
stage = var.stage
7+
name = var.name
8+
delimiter = var.delimiter
9+
attributes = var.attributes
10+
tags = var.tags
1011
}
1112

1213
resource "aws_s3_bucket" "default" {
1314
count = var.enabled ? 1 : 0
14-
bucket = module.default_label.id
15+
bucket = module.label.id
1516
acl = var.acl
1617
region = var.region
1718
force_destroy = var.force_destroy
@@ -22,10 +23,10 @@ resource "aws_s3_bucket" "default" {
2223
}
2324

2425
lifecycle_rule {
25-
id = module.default_label.id
26+
id = module.label.id
2627
enabled = var.lifecycle_rule_enabled
2728
prefix = var.prefix
28-
tags = module.default_label.tags
29+
tags = module.label.tags
2930

3031
noncurrent_version_transition {
3132
days = var.noncurrent_version_transition_days
@@ -37,7 +38,6 @@ resource "aws_s3_bucket" "default" {
3738
}
3839
}
3940

40-
4141
# https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html
4242
# https://www.terraform.io/docs/providers/aws/r/s3_bucket.html#enable-default-server-side-encryption
4343
server_side_encryption_configuration {
@@ -49,13 +49,14 @@ resource "aws_s3_bucket" "default" {
4949
}
5050
}
5151

52-
tags = module.default_label.tags
52+
tags = module.label.tags
5353
}
5454

5555
module "s3_user" {
56-
source = "git::https://github.com/cloudposse/terraform-aws-iam-s3-user.git?ref=tags/0.4.0"
56+
source = "git::https://github.com/cloudposse/terraform-aws-iam-s3-user.git?ref=tags/0.5.0"
5757
namespace = var.namespace
5858
stage = var.stage
59+
environment = var.environment
5960
name = var.name
6061
attributes = var.attributes
6162
tags = var.tags

0 commit comments

Comments
 (0)