Skip to content

Commit 97ef30c

Browse files
authored
Bug fixes and enhancements combined into a single breaking release (#202)
1 parent d7a4943 commit 97ef30c

23 files changed

+641
-665
lines changed

.github/renovate.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"extends": [
33
"config:base",
4-
":preserveSemverRanges"
4+
":preserveSemverRanges",
5+
":rebaseStalePrs"
56
],
6-
"baseBranches": ["main", "master", "/^release\\/v\\d{1,2}$/"],
7+
"baseBranches": ["main"],
78
"labels": ["auto-update"],
89
"dependencyDashboardAutoclose": true,
910
"enabledManagers": ["terraform"],
1011
"terraform": {
11-
"ignorePaths": ["**/context.tf", "examples/**"]
12+
"ignorePaths": ["**/context.tf"]
1213
}
1314
}

.github/workflows/release-branch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'docs/**'
1111
- 'examples/**'
1212
- 'test/**'
13+
- 'README.*'
1314

1415
permissions:
1516
contents: write

.github/workflows/release-published.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ permissions:
1111

1212
jobs:
1313
terraform-module:
14-
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release.yml@main
14+
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release-published.yml@main

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 2019-2022 Cloud Posse, LLC
189+
Copyright 2019-2023 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.

README.md

Lines changed: 34 additions & 59 deletions
Large diffs are not rendered by default.

README.yaml

Lines changed: 26 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -69,31 +69,42 @@ description: |-
6969
This module creates an S3 bucket with support for versioning, lifecycles, object locks, replication, encryption, ACL,
7070
bucket object policies, and static website hosting.
7171
72-
If `user_enabled` variable is set to `true`, the module will provision a basic IAM user with permissions to access the bucket.
73-
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
74-
[AWS IAM Instance Profiles](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html)
75-
or [AWS OIDC](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html) to authenticate and
76-
do not already have IAM credentials. Users or systems that have IAM credentials should either be granted access directly based on
77-
their IAM identity via `privileged_principal_arns` or be allowed to assume an IAM role with access.
78-
79-
We do not recommend creating IAM users this way for any other purpose.
80-
72+
For backward compatibility, it sets the S3 bucket ACL to `private` and the `s3_object_ownership`
73+
to `ObjectWriter`. Moving forward, setting `s3_object_ownership` to `BucketOwnerEnforced` is recommended,
74+
and doing so automatically disables the ACL.
75+
8176
This module blocks public access to the bucket by default. See `block_public_acls`, `block_public_policy`,
8277
`ignore_public_acls`, and `restrict_public_buckets` to change the settings. See [AWS documentation](https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html)
83-
for more details.
78+
for more details.
79+
80+
This module can optionally create an IAM User with access to the S3 bucket. This is inherently insecure in that
81+
to enable anyone to become the User, access keys must be generated, and anything generated by Terraform is stored
82+
unencrypted in the Terraform state. See the [Terraform documentation](https://www.terraform.io/docs/state/sensitive-data.html) for more details
83+
84+
The best way to grant access to the bucket is to grant one or more IAM Roles access to the bucket via `privileged_principal_arns`.
85+
This IAM Role can be assumed by EC2 instances via their Instance Profile, or Kubernetes (EKS) services using
86+
[IRSA](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html).
87+
Entities outside of AWS can assume the Role via [OIDC](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc.html).
88+
(See [this example of connecting GitHub](https://aws.amazon.com/blogs/security/use-iam-roles-to-connect-github-actions-to-actions-in-aws/)
89+
to enable GitHub actions to assume AWS IAM roles, or use [this Cloud Posse component](https://github.com/cloudposse/terraform-aws-components/tree/main/modules/github-oidc-provider)
90+
if you are already using the Cloud Posse reference architecture.)
91+
92+
If neither of those approaches work, then as a last resort you can set `user_enabled = true` and
93+
this module will provision a basic IAM user with permissions to access the bucket.
94+
We do not recommend creating IAM users this way for any other purpose.
8495
8596
If an IAM user is created, the IAM user name is constructed using [terraform-null-label](https://github.com/cloudposse/terraform-null-label)
8697
and some input is required. The simplest input is `name`. By default the name will be converted to lower case
8798
and all non-alphanumeric characters except for hyphen will be removed. See the documentation for `terraform-null-label`
8899
to learn how to override these defaults if desired.
89100
90101
If an AWS Access Key is created, it is stored either in SSM Parameter Store or is provided as a module output,
91-
but not both. Using SSM Parameter Store is recommended because module outputs are stored in plaintext in
92-
the Terraform state file.
102+
but not both. Using SSM Parameter Store is recommended because that will keep the secret from being easily accessible
103+
via Terraform remote state lookup, but the key will still be stored unencrypted in the Terraform state in any case.
93104
94105
# How to use this project
95106
usage: |-
96-
Using a [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html).
107+
Using [BucketOwnerEnforced](https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html#object-ownership-overview)
97108
98109
```hcl
99110
module "s3_bucket" {
@@ -104,7 +115,7 @@ usage: |-
104115
stage = "test"
105116
namespace = "eg"
106117
107-
acl = "private"
118+
s3_object_ownership = "BucketOwnerEnforced"
108119
enabled = true
109120
user_enabled = false
110121
versioning_enabled = false
@@ -156,41 +167,6 @@ usage: |-
156167
}
157168
```
158169
159-
Using [grants](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) to enable access
160-
to another account and for logging, and incorporating the above lifecycle configuration.
161-
162-
```hcl
163-
module "s3_bucket" {
164-
source = "cloudposse/s3-bucket/aws"
165-
# Cloud Posse recommends pinning every module to a specific version
166-
# version = "x.x.x"
167-
name = "app"
168-
stage = "test"
169-
namespace = "eg"
170-
171-
acl = ""
172-
enabled = true
173-
user_enabled = false
174-
versioning_enabled = true
175-
176-
lifecycle_configuration_rules = local.lifecycle_configuration_rules
177-
178-
grants = [
179-
{
180-
id = "012abc345def678ghi901" # Canonical user or account id
181-
type = "CanonicalUser"
182-
permissions = ["FULL_CONTROL"]
183-
uri = null
184-
},
185-
{
186-
id = null
187-
type = "Group"
188-
permissions = ["READ", "WRITE"]
189-
uri = "http://acs.amazonaws.com/groups/s3/LogDelivery"
190-
},
191-
]
192-
}
193-
```
194170
195171
Allowing specific principal ARNs to perform actions on the bucket:
196172
@@ -199,7 +175,7 @@ usage: |-
199175
source = "cloudposse/s3-bucket/aws"
200176
# Cloud Posse recommends pinning every module to a specific version
201177
# version = "x.x.x"
202-
acl = "private"
178+
s3_object_ownership = "BucketOwnerEnforced"
203179
enabled = true
204180
user_enabled = true
205181
versioning_enabled = false

0 commit comments

Comments
 (0)