Skip to content

Commit c765593

Browse files
committed
feat: adding variable to enable kms key rotation
1 parent 491b913 commit c765593

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ resource "local_file" "metaflow_config" {
112112
| <a name="input_db_instance_type"></a> [db\_instance\_type](#input\_db\_instance\_type) | RDS instance type to launch for PostgresQL database. | `string` | `"db.t2.small"` | no |
113113
| <a name="input_db_migrate_lambda_zip_file"></a> [db\_migrate\_lambda\_zip\_file](#input\_db\_migrate\_lambda\_zip\_file) | Output path for the zip file containing the DB migrate lambda | `string` | `null` | no |
114114
| <a name="input_enable_custom_batch_container_registry"></a> [enable\_custom\_batch\_container\_registry](#input\_enable\_custom\_batch\_container\_registry) | Provisions infrastructure for custom Amazon ECR container registry if enabled | `bool` | `false` | no |
115+
| <a name="input_enable_key_rotation"></a> [enable\_key\_rotation](#input\_enable\_key\_rotation) | Enable key rotation for KMS keys | `bool` | `false` | no |
115116
| <a name="input_enable_step_functions"></a> [enable\_step\_functions](#input\_enable\_step\_functions) | Provisions infrastructure for step functions if enabled | `bool` | n/a | yes |
116117
| <a name="input_extra_ui_backend_env_vars"></a> [extra\_ui\_backend\_env\_vars](#input\_extra\_ui\_backend\_env\_vars) | Additional environment variables for UI backend container | `map(string)` | `{}` | no |
117118
| <a name="input_extra_ui_static_env_vars"></a> [extra\_ui\_static\_env\_vars](#input\_extra\_ui\_static\_env\_vars) | Additional environment variables for UI static app | `map(string)` | `{}` | no |

main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module "metaflow-datastore" {
22
source = "./modules/datastore"
33

44
force_destroy_s3_bucket = var.force_destroy_s3_bucket
5+
enable_key_rotation = var.enable_key_rotation
56

67
resource_prefix = local.resource_prefix
78
resource_suffix = local.resource_suffix

modules/datastore/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ To read more, see [the Metaflow docs](https://docs.metaflow.org/metaflow-on-aws/
2424
| <a name="input_db_instance_type"></a> [db\_instance\_type](#input\_db\_instance\_type) | RDS instance type to launch for PostgresQL database. | `string` | `"db.t3.small"` | no |
2525
| <a name="input_db_name"></a> [db\_name](#input\_db\_name) | Name of PostgresQL database for Metaflow service. | `string` | `"metaflow"` | no |
2626
| <a name="input_db_username"></a> [db\_username](#input\_db\_username) | PostgresQL username; defaults to 'metaflow' | `string` | `"metaflow"` | no |
27+
| <a name="input_enable_key_rotation"></a> [enable\_key\_rotation](#input\_enable\_key\_rotation) | Enable key rotation for KMS keys | `bool` | `false` | no |
2728
| <a name="input_force_destroy_s3_bucket"></a> [force\_destroy\_s3\_bucket](#input\_force\_destroy\_s3\_bucket) | Empty S3 bucket before destroying via terraform destroy | `bool` | `false` | no |
2829
| <a name="input_metadata_service_security_group_id"></a> [metadata\_service\_security\_group\_id](#input\_metadata\_service\_security\_group\_id) | The security group ID used by the MetaData service. We'll grant this access to our DB. | `string` | n/a | yes |
2930
| <a name="input_metaflow_vpc_id"></a> [metaflow\_vpc\_id](#input\_metaflow\_vpc\_id) | ID of the Metaflow VPC this SageMaker notebook instance is to be deployed in | `string` | n/a | yes |

modules/datastore/kms.tf

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
resource "aws_kms_key" "s3" {
2-
description = "This key is used to encrypt and decrypt the S3 bucket used to store blobs."
2+
description = "This key is used to encrypt and decrypt the S3 bucket used to store blobs."
3+
enable_key_rotation = var.enable_key_rotation
34

45
tags = var.standard_tags
56
}
67

78
resource "aws_kms_key" "rds" {
8-
description = "This key is used to encrypt and decrypt the RDS database used to store flow execution data."
9+
description = "This key is used to encrypt and decrypt the RDS database used to store flow execution data."
10+
enable_key_rotation = var.enable_key_rotation
911

1012
tags = var.standard_tags
1113
}

modules/datastore/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,9 @@ variable "subnet2_id" {
6565
type = string
6666
description = "Second subnet used for availability zone redundancy"
6767
}
68+
69+
variable "enable_key_rotation" {
70+
type = bool
71+
description = "Enable key rotation for KMS keys"
72+
default = false
73+
}

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,9 @@ variable "force_destroy_s3_bucket" {
193193
description = "Empty S3 bucket before destroying via terraform destroy"
194194
default = false
195195
}
196+
197+
variable "enable_key_rotation" {
198+
type = bool
199+
description = "Enable key rotation for KMS keys"
200+
default = false
201+
}

0 commit comments

Comments
 (0)