Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit b4feb7f

Browse files
author
Michael McGirr
authored
Add kms to s3 remote state module (#302)
* Changes to the s3-remote-state for issue 286 * Initial attempt to add server side encryption to the s3-remote-state bucket
1 parent 941d441 commit b4feb7f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

modules/s3-remote-state/main.tf

+14
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,26 @@ variable "force_destroy" {
3535
type = bool
3636
}
3737

38+
variable "kms_key_id" {
39+
description = "The ARN of a KMS Key to use for encrypting the state"
40+
type = string
41+
}
42+
3843
resource "aws_s3_bucket" "remote-state" {
3944
bucket = var.bucket_name
4045
acl = "private"
4146
region = var.region
4247
force_destroy = var.force_destroy
4348

49+
server_side_encryption_configuration {
50+
rule {
51+
apply_server_side_encryption_by_default {
52+
kms_master_key_id = var.kms_key_id
53+
sse_algorithm = "aws:kms"
54+
}
55+
}
56+
}
57+
4458
versioning {
4559
enabled = var.versioning
4660
}

0 commit comments

Comments
 (0)