You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add S3 Object Lock pass-through support to the cloudtrail-s3-bucket module. This enables compliance requirements like PCI by allowing WORM (write-once-read-many) protection on CloudTrail logs. Object Lock must be enabled at bucket creation time and requires versioning (enabled by default).
Copy file name to clipboardExpand all lines: README.md
+25Lines changed: 25 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,7 @@ The module supports the following:
43
43
1. Forced [server-side encryption](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html) at rest for the S3 bucket
44
44
2. S3 bucket [versioning](https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html) to easily recover from both unintended user actions and application failures
45
45
3. S3 bucket is protected from deletion if it's not empty ([force_destroy](https://www.terraform.io/docs/providers/aws/r/s3_bucket.html#force_destroy) set to `false`)
46
+
4.[S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) for WORM (write-once-read-many) protection, useful for compliance requirements (e.g., PCI)
46
47
47
48
48
49
> [!TIP]
@@ -73,6 +74,29 @@ module "s3_bucket" {
73
74
}
74
75
```
75
76
77
+
### With S3 Object Lock (for compliance)
78
+
79
+
S3 Object Lock can only be enabled at bucket creation time and requires versioning (enabled by default).
80
+
81
+
```hcl
82
+
module "s3_bucket" {
83
+
source = "cloudposse/cloudtrail-s3-bucket/aws"
84
+
# Cloud Posse recommends pinning every module to a specific version
85
+
# version = "x.x.x"
86
+
namespace = "eg"
87
+
stage = "prod"
88
+
name = "cluster"
89
+
90
+
versioning_enabled = true
91
+
92
+
object_lock_configuration = {
93
+
mode = "GOVERNANCE"
94
+
days = 365
95
+
years = null
96
+
}
97
+
}
98
+
```
99
+
76
100
> [!IMPORTANT]
77
101
> In Cloud Posse's examples, we avoid pinning modules to specific versions to prevent discrepancies between the documentation
78
102
> and the latest released versions. However, for your own projects, we strongly advise pinning each module to the exact version
@@ -155,6 +179,7 @@ module "s3_bucket" {
155
179
| <aname="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 |
156
180
| <aname="input_noncurrent_version_expiration_days"></a> [noncurrent\_version\_expiration\_days](#input\_noncurrent\_version\_expiration\_days)| Specifies when noncurrent object versions expire |`number`|`90`| no |
157
181
| <aname="input_noncurrent_version_transition_days"></a> [noncurrent\_version\_transition\_days](#input\_noncurrent\_version\_transition\_days)| Specifies when noncurrent object versions transitions |`number`|`30`| no |
182
+
| <aname="input_object_lock_configuration"></a> [object\_lock\_configuration](#input\_object\_lock\_configuration)| A configuration for S3 object locking. With S3 Object Lock, you can store objects using a write-once-read-many (WORM) model. Object Lock can help prevent objects from being deleted or overwritten for a fixed amount of time or indefinitely. | <pre>object({<br/> mode = string # Valid values are GOVERNANCE and COMPLIANCE.<br/> days = number<br/> years = number<br/> })</pre> |`null`| no |
158
183
| <aname="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 |
159
184
| <aname="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 |
160
185
| <aname="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 |
Copy file name to clipboardExpand all lines: README.yaml
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,7 @@ description: |-
57
57
1. Forced [server-side encryption](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html) at rest for the S3 bucket
58
58
2. S3 bucket [versioning](https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html) to easily recover from both unintended user actions and application failures
59
59
3. S3 bucket is protected from deletion if it's not empty ([force_destroy](https://www.terraform.io/docs/providers/aws/r/s3_bucket.html#force_destroy) set to `false`)
60
+
4. [S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) for WORM (write-once-read-many) protection, useful for compliance requirements (e.g., PCI)
60
61
61
62
# How to use this project
62
63
usage: |-
@@ -71,5 +72,28 @@ usage: |-
71
72
}
72
73
```
73
74
75
+
### With S3 Object Lock (for compliance)
76
+
77
+
S3 Object Lock can only be enabled at bucket creation time and requires versioning (enabled by default).
78
+
79
+
```hcl
80
+
module "s3_bucket" {
81
+
source = "cloudposse/cloudtrail-s3-bucket/aws"
82
+
# Cloud Posse recommends pinning every module to a specific version
description="Prefix filter. Used to manage object notifications"
149
149
default=""
150
+
}
151
+
152
+
variable"object_lock_configuration" {
153
+
type=object({
154
+
mode =string# Valid values are GOVERNANCE and COMPLIANCE.
155
+
days =number
156
+
years =number
157
+
})
158
+
default=null
159
+
description="A configuration for S3 object locking. With S3 Object Lock, you can store objects using a write-once-read-many (WORM) model. Object Lock can help prevent objects from being deleted or overwritten for a fixed amount of time or indefinitely."
0 commit comments