Skip to content

Commit bcf1180

Browse files
authored
Merge pull request #102 from henworth/add-kms
feat: allow the use of an existing kms key
2 parents bf9ad7c + 11838c6 commit bcf1180

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ module "bootstrap" {
5959
| Name | Description | Type | Default | Required |
6060
|------|-------------|------|---------|:--------:|
6161
| account\_alias | The desired AWS account alias. | `string` | n/a | yes |
62+
| bucket\_key\_enabled | Whether or not to use Amazon S3 Bucket Keys for SSE-KMS. | `bool` | `false` | no |
6263
| bucket\_purpose | Name to identify the bucket's purpose | `string` | `"tf-state"` | no |
6364
| dynamodb\_point\_in\_time\_recovery | Point-in-time recovery options | `bool` | `false` | no |
6465
| dynamodb\_table\_name | Name of the DynamoDB Table for locking Terraform state. | `string` | `"terraform-state-lock"` | no |
6566
| dynamodb\_table\_tags | Tags of the DynamoDB Table for locking Terraform state. | `map(string)` | ```{ "Automation": "Terraform", "Name": "terraform-state-lock" }``` | no |
6667
| enable\_s3\_public\_access\_block | Bool for toggling whether the s3 public access block resource should be enabled. | `bool` | `true` | no |
68+
| kms\_master\_key\_id | The AWS KMS master key ID used for the SSE-KMS encryption of the state bucket. | `string` | `null` | no |
6769
| log\_bucket\_tags | Tags to associate with the bucket storing the Terraform state bucket logs | `map(string)` | ```{ "Automation": "Terraform" }``` | no |
6870
| log\_bucket\_versioning | A string that indicates the versioning status for the log bucket. | `string` | `"Disabled"` | no |
6971
| log\_name | Log name (for backwards compatibility this can be modified to logs) | `string` | `"log"` | no |

main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ module "terraform_state_bucket" {
2020
logging_bucket = local.logging_bucket
2121

2222
use_account_alias_prefix = false
23+
bucket_key_enabled = var.bucket_key_enabled
24+
kms_master_key_id = var.kms_master_key_id
25+
sse_algorithm = var.kms_master_key_id != null ? "aws:kms" : null
2326

2427
enable_s3_public_access_block = var.enable_s3_public_access_block
2528
tags = var.state_bucket_tags

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,15 @@ variable "manage_account_alias" {
8080
default = true
8181
description = "Manage the account alias as a resource. Set to 'false' if this behavior is not desired."
8282
}
83+
84+
variable "kms_master_key_id" {
85+
type = string
86+
default = null
87+
description = "The AWS KMS master key ID used for the SSE-KMS encryption of the state bucket."
88+
}
89+
90+
variable "bucket_key_enabled" {
91+
type = bool
92+
default = false
93+
description = "Whether or not to use Amazon S3 Bucket Keys for SSE-KMS."
94+
}

0 commit comments

Comments
 (0)