Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ Type: `bool`

Default: `false`

### enable\_key\_rotation

Description: Enable kms key rotation if required

Type: `bool`

Default: `false`

### force\_destroy

Description: Force removal of s3 bucket contents on bucket destruction.

Type: `bool`

Default: `false`

### prevent\_unencrypted\_uploads

Description: Attach a bucket policy that requires all uploaded files to be explicitly encrypted. Must set the encrypted flag on the backend config.
Expand Down
9 changes: 5 additions & 4 deletions kms.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
resource "aws_kms_key" "backend" {
count = var.enable_customer_kms_key ? 1 : 0
description = "Customer key used to encrypt the backend S3 bucket"
policy = data.aws_iam_policy_document.kms[0].json
tags = var.tags
count = var.enable_customer_kms_key ? 1 : 0
description = "Customer key used to encrypt the backend S3 bucket"
enable_key_rotation = var.enable_key_rotation
policy = data.aws_iam_policy_document.kms[0].json
tags = var.tags
}

resource "aws_kms_alias" "backend" {
Expand Down
3 changes: 2 additions & 1 deletion s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ resource "aws_s3_bucket" "backend" {
}
}

tags = var.tags
force_destroy = var.force_destroy
tags = var.tags
}

resource "aws_s3_bucket_public_access_block" "backend" {
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ variable "enable_customer_kms_key" {
default = false
}

variable "enable_key_rotation" {
type = bool
description = "Enable kms key rotation if required"
default = false
}

variable "force_destroy" {
type = boolean
descrption = "Force removal of non-empty backend s3 buckets"
default = false
}

variable "tags" {
type = map(string)
description = "Tags applied to all resources"
Expand Down