Skip to content

Commit

Permalink
feat(aws-mongodbatlas-cluster): option to pass aws_kms config values …
Browse files Browse the repository at this point in the history
…as seperate variables (#217)
  • Loading branch information
akcinardoga authored May 15, 2024
1 parent a383795 commit b9938bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/aws-mongodbatlas-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ resource "mongodbatlas_encryption_at_rest" "aws_encryption" {

aws_kms_config {
enabled = true
customer_master_key_id = lookup(var.aws_kms_config, "customer_master_key_id")
region = lookup(var.aws_kms_config, "region")
role_id = lookup(var.aws_kms_config, "atlas_role_id")
customer_master_key_id = coalesce(lookup(var.aws_kms_config, "customer_master_key_id"), var.kms_customer_master_key_id)
region = coalesce(lookup(var.aws_kms_config, "region"), var.kms_region)
role_id = coalesce(lookup(var.aws_kms_config, "atlas_role_id"), var.atlas_role_id)
}
}

Expand Down
18 changes: 18 additions & 0 deletions modules/aws-mongodbatlas-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,24 @@ variable "encryption_at_rest_provider" {
default = ""
}

variable "kms_customer_master_key_id" {
type = string
description = "The AWS customer master key used to encrypt and decrypt the MongoDB master keys."
default = null
}

variable "kms_region" {
type = string
description = "The AWS region in which the AWS customer master key exists needed for atlas encryption at rest. Example values: EU_WEST_1, US_EAST_1"
default = null
}

variable "atlas_role_id" {
type = string
description = "Variable to define the atlas role needed for atlas encryption at rest."
default = null
}

locals {
cloud_provider = "AWS"
}
Expand Down

0 comments on commit b9938bc

Please sign in to comment.