Skip to content

Commit 048ae6a

Browse files
authored
Refactor to use s3-bucket module, update in general (#66)
1 parent f1b6ec3 commit 048ae6a

23 files changed

+683
-665
lines changed

.github/.github-update-disabled

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This presence of a .github/.github-update-disabled file
2+
prevents `make github/update` from making any changes.
3+
The contents of the file are ignored.

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
# Cloud Posse must review any changes to standard context definition,
1717
# but some changes can be rubber-stamped.
18-
**/*.tf @cloudposse/engineering @cloudposse/approvers
19-
README.yaml @cloudposse/engineering @cloudposse/approvers
18+
**/*.tf @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
19+
README.yaml @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
2020
README.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
2121
docs/*.md @cloudposse/engineering @cloudposse/contributors @cloudposse/approvers
2222

.github/auto-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ version-resolver:
1717
- 'bugfix'
1818
- 'bug'
1919
- 'hotfix'
20+
- 'no-release'
2021
default: 'minor'
2122

2223
categories:
@@ -46,7 +47,7 @@ template: |
4647
4748
replacers:
4849
# Remove irrelevant information from Renovate bot
49-
- search: '/---\s+^#.*Renovate configuration(?:.|\n)*?This PR has been generated .*/gm'
50+
- search: '/(?<=---\s)\s*^#.*(Renovate configuration|Configuration)(?:.|\n)*?This PR has been generated .*/gm'
5051
replace: ''
5152
# Remove Renovate bot banner image
5253
- search: '/\[!\[[^\]]*Renovate\][^\]]*\](\([^)]*\))?\s*\n+/gm'

.github/mergify.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,10 @@ pull_request_rules:
5656
changes_requested: true
5757
approved: true
5858
message: "This Pull Request has been updated, so we're dismissing all reviews."
59+
60+
- name: "close Pull Requests without files changed"
61+
conditions:
62+
- "#files=0"
63+
actions:
64+
close:
65+
message: "This pull request has been automatically closed by Mergify because there are no longer any changes."

.github/renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
":preserveSemverRanges"
55
],
66
"labels": ["auto-update"],
7-
"enabledManagers": ["terraform"],
7+
"enabledManagers": [],
88
"terraform": {
99
"ignorePaths": ["**/context.tf", "examples/**"]
1010
}

.github/workflows/auto-format.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
jobs:
77
auto-format:
88
runs-on: ubuntu-latest
9-
container: cloudposse/build-harness:slim-latest
9+
container: cloudposse/build-harness:latest
1010
steps:
1111
# Checkout the pull request branch
1212
# "An action in a workflow run can’t trigger a new workflow run. For example, if an action pushes code using
@@ -29,6 +29,8 @@ jobs:
2929
- name: Auto Format
3030
if: github.event.pull_request.state == 'open'
3131
shell: bash
32+
env:
33+
GITHUB_TOKEN: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
3234
run: make BUILD_HARNESS_PATH=/build-harness PACKAGES_PREFER_HOST=true -f /build-harness/templates/Makefile.build-harness pr/auto-format/host
3335

3436
# Commit changes (if any) to the PR branch

.github/workflows/auto-readme.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "auto-readme"
2+
on:
3+
schedule:
4+
# Example of job definition:
5+
# .---------------- minute (0 - 59)
6+
# | .------------- hour (0 - 23)
7+
# | | .---------- day of month (1 - 31)
8+
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
9+
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
10+
# | | | | |
11+
# * * * * * user-name command to be executed
12+
13+
# Update README.md nightly at 4am UTC
14+
- cron: '0 4 * * *'
15+
16+
jobs:
17+
update:
18+
if: github.event_name == 'schedule'
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Update readme
24+
shell: bash
25+
id: update
26+
env:
27+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
28+
run: |
29+
make init
30+
make readme/build
31+
# Ignore changes if they are only whitespace
32+
git diff --ignore-all-space --ignore-blank-lines --quiet README.md && { git restore README.md; echo Ignoring whitespace-only changes in README; }
33+
34+
- name: Create Pull Request
35+
# This action will not create or change a pull request if there are no changes to make.
36+
# If a PR of the auto-update/readme branch is open, this action will just update it, not create a new PR.
37+
uses: cloudposse/actions/github/[email protected]
38+
with:
39+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
40+
commit-message: Update README.md and docs
41+
title: Update README.md and docs
42+
body: |-
43+
## what
44+
This is an auto-generated PR that updates the README.md and docs
45+
46+
## why
47+
To have most recent changes of README.md and doc from origin templates
48+
49+
branch: auto-update/readme
50+
base: main
51+
delete-branch: true
52+
labels: |
53+
auto-update
54+
no-release
55+
readme

.github/workflows/auto-release.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ name: auto-release
33
on:
44
push:
55
branches:
6-
- master
6+
- main
7+
- master
8+
- production
79

810
jobs:
911
publish:
1012
runs-on: ubuntu-latest
1113
steps:
12-
# Drafts your next Release notes as Pull Requests are merged into "master"
13-
- uses: release-drafter/release-drafter@v5
14-
with:
15-
publish: true
16-
prerelease: false
17-
config-name: auto-release.yml
18-
env:
19-
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
14+
# Get PR from merged commit to master
15+
- uses: actions-ecosystem/action-get-merged-pull-request@v1
16+
id: get-merged-pull-request
17+
with:
18+
github_token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
19+
# Drafts your next Release notes as Pull Requests are merged into "main"
20+
- uses: release-drafter/release-drafter@v5
21+
with:
22+
publish: ${{ !contains(steps.get-merged-pull-request.outputs.labels, 'no-release') }}
23+
prerelease: false
24+
config-name: auto-release.yml
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Validate Codeowners
22
on:
3+
workflow_dispatch:
4+
35
pull_request:
46

57
jobs:
@@ -8,18 +10,20 @@ jobs:
810
steps:
911
- name: "Checkout source code at current commit"
1012
uses: actions/checkout@v2
11-
- uses: mszostok/codeowners-validator@v0.5.0
13+
- uses: mszostok/codeowners-validator@v0.7.1
1214
if: github.event.pull_request.head.repo.full_name == github.repository
1315
name: "Full check of CODEOWNERS"
1416
with:
1517
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
1618
# files so we can use the same CODEOWNERS file for Terraform and non-Terraform repos
1719
# checks: "files,syntax,owners,duppatterns"
1820
checks: "syntax,owners,duppatterns"
21+
owner_checker_allow_unowned_patterns: "false"
1922
# GitHub access token is required only if the `owners` check is enabled
2023
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
21-
- uses: mszostok/codeowners-validator@v0.5.0
24+
- uses: mszostok/codeowners-validator@v0.7.1
2225
if: github.event.pull_request.head.repo.full_name != github.repository
2326
name: "Syntax check of CODEOWNERS"
2427
with:
2528
checks: "syntax,duppatterns"
29+
owner_checker_allow_unowned_patterns: "false"

README.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,37 +140,30 @@ Available targets:
140140

141141
| Name | Version |
142142
|------|---------|
143-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
144-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.0 |
143+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.15.0 |
144+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.0, < 4.0 |
145145
| <a name="requirement_time"></a> [time](#requirement\_time) | >= 0.7 |
146146

147147
## Providers
148148

149149
| Name | Version |
150150
|------|---------|
151-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.0 |
152-
| <a name="provider_time"></a> [time](#provider\_time) | >= 0.7 |
151+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.0, < 4.0 |
153152

154153
## Modules
155154

156155
| Name | Source | Version |
157156
|------|--------|---------|
157+
| <a name="module_aws_s3_bucket"></a> [aws\_s3\_bucket](#module\_aws\_s3\_bucket) | cloudposse/s3-bucket/aws | 0.47.0 |
158158
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
159159

160160
## Resources
161161

162162
| Name | Type |
163163
|------|------|
164-
| [aws_s3_bucket.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
165164
| [aws_s3_bucket_notification.bucket_notification](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_notification) | resource |
166-
| [aws_s3_bucket_ownership_controls.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_ownership_controls) | resource |
167-
| [aws_s3_bucket_policy.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
168-
| [aws_s3_bucket_public_access_block.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
169165
| [aws_sqs_queue.notifications](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
170-
| [time_sleep.wait_for_aws_s3_bucket_settings](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource |
171166
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
172-
| [aws_iam_policy_document.aggregated_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
173-
| [aws_iam_policy_document.bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
174167
| [aws_iam_policy_document.sqs_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
175168
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
176169

@@ -195,11 +188,12 @@ Available targets:
195188
| <a name="input_delimiter"></a> [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
196189
| <a name="input_descriptor_formats"></a> [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.<br>Map of maps. Keys are names of descriptors. Values are maps of the form<br>`{<br> format = string<br> labels = list(string)<br>}`<br>(Type is `any` so the map values can later be enhanced to provide additional options.)<br>`format` is a Terraform format string to be passed to the `format()` function.<br>`labels` is a list of labels, in order, to pass to `format()` function.<br>Label values will be normalized before being passed to `format()` so they will be<br>identical to how they appear in `id`.<br>Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no |
197190
| <a name="input_enable_glacier_transition"></a> [enable\_glacier\_transition](#input\_enable\_glacier\_transition) | Enables the transition to AWS Glacier which can cause unnecessary costs for huge amount of small files | `bool` | `true` | no |
191+
| <a name="input_enable_noncurrent_version_expiration"></a> [enable\_noncurrent\_version\_expiration](#input\_enable\_noncurrent\_version\_expiration) | Enable expiration of non-current versions | `bool` | `true` | no |
198192
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
199193
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
200194
| <a name="input_expiration_days"></a> [expiration\_days](#input\_expiration\_days) | Number of days after which to expunge the objects | `number` | `90` | no |
201195
| <a name="input_force_destroy"></a> [force\_destroy](#input\_force\_destroy) | (Optional, Default:false ) A boolean 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 |
202-
| <a name="input_glacier_transition_days"></a> [glacier\_transition\_days](#input\_glacier\_transition\_days) | Number of days after which to move the data to the glacier storage tier | `number` | `60` | no |
196+
| <a name="input_glacier_transition_days"></a> [glacier\_transition\_days](#input\_glacier\_transition\_days) | Number of days after which to move the data to the Glacier Flexible Retrieval storage tier | `number` | `60` | no |
203197
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
204198
| <a name="input_ignore_public_acls"></a> [ignore\_public\_acls](#input\_ignore\_public\_acls) | Set to `false` to disable the ignoring of public access lists on the bucket | `bool` | `true` | no |
205199
| <a name="input_kms_master_key_arn"></a> [kms\_master\_key\_arn](#input\_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 |
@@ -212,8 +206,8 @@ Available targets:
212206
| <a name="input_lifecycle_tags"></a> [lifecycle\_tags](#input\_lifecycle\_tags) | Tags filter. Used to manage object lifecycle events | `map(string)` | `{}` | no |
213207
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
214208
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
215-
| <a name="input_noncurrent_version_expiration_days"></a> [noncurrent\_version\_expiration\_days](#input\_noncurrent\_version\_expiration\_days) | Specifies when noncurrent object versions expire | `number` | `90` | no |
216-
| <a name="input_noncurrent_version_transition_days"></a> [noncurrent\_version\_transition\_days](#input\_noncurrent\_version\_transition\_days) | Specifies when noncurrent object versions transitions | `number` | `30` | no |
209+
| <a name="input_noncurrent_version_expiration_days"></a> [noncurrent\_version\_expiration\_days](#input\_noncurrent\_version\_expiration\_days) | Specifies when non-current object versions expire | `number` | `90` | no |
210+
| <a name="input_noncurrent_version_transition_days"></a> [noncurrent\_version\_transition\_days](#input\_noncurrent\_version\_transition\_days) | Specifies when noncurrent object versions transition to Glacier Flexible Retrieval | `number` | `30` | no |
217211
| <a name="input_policy"></a> [policy](#input\_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 |
218212
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
219213
| <a name="input_restrict_public_buckets"></a> [restrict\_public\_buckets](#input\_restrict\_public\_buckets) | Set to `false` to disable the restricting of making the bucket public | `bool` | `true` | no |
@@ -223,7 +217,6 @@ Available targets:
223217
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).<br>Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
224218
| <a name="input_tenant"></a> [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no |
225219
| <a name="input_versioning_enabled"></a> [versioning\_enabled](#input\_versioning\_enabled) | A state of versioning. Versioning is a means of keeping multiple variants of an object in the same bucket | `bool` | `true` | no |
226-
| <a name="input_versioning_mfa_delete_enabled"></a> [versioning\_mfa\_delete\_enabled](#input\_versioning\_mfa\_delete\_enabled) | Enable MFA delete for the bucket | `string` | `false` | no |
227220

228221
## Outputs
229222

@@ -328,7 +321,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
328321

329322
## Copyright
330323

331-
Copyright © 2017-2021 [Cloud Posse, LLC](https://cpco.io/copyright)
324+
Copyright © 2017-2022 [Cloud Posse, LLC](https://cpco.io/copyright)
332325

333326

334327

0 commit comments

Comments
 (0)