Skip to content

Commit 2ff3c0d

Browse files
author
Maxim Mironenko
authored
Initial Implementation (#1)
Initial Implementation of `terraform-aws-s3-bucket` module
1 parent abcfd55 commit 2ff3c0d

File tree

13 files changed

+734
-1
lines changed

13 files changed

+734
-1
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@
77

88
# .tfvars files
99
*.tfvars
10+
11+
# IDE files
12+
.idea
13+
*.iml
14+
15+
# Build harness files
16+
.build-harness
17+
build-harness

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
addons:
2+
apt:
3+
packages:
4+
- git
5+
- make
6+
- curl
7+
8+
install:
9+
- make init
10+
11+
script:
12+
- make terraform/install
13+
- make terraform/get-plugins
14+
- make terraform/get-modules
15+
- make terraform/lint
16+
- make terraform/validate

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2019 Cloud Posse, LLC
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SHELL := /bin/bash
2+
3+
# List of targets the `readme` target should call before generating the readme
4+
export README_DEPS ?= docs/targets.md docs/terraform.md
5+
6+
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
7+
8+
## Lint terraform code
9+
lint:
10+
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate

README.md

Lines changed: 301 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,301 @@
1+
<!-- 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]
3+
4+
[![Cloud Posse][logo]](https://cpco.io/homepage)
5+
6+
# terraform-aws-s3-bucket [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-s3-bucket.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-s3-bucket) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-s3-bucket.svg)](https://github.com/cloudposse/terraform-aws-s3-bucket/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
7+
8+
9+
This module creates an S3 bucket with support of versioning, encryption, ACL and bucket object policy.
10+
If `user_enabled` variable is set to `true`, the module will provision a basic IAM user with permissions to access the bucket.
11+
12+
This basic IAM system user is suitable for CI/CD systems (_e.g._ TravisCI, CircleCI) or systems which are *external* to AWS that cannot leverage [AWS IAM Instance Profiles](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html).
13+
14+
We do not recommend creating IAM users this way for any other purpose.
15+
16+
17+
---
18+
19+
This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
20+
[<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]
21+
[<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]
22+
[<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]
23+
[<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]
24+
[<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]
25+
[<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]
26+
27+
28+
[![Terraform Open Source Modules](https://docs.cloudposse.com/images/terraform-open-source-modules.svg)][terraform_modules]
29+
30+
31+
32+
It's 100% Open Source and licensed under the [APACHE2](LICENSE).
33+
34+
35+
36+
37+
38+
39+
40+
We literally have [*hundreds of terraform modules*][terraform_modules] that are Open Source and well-maintained. Check them out!
41+
42+
43+
44+
45+
46+
47+
48+
## Usage
49+
50+
```hcl
51+
module "s3_bucket" {
52+
source = "git::https://github.com/cloudposse/terraform-aws-s3-bucket.git?ref=master"
53+
enabled = "${var.enabled}"
54+
user_enabled = "${var.user_enabled}"
55+
versioning_enabled = "${var.versioning_enabled}"
56+
allowed_bucket_actions = "${var.allowed_bucket_actions}"
57+
name = "${var.name}"
58+
stage = "${var.stage}"
59+
namespace = "${var.namespace}"
60+
}
61+
```
62+
63+
64+
65+
66+
67+
68+
## Makefile Targets
69+
```
70+
Available targets:
71+
72+
help Help screen
73+
help/all Display help for all targets
74+
help/short This help short screen
75+
lint Lint terraform code
76+
77+
```
78+
79+
## Inputs
80+
81+
| Name | Description | Type | Default | Required |
82+
|------|-------------|:----:|:-----:|:-----:|
83+
| acl | The canned ACL to apply. We recommend `private` to avoid exposing sensitive information | string | `private` | no |
84+
| allowed_bucket_actions | List of actions the user is permitted to perform on the S3 bucket | list | `<list>` | no |
85+
| attributes | Additional attributes (e.g. `1`) | list | `<list>` | no |
86+
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | string | `-` | no |
87+
| enabled | Set to `false` to prevent the module from creating any resources | string | `true` | no |
88+
| 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. | string | `false` | no |
89+
| kms_master_key_id | The AWS KMS master key ID 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 |
90+
| name | Name (e.g. `app` or `db`) | string | - | yes |
91+
| namespace | Namespace (e.g. `eg` or `cp`) | string | - | yes |
92+
| 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 |
93+
| region | If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee. | string | `` | no |
94+
| sse_algorithm | The server-side encryption algorithm to use. Valid values are `AES256` and `aws:kms` | string | `AES256` | no |
95+
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | - | yes |
96+
| tags | Additional tags (e.g. `{ BusinessUnit = "XYZ" }` | map | `<map>` | no |
97+
| user_enabled | Set to `true` to create an S3 user with permission to access the bucket | string | `false` | no |
98+
| versioning_enabled | A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket. | string | `false` | no |
99+
100+
## Outputs
101+
102+
| Name | Description |
103+
|------|-------------|
104+
| access_key_id | The access key ID |
105+
| bucket_arn | Bucket ARN |
106+
| bucket_domain_name | FQDN of bucket |
107+
| bucket_id | Bucket Name (aka ID) |
108+
| enabled | Is module enabled |
109+
| s3_bucket_arn | S3 bucket ARN |
110+
| secret_access_key | The secret access key. This will be written to the state file in plain-text |
111+
| user_arn | The ARN assigned by AWS for the user |
112+
| user_enabled | Is user creation enabled |
113+
| user_name | Normalized IAM user name |
114+
| user_unique_id | The user unique ID assigned by AWS |
115+
116+
117+
118+
119+
## Share the Love
120+
121+
Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/terraform-aws-s3-bucket)! (it helps us **a lot**)
122+
123+
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
124+
125+
126+
## Related Projects
127+
128+
Check out these related projects.
129+
130+
- [terraform-aws-cloudfront-s3-cdn](https://github.com/cloudposse/terraform-aws-cloudfront-s3-cdn) - Terraform module to easily provision CloudFront CDN backed by an S3 origin
131+
- [terraform-aws-s3-website](https://github.com/cloudposse/terraform-aws-s3-website) - Terraform Module for Creating S3 backed Websites and Route53 DNS
132+
- [terraform-aws-user-data-s3-backend](https://github.com/cloudposse/terraform-aws-user-data-s3-backend) - Terraform Module to Offload User Data to S3
133+
- [terraform-aws-s3-logs-athena-query](https://github.com/cloudposse/terraform-aws-s3-logs-athena-query) - A Terraform module that creates an Athena Database and Structure for querying S3 access logs
134+
- [terraform-aws-lb-s3-bucket](https://github.com/cloudposse/terraform-aws-lb-s3-bucket) - Terraform module to provision an S3 bucket with built in IAM policy to allow AWS Load Balancers to ship access logs
135+
- [terraform-aws-s3-log-storage](https://github.com/cloudposse/terraform-aws-s3-log-storage) - Terraform module creates an S3 bucket suitable for receiving logs from other AWS services such as S3, CloudFront, and CloudTrail
136+
137+
138+
139+
## Help
140+
141+
**Got a question?**
142+
143+
File a GitHub [issue](https://github.com/cloudposse/terraform-aws-s3-bucket/issues), send us an [email][email] or join our [Slack Community][slack].
144+
145+
[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
146+
147+
## Commercial Support
148+
149+
Work directly with our team of DevOps experts via email, slack, and video conferencing.
150+
151+
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.
152+
153+
[![E-Mail](https://img.shields.io/badge/[email protected])][email]
154+
155+
- **Questions.** We'll use a Shared Slack channel between your team and ours.
156+
- **Troubleshooting.** We'll help you triage why things aren't working.
157+
- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback.
158+
- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects.
159+
- **Build New Terraform Modules.** We'll [develop original modules][module_development] to provision infrastructure.
160+
- **Cloud Architecture.** We'll assist with your cloud strategy and design.
161+
- **Implementation.** We'll provide hands-on support to implement our reference architectures.
162+
163+
164+
165+
## Terraform Module Development
166+
167+
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.
168+
169+
170+
## Slack Community
171+
172+
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.
173+
174+
## Newsletter
175+
176+
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.
177+
178+
## Contributing
179+
180+
### Bug Reports & Feature Requests
181+
182+
Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-s3-bucket/issues) to report any bugs or file feature requests.
183+
184+
### Developing
185+
186+
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].
187+
188+
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
189+
190+
1. **Fork** the repo on GitHub
191+
2. **Clone** the project to your own machine
192+
3. **Commit** changes to your own branch
193+
4. **Push** your work back up to your fork
194+
5. Submit a **Pull Request** so that we can review your changes
195+
196+
**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!
197+
198+
199+
## Copyright
200+
201+
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)
202+
203+
204+
205+
## License
206+
207+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
208+
209+
See [LICENSE](LICENSE) for full details.
210+
211+
Licensed to the Apache Software Foundation (ASF) under one
212+
or more contributor license agreements. See the NOTICE file
213+
distributed with this work for additional information
214+
regarding copyright ownership. The ASF licenses this file
215+
to you under the Apache License, Version 2.0 (the
216+
"License"); you may not use this file except in compliance
217+
with the License. You may obtain a copy of the License at
218+
219+
https://www.apache.org/licenses/LICENSE-2.0
220+
221+
Unless required by applicable law or agreed to in writing,
222+
software distributed under the License is distributed on an
223+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
224+
KIND, either express or implied. See the License for the
225+
specific language governing permissions and limitations
226+
under the License.
227+
228+
229+
230+
231+
232+
233+
234+
235+
236+
## Trademarks
237+
238+
All other trademarks referenced herein are the property of their respective owners.
239+
240+
## About
241+
242+
This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know by [leaving a testimonial][testimonial]!
243+
244+
[![Cloud Posse][logo]][website]
245+
246+
We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We ❤️ [Open Source Software][we_love_open_source].
247+
248+
We offer [paid support][commercial_support] on all of our projects.
249+
250+
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.
251+
252+
253+
254+
### Contributors
255+
256+
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Maxim Mironenko][maximmi_avatar]][maximmi_homepage]<br/>[Maxim Mironenko][maximmi_homepage] | [![Josh Myers][joshmyers_avatar]][joshmyers_homepage]<br/>[Josh Myers][joshmyers_homepage] |
257+
|---|---|---|---|
258+
259+
[osterman_homepage]: https://github.com/osterman
260+
[osterman_avatar]: https://github.com/osterman.png?size=150
261+
[aknysh_homepage]: https://github.com/aknysh
262+
[aknysh_avatar]: https://github.com/aknysh.png?size=150
263+
[maximmi_homepage]: https://github.com/maximmi
264+
[maximmi_avatar]: https://github.com/maximmi.png?size=150
265+
[joshmyers_homepage]: https://github.com/joshmyers
266+
[joshmyers_avatar]: https://github.com/joshmyers.png?size=150
267+
268+
269+
270+
[![README Footer][readme_footer_img]][readme_footer_link]
271+
[![Beacon][beacon]][website]
272+
273+
[logo]: https://cloudposse.com/logo-300x69.svg
274+
[docs]: https://cpco.io/docs
275+
[website]: https://cpco.io/homepage
276+
[github]: https://cpco.io/github
277+
[jobs]: https://cpco.io/jobs
278+
[hire]: https://cpco.io/hire
279+
[slack]: https://cpco.io/slack
280+
[linkedin]: https://cpco.io/linkedin
281+
[twitter]: https://cpco.io/twitter
282+
[testimonial]: https://cpco.io/leave-testimonial
283+
[newsletter]: https://cpco.io/newsletter
284+
[email]: https://cpco.io/email
285+
[commercial_support]: https://cpco.io/commercial-support
286+
[we_love_open_source]: https://cpco.io/we-love-open-source
287+
[module_development]: https://cpco.io/module-development
288+
[terraform_modules]: https://cpco.io/terraform-modules
289+
[readme_header_img]: https://cloudposse.com/readme/header/img?repo=cloudposse/terraform-aws-s3-bucket
290+
[readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/terraform-aws-s3-bucket
291+
[readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/terraform-aws-s3-bucket
292+
[readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/terraform-aws-s3-bucket
293+
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/terraform-aws-s3-bucket
294+
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/terraform-aws-s3-bucket
295+
[share_twitter]: https://twitter.com/intent/tweet/?text=terraform-aws-s3-bucket&url=https://github.com/cloudposse/terraform-aws-s3-bucket
296+
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=terraform-aws-s3-bucket&url=https://github.com/cloudposse/terraform-aws-s3-bucket
297+
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/terraform-aws-s3-bucket
298+
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/terraform-aws-s3-bucket
299+
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-aws-s3-bucket
300+
[share_email]: mailto:?subject=terraform-aws-s3-bucket&body=https://github.com/cloudposse/terraform-aws-s3-bucket
301+
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-aws-s3-bucket?pixel&cs=github&cm=readme&an=terraform-aws-s3-bucket

0 commit comments

Comments
 (0)