Skip to content

Commit 2c17ca6

Browse files
authored
Cleanups and safety checks for upgrade (#70)
1 parent 048ae6a commit 2c17ca6

File tree

7 files changed

+58
-17
lines changed

7 files changed

+58
-17
lines changed

.github/renovate.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
11
{
2-
"extends": [
3-
"config:base",
4-
":preserveSemverRanges"
5-
],
6-
"labels": ["auto-update"],
7-
"enabledManagers": [],
8-
"terraform": {
9-
"ignorePaths": ["**/context.tf", "examples/**"]
10-
}
2+
"enabled": false
113
}
12-

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@
3030

3131
This module creates an S3 bucket suitable for receiving logs from other `AWS` services such as `S3`, `CloudFront`, and `CloudTrails`.
3232

33-
It implements a configurable log retention policy, which allows you to efficiently manage logs across different storage classes (_e.g._ `Glacier`) and ultimately expire the data altogether.
33+
**WARNING:** Changes introduced in version 0.27.0 present a **HIGH RISK OF DATA LOSS** when upgrading from an
34+
earlier version. This warning does not apply to new deployments created with version 0.28.0 or later, but
35+
if upgrading from an earlier version, please follow the
36+
[upgrade instructions](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS))
37+
in this repo's Wiki.
38+
39+
This module implements a configurable log retention policy, which allows you to efficiently manage logs across different storage classes (_e.g._ `Glacier`) and ultimately expire the data altogether.
3440

3541
It enables server-side default encryption.
3642

@@ -40,6 +46,11 @@ It blocks public access to the bucket by default.
4046

4147
https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html
4248

49+
As of March, 2022, this module is primarily a wrapper around our
50+
[s3-bucket](https://github.com/cloudposse/terraform-aws-s3-bucket)
51+
module, with some options preconfigured and SQS notifications added. If it does not exactly suit your needs,
52+
you may want to use the `s3-bucket` module directly.
53+
4354
---
4455

4556
This project is part of our comprehensive ["SweetOps"](https://cpco.io/sweetops) approach towards DevOps.
@@ -103,6 +114,14 @@ the registry shows many of our inputs as required when in fact they are optional
103114
The table below correctly indicates which inputs are required.
104115

105116

117+
118+
**WARNING:** Changes introduced in version 0.27.0 present a **HIGH RISK OF DATA LOSS** when upgrading from an
119+
earlier version. This warning does not apply to new deployments created with version 0.28.0 or later, but
120+
if upgrading from an earlier version, please follow the
121+
[upgrade instructions](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS))
122+
in this repo's Wiki.
123+
124+
106125
```hcl
107126
module "log_storage" {
108127
source = "cloudposse/s3-log-storage/aws"
@@ -154,7 +173,7 @@ Available targets:
154173

155174
| Name | Source | Version |
156175
|------|--------|---------|
157-
| <a name="module_aws_s3_bucket"></a> [aws\_s3\_bucket](#module\_aws\_s3\_bucket) | cloudposse/s3-bucket/aws | 0.47.0 |
176+
| <a name="module_aws_s3_bucket"></a> [aws\_s3\_bucket](#module\_aws\_s3\_bucket) | cloudposse/s3-bucket/aws | 0.47.1 |
158177
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
159178

160179
## Resources
@@ -244,6 +263,7 @@ Are you using this project or any of our other projects? Consider [leaving a tes
244263

245264
Check out these related projects.
246265

266+
- [terraform-aws-s3-bucket](https://github.com/cloudposse/terraform-aws-s3-bucket) - Terraform module that creates an S3 bucket with an optional IAM user for external CI/CD systems
247267
- [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
248268
- [terraform-aws-s3-website](https://github.com/cloudposse/terraform-aws-s3-website) - Terraform Module for Creating S3 backed Websites and Route53 DNS
249269
- [terraform-aws-user-data-s3-backend](https://github.com/cloudposse/terraform-aws-user-data-s3-backend) - Terraform Module to Offload User Data to S3

README.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ badges:
2424
image: https://slack.cloudposse.com/badge.svg
2525
url: https://slack.cloudposse.com
2626
related:
27+
- name: terraform-aws-s3-bucket
28+
description: Terraform module that creates an S3 bucket with an optional IAM user for external CI/CD systems
29+
url: https://github.com/cloudposse/terraform-aws-s3-bucket
2730
- name: terraform-aws-cloudfront-s3-cdn
2831
description: Terraform module to easily provision CloudFront CDN backed by an S3
2932
origin
@@ -45,7 +48,13 @@ related:
4548
description: |-
4649
This module creates an S3 bucket suitable for receiving logs from other `AWS` services such as `S3`, `CloudFront`, and `CloudTrails`.
4750
48-
It implements a configurable log retention policy, which allows you to efficiently manage logs across different storage classes (_e.g._ `Glacier`) and ultimately expire the data altogether.
51+
**WARNING:** Changes introduced in version 0.27.0 present a **HIGH RISK OF DATA LOSS** when upgrading from an
52+
earlier version. This warning does not apply to new deployments created with version 0.28.0 or later, but
53+
if upgrading from an earlier version, please follow the
54+
[upgrade instructions](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS))
55+
in this repo's Wiki.
56+
57+
This module implements a configurable log retention policy, which allows you to efficiently manage logs across different storage classes (_e.g._ `Glacier`) and ultimately expire the data altogether.
4958
5059
It enables server-side default encryption.
5160
@@ -54,7 +63,21 @@ description: |-
5463
It blocks public access to the bucket by default.
5564
5665
https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html
66+
67+
As of March, 2022, this module is primarily a wrapper around our
68+
[s3-bucket](https://github.com/cloudposse/terraform-aws-s3-bucket)
69+
module, with some options preconfigured and SQS notifications added. If it does not exactly suit your needs,
70+
you may want to use the `s3-bucket` module directly.
71+
5772
usage: |-
73+
74+
**WARNING:** Changes introduced in version 0.27.0 present a **HIGH RISK OF DATA LOSS** when upgrading from an
75+
earlier version. This warning does not apply to new deployments created with version 0.28.0 or later, but
76+
if upgrading from an earlier version, please follow the
77+
[upgrade instructions](https://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS))
78+
in this repo's Wiki.
79+
80+
5881
```hcl
5982
module "log_storage" {
6083
source = "cloudposse/s3-log-storage/aws"

docs/terraform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
| Name | Source | Version |
1919
|------|--------|---------|
20-
| <a name="module_aws_s3_bucket"></a> [aws\_s3\_bucket](#module\_aws\_s3\_bucket) | cloudposse/s3-bucket/aws | 0.47.0 |
20+
| <a name="module_aws_s3_bucket"></a> [aws\_s3\_bucket](#module\_aws\_s3\_bucket) | cloudposse/s3-bucket/aws | 0.47.1 |
2121
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
2222

2323
## Resources

examples/complete/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ provider "aws" {
44

55
module "s3_log_storage" {
66
source = "../../"
7-
force_destroy = true
7+
force_destroy = false
88

99
context = module.this.context
1010
}

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ moved {
4747

4848
module "aws_s3_bucket" {
4949
source = "cloudposse/s3-bucket/aws"
50-
version = "0.47.0"
50+
version = "0.47.1"
5151

5252
bucket_name = module.this.id
5353
acl = var.acl
5454
force_destroy = var.force_destroy
5555
policy = var.policy
5656
versioning_enabled = var.versioning_enabled
5757

58-
lifecycle_rules = [local.lifecycle_rule]
58+
lifecycle_rule_ids = [module.this.id]
59+
lifecycle_rules = [local.lifecycle_rule]
5960

6061
logging = var.access_log_bucket_name == "" ? null : {
6162
bucket_name = var.access_log_bucket_name

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ variable "force_destroy" {
2626
type = bool
2727
description = "(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"
2828
default = false
29+
validation {
30+
condition = (var.force_destroy == false)
31+
# Error messages must be written on a single line.
32+
# See https://github.com/hashicorp/terraform/issues/24123
33+
error_message = "Because of the HIGH RISK OF DATA LOSS when using this version of this module, force_destroy must be set to false.\n\nWARNING: If you applied a previous version of the module with force_destroy set to true,\nsimply setting it to false here will NOT protect your data. You must set it false and apply\nthe previous version first in order to safeguard your data. See the Wiki entry at\nhttps://github.com/cloudposse/terraform-aws-s3-log-storage/wiki/Upgrading-to-v0.27.0-(POTENTIAL-DATA-LOSS)\nfor more details."
34+
}
2935
}
3036

3137
variable "lifecycle_rule_enabled" {

0 commit comments

Comments
 (0)