Skip to content

Commit d7da47b

Browse files
maartenvanderhoefaknysh
authored andcommitted
Adding mfa_delete option to aws_s3_bucket. (#8)
1 parent 053b4a8 commit d7da47b

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ https://www.terraform.io/docs/backends/types/s3.html
2020

2121
__NOTE:__ The operators of the module (IAM Users) must have permissions to create S3 buckets and DynamoDB tables when performing `terraform plan` and `terraform apply`
2222

23+
__NOTE:__ This module cannot be used to apply changes to the `mfa_delete` feature of the bucket. Changes regarding mfa_delete can only be made manually using the root credentials with MFA of the AWS Account where the bucket resides. Please see: https://github.com/terraform-providers/terraform-provider-aws/issues/62
24+
2325

2426
---
2527

@@ -95,8 +97,9 @@ and the DynamoDB table will be used to lock the state to prevent concurrent modi
9597
```
9698
Available targets:
9799
98-
help This help screen
100+
help Help screen
99101
help/all Display help for all targets
102+
help/short This help short screen
100103
lint Lint terraform code
101104
102105
```
@@ -110,6 +113,7 @@ Available targets:
110113
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
111114
| enable_server_side_encryption | Enable DynamoDB server-side encryption | string | `true` | no |
112115
| force_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | string | `false` | no |
116+
| mfa_delete | A boolean that indicates that versions of S3 objects can only be deleted with MFA. ( Terraform cannot apply changes of this value; https://github.com/terraform-providers/terraform-provider-aws/issues/629 ) | string | `false` | no |
113117
| name | Name (e.g. `app` or `cluster`) | string | `terraform` | no |
114118
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
115119
| read_capacity | DynamoDB read capacity units | string | `5` | no |
@@ -256,10 +260,14 @@ Check out [our other projects][github], [apply for a job][jobs], or [hire us][hi
256260

257261
### Contributors
258262

259-
| [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] |
260-
|---|
263+
| [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Maarten van der Hoef][maartenvanderhoef_avatar]][maartenvanderhoef_homepage]<br/>[Maarten van der Hoef][maartenvanderhoef_homepage] |
264+
|---|---|---|
261265

262266
[aknysh_homepage]: https://github.com/aknysh
263267
[aknysh_avatar]: https://github.com/aknysh.png?size=150
268+
[osterman_homepage]: https://github.com/osterman
269+
[osterman_avatar]: https://github.com/osterman.png?size=150
270+
[maartenvanderhoef_homepage]: https://github.com/maartenvanderhoef
271+
[maartenvanderhoef_avatar]: https://github.com/maartenvanderhoef.png?size=150
264272

265273

README.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ description: |-
5353
5454
__NOTE:__ The operators of the module (IAM Users) must have permissions to create S3 buckets and DynamoDB tables when performing `terraform plan` and `terraform apply`
5555
56+
__NOTE:__ This module cannot be used to apply changes to the `mfa_delete` feature of the bucket. Changes regarding mfa_delete can only be made manually using the root credentials with MFA of the AWS Account where the bucket resides. Please see: https://github.com/terraform-providers/terraform-provider-aws/issues/62
57+
5658
# How to use this project
5759
usage: |-
5860
```hcl
@@ -110,4 +112,8 @@ include:
110112
# Contributors to this project
111113
contributors:
112114
- name: "Andriy Knysh"
113-
github: "aknysh"
115+
github: "aknysh"
116+
- name: "Erik Osterman"
117+
github: "osterman"
118+
- name: "Maarten van der Hoef"
119+
github: "maartenvanderhoef"

docs/targets.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
```
33
Available targets:
44
5-
help This help screen
5+
help Help screen
66
help/all Display help for all targets
7+
help/short This help short screen
78
lint Lint terraform code
89
910
```

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
| delimiter | Delimiter to be used between `namespace`, `stage`, `name`, and `attributes` | string | `-` | no |
99
| enable_server_side_encryption | Enable DynamoDB server-side encryption | string | `true` | no |
1010
| force_destroy | A boolean that indicates the S3 bucket can be destroyed even if it contains objects. These objects are not recoverable | string | `false` | no |
11+
| mfa_delete | A boolean that indicates that versions of S3 objects can only be deleted with MFA. ( Terraform cannot apply changes of this value; https://github.com/terraform-providers/terraform-provider-aws/issues/629 ) | string | `false` | no |
1112
| name | Name (e.g. `app` or `cluster`) | string | `terraform` | no |
1213
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | - | yes |
1314
| read_capacity | DynamoDB read capacity units | string | `5` | no |

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ resource "aws_s3_bucket" "default" {
1515
force_destroy = "${var.force_destroy}"
1616

1717
versioning {
18-
enabled = true
18+
enabled = true
19+
mfa_delete = "${var.mfa_delete}"
1920
}
2021

2122
server_side_encryption_configuration {

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ variable "force_destroy" {
5858
default = "false"
5959
}
6060

61+
variable "mfa_delete" {
62+
description = "A boolean that indicates that versions of S3 objects can only be deleted with MFA. ( Terraform cannot apply changes of this value; https://github.com/terraform-providers/terraform-provider-aws/issues/629 )"
63+
default = "false"
64+
}
65+
6166
variable "enable_server_side_encryption" {
6267
description = "Enable DynamoDB server-side encryption"
6368
default = "true"

0 commit comments

Comments
 (0)