diff --git a/README.md b/README.md index dfcf1fd..19f9a85 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ Available targets: | [engine](#input\_engine) | The name of the database engine to be used for this DB cluster. Defaults to `docdb`. Valid values: `docdb` | `string` | `"docdb"` | no | | [engine\_version](#input\_engine\_version) | The version number of the database engine to use | `string` | `"3.6.0"` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | +| [external\_security\_group\_id\_list](#input\_external\_security\_group\_id\_list) | List of external security group IDs to attach to the Document DB | `list(string)` | `[]` | no | | [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | | [instance\_class](#input\_instance\_class) | The instance class to use. For more details, see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-classes.html#db-instance-class-specs | `string` | `"db.r4.large"` | no | | [kms\_key\_id](#input\_kms\_key\_id) | The ARN for the KMS encryption key. When specifying `kms_key_id`, `storage_encrypted` needs to be set to `true` | `string` | `""` | no | diff --git a/docs/terraform.md b/docs/terraform.md index 022ee10..060e9dd 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -70,6 +70,7 @@ | [engine](#input\_engine) | The name of the database engine to be used for this DB cluster. Defaults to `docdb`. Valid values: `docdb` | `string` | `"docdb"` | no | | [engine\_version](#input\_engine\_version) | The version number of the database engine to use | `string` | `"3.6.0"` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | +| [external\_security\_group\_id\_list](#input\_external\_security\_group\_id\_list) | List of external security group IDs to attach to the Document DB | `list(string)` | `[]` | no | | [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | | [instance\_class](#input\_instance\_class) | The instance class to use. For more details, see https://docs.aws.amazon.com/documentdb/latest/developerguide/db-instance-classes.html#db-instance-class-specs | `string` | `"db.r4.large"` | no | | [kms\_key\_id](#input\_kms\_key\_id) | The ARN for the KMS encryption key. When specifying `kms_key_id`, `storage_encrypted` needs to be set to `true` | `string` | `""` | no | diff --git a/main.tf b/main.tf index 6fd7f69..4b0867e 100644 --- a/main.tf +++ b/main.tf @@ -72,7 +72,7 @@ resource "aws_docdb_cluster" "default" { kms_key_id = var.kms_key_id port = var.db_port snapshot_identifier = var.snapshot_identifier - vpc_security_group_ids = [join("", aws_security_group.default[*].id)] + vpc_security_group_ids = concat([join("", aws_security_group.default[*].id)], var.external_security_group_id_list) db_subnet_group_name = join("", aws_docdb_subnet_group.default[*].name) db_cluster_parameter_group_name = join("", aws_docdb_cluster_parameter_group.default[*].name) engine = var.engine diff --git a/variables.tf b/variables.tf index 2993425..f6ff5c3 100644 --- a/variables.tf +++ b/variables.tf @@ -46,6 +46,12 @@ variable "allowed_cidr_blocks" { description = "List of CIDR blocks to be allowed to connect to the DocumentDB cluster" } +variable "external_security_group_id_list" { + type = list(string) + default = [] + description = "List of external security group IDs to attach to the Document DB" +} + variable "vpc_id" { type = string description = "VPC ID to create the cluster in (e.g. `vpc-a22222ee`)"