From d60b842582b72368831be7a473966deb6b3403cb Mon Sep 17 00:00:00 2001 From: Byungjin Park Date: Wed, 1 Jun 2022 21:43:09 +0900 Subject: [PATCH] Fix invalid versioning_mfa_deletion variable on s3-archive-bucket module --- modules/s3-archive-bucket/README.md | 2 +- modules/s3-archive-bucket/lifecycle.tf | 2 +- modules/s3-archive-bucket/variables.tf | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/s3-archive-bucket/README.md b/modules/s3-archive-bucket/README.md index 9ac7153..59580b3 100644 --- a/modules/s3-archive-bucket/README.md +++ b/modules/s3-archive-bucket/README.md @@ -83,7 +83,7 @@ No modules. | [tags](#input\_tags) | (Optional) A map of tags to add to all resources. | `map(string)` | `{}` | no | | [tls\_required](#input\_tls\_required) | (Optional) Deny any access to the S3 bucket that is not encrypted in-transit if true. | `bool` | `true` | no | | [transfer\_acceleration\_enabled](#input\_transfer\_acceleration\_enabled) | (Optional) Whether to use an accelerated endpoint for faster data transfers. | `bool` | `false` | no | -| [versioning\_mfa\_deletion](#input\_versioning\_mfa\_deletion) | (Optional) A configuration for MFA (Multi-factors Authentication) of the bucket versioning on deletion. `versioning_mfa_deletion` block as defined below.
(Required) `enabled` - Whether MFA delete is enabled in the bucket versioning configuration. Default is `false`.
(Required) `device` - The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. |
object({
enabled = bool
device = string
})
|
{
"device": null,
"enabled": false
}
| no | +| [versioning\_mfa\_deletion](#input\_versioning\_mfa\_deletion) | (Optional) A configuration for MFA (Multi-factors Authentication) of the bucket versioning on deletion. `versioning_mfa_deletion` block as defined below.
(Required) `enabled` - Whether MFA delete is enabled in the bucket versioning configuration. Default is `false`.
(Required) `device` - The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. |
object({
enabled = bool
device = string
})
| `null` | no | | [versioning\_status](#input\_versioning\_status) | (Optional) A desired status of the bucket versioning. Valid values are `ENABLED`, `SUSPENDED`, or `DISABLED`. Disabled should only be used when creating or importing resources that correspond to unversioned S3 buckets. | `string` | `"DISABLED"` | no | ## Outputs diff --git a/modules/s3-archive-bucket/lifecycle.tf b/modules/s3-archive-bucket/lifecycle.tf index db939d5..3320ea1 100644 --- a/modules/s3-archive-bucket/lifecycle.tf +++ b/modules/s3-archive-bucket/lifecycle.tf @@ -24,7 +24,7 @@ resource "aws_s3_bucket_versioning" "this" { versioning_configuration { status = local.versioning_mfa_status[var.versioning_status] - mfa_delete = try(var.versioning_mfa_deletion.enabled, false) ? "Enabled" : "Disabled" + mfa_delete = try(var.versioning_mfa_deletion.enabled ? "Enabled" : "Disabled", null) } } diff --git a/modules/s3-archive-bucket/variables.tf b/modules/s3-archive-bucket/variables.tf index 21e3a16..a4141e3 100644 --- a/modules/s3-archive-bucket/variables.tf +++ b/modules/s3-archive-bucket/variables.tf @@ -39,11 +39,7 @@ variable "versioning_mfa_deletion" { enabled = bool device = string }) - default = { - enabled = false - device = null - } - nullable = false + default = null } variable "grants" {