UPD: added force_destroy support tp s3 bucket module

This commit is contained in:
xpk 2024-01-13 00:31:26 +08:00
parent b0e174bcfa
commit 436b799ff1
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
2 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,6 @@
resource "aws_s3_bucket" "this" { resource "aws_s3_bucket" "this" {
bucket = var.bucket_name bucket = var.bucket_name
force_destroy = var.bucket_force_destroy
} }
resource "aws_s3_bucket_public_access_block" "block_public_access" { resource "aws_s3_bucket_public_access_block" "block_public_access" {
@ -20,7 +21,7 @@ data "aws_iam_policy_document" "bucket_policy" {
actions = ["s3:*"] actions = ["s3:*"]
effect = "Deny" effect = "Deny"
principals { principals {
type = "*" type = "*"
identifiers = ["*"] identifiers = ["*"]
} }
resources = [ resources = [

View File

@ -3,6 +3,12 @@ variable "bucket_name" {
description = "Name of bucket" description = "Name of bucket"
} }
variable bucket_force_destroy {
type = bool
default = false
description = "Indicates all objects should be deleted from the bucket when the bucket is destroyed."
}
variable "bucket_policy_json" { variable "bucket_policy_json" {
type = string type = string
default = "{}" default = "{}"