From 479b08c56390c23984013a5b51bef85573116741 Mon Sep 17 00:00:00 2001 From: Serhii Kaidalov Date: Wed, 11 May 2022 08:51:49 +0300 Subject: [PATCH 1/9] configurable memcached parameter group --- main.tf | 9 ++++++--- variables.tf | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/main.tf b/main.tf index 8685203..067cfb7 100644 --- a/main.tf +++ b/main.tf @@ -92,9 +92,12 @@ resource "aws_elasticache_parameter_group" "default" { name = module.this.id family = var.elasticache_parameter_group_family - parameter { - name = "max_item_size" - value = var.max_item_size + dynamic "parameter" { + for_each = var.parameter + content { + name = parameter.value.name + value = tostring(parameter.value.value) + } } } diff --git a/variables.tf b/variables.tf index dbab83c..48a23ac 100644 --- a/variables.tf +++ b/variables.tf @@ -4,10 +4,18 @@ variable "vpc_id" { description = "VPC ID" } -variable "max_item_size" { - type = number - default = 10485760 - description = "Max item size" +variable "parameter" { + type = list(object({ + name = string + value = string + })) + default = [ + { + name = "max_item_size" + value = 10485760 + }, + ] + description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" } variable "subnets" { From b7b75ac5b3a1e0ea8fd06cf35b2e2ef47ef3e6e9 Mon Sep 17 00:00:00 2001 From: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> Date: Wed, 11 May 2022 06:00:17 +0000 Subject: [PATCH 2/9] Auto Format --- README.md | 2 +- docs/terraform.md | 2 +- variables.tf | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ab4792d..ea478e7 100644 --- a/README.md +++ b/README.md @@ -257,10 +257,10 @@ Available targets: | [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
Default value: `lower`. | `string` | `null` | no | | [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.
Default is to include all labels.
Tags with empty values will not be included in the `tags` output.
Set to `[]` to suppress all generated tags.
**Notes:**
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` |
[
"default"
]
| no | | [maintenance\_window](#input\_maintenance\_window) | Maintenance window | `string` | `"wed:03:00-wed:04:00"` | no | -| [max\_item\_size](#input\_max\_item\_size) | Max item size | `number` | `10485760` | no | | [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | | [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | | [notification\_topic\_arn](#input\_notification\_topic\_arn) | Notification topic arn | `string` | `""` | no | +| [parameter](#input\_parameter) | A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another |
list(object({
name = string
value = string
}))
|
[
{
"name": "max_item_size",
"value": 10485760
}
]
| no | | [port](#input\_port) | Memcached port | `number` | `11211` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | [security\_group\_create\_before\_destroy](#input\_security\_group\_create\_before\_destroy) | Set `true` to enable Terraform `create_before_destroy` behavior on the created security group.
We only recommend setting this `false` if you are upgrading this module and need to keep
the existing security group from being replaced.
Note that changing this value will always cause the security group to be replaced. | `bool` | `true` | no | diff --git a/docs/terraform.md b/docs/terraform.md index b4afde0..04cefa8 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -74,10 +74,10 @@ | [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
Default value: `lower`. | `string` | `null` | no | | [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.
Default is to include all labels.
Tags with empty values will not be included in the `tags` output.
Set to `[]` to suppress all generated tags.
**Notes:**
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` |
[
"default"
]
| no | | [maintenance\_window](#input\_maintenance\_window) | Maintenance window | `string` | `"wed:03:00-wed:04:00"` | no | -| [max\_item\_size](#input\_max\_item\_size) | Max item size | `number` | `10485760` | no | | [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | | [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | | [notification\_topic\_arn](#input\_notification\_topic\_arn) | Notification topic arn | `string` | `""` | no | +| [parameter](#input\_parameter) | A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another |
list(object({
name = string
value = string
}))
|
[
{
"name": "max_item_size",
"value": 10485760
}
]
| no | | [port](#input\_port) | Memcached port | `number` | `11211` | no | | [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | | [security\_group\_create\_before\_destroy](#input\_security\_group\_create\_before\_destroy) | Set `true` to enable Terraform `create_before_destroy` behavior on the created security group.
We only recommend setting this `false` if you are upgrading this module and need to keep
the existing security group from being replaced.
Note that changing this value will always cause the security group to be replaced. | `bool` | `true` | no | diff --git a/variables.tf b/variables.tf index 48a23ac..ac4e5ba 100644 --- a/variables.tf +++ b/variables.tf @@ -11,8 +11,8 @@ variable "parameter" { })) default = [ { - name = "max_item_size" - value = 10485760 + name = "max_item_size" + value = 10485760 }, ] description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" From 06a421d9eac973417458a45ba79ecfc56cc2fa7c Mon Sep 17 00:00:00 2001 From: Max Lobur Date: Wed, 1 Mar 2023 18:26:12 +0200 Subject: [PATCH 3/9] Update variables.tf --- variables.tf | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/variables.tf b/variables.tf index ac4e5ba..c221513 100644 --- a/variables.tf +++ b/variables.tf @@ -4,20 +4,6 @@ variable "vpc_id" { description = "VPC ID" } -variable "parameter" { - type = list(object({ - name = string - value = string - })) - default = [ - { - name = "max_item_size" - value = 10485760 - }, - ] - description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" -} - variable "subnets" { type = list(string) default = [] @@ -126,6 +112,15 @@ variable "elasticache_parameter_group_family" { default = "memcached1.5" } +variable "elasticache_parameters" { + type = list(object({ + name = string + value = string + })) + default = [] + description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" +} + variable "cloudwatch_metric_alarms_enabled" { type = bool description = "Boolean flag to enable/disable CloudWatch metrics alarms" From f8f2d1c4ea106d7f97a1d03fb9a61b53ef53a2ba Mon Sep 17 00:00:00 2001 From: Max Lobur Date: Wed, 1 Mar 2023 18:28:27 +0200 Subject: [PATCH 4/9] Update variables.tf --- variables.tf | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index c221513..3bcdb06 100644 --- a/variables.tf +++ b/variables.tf @@ -117,7 +117,26 @@ variable "elasticache_parameters" { name = string value = string })) - default = [] + default = [ + { + name = "max_item_size" + value = 10485760 + }, + ] + description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" +} + +variable "parameter" { + type = list(object({ + name = string + value = string + })) + default = [ + { + name = "max_item_size" + value = 10485760 + }, + ] description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" } From f0a8016fc50f57e6f78e6265fe2e6b31482c8836 Mon Sep 17 00:00:00 2001 From: Max Lobur Date: Wed, 1 Mar 2023 18:28:51 +0200 Subject: [PATCH 5/9] Update variables.tf --- variables.tf | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/variables.tf b/variables.tf index 3bcdb06..bdfade4 100644 --- a/variables.tf +++ b/variables.tf @@ -126,20 +126,6 @@ variable "elasticache_parameters" { description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" } -variable "parameter" { - type = list(object({ - name = string - value = string - })) - default = [ - { - name = "max_item_size" - value = 10485760 - }, - ] - description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" -} - variable "cloudwatch_metric_alarms_enabled" { type = bool description = "Boolean flag to enable/disable CloudWatch metrics alarms" From dc79fb23b2fb447eb69bcd10da7bc7f4f0e50204 Mon Sep 17 00:00:00 2001 From: Max Lobur Date: Wed, 1 Mar 2023 18:30:11 +0200 Subject: [PATCH 6/9] Update main.tf --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 592c129..c4f04ee 100644 --- a/main.tf +++ b/main.tf @@ -93,7 +93,7 @@ resource "aws_elasticache_parameter_group" "default" { family = var.elasticache_parameter_group_family dynamic "parameter" { - for_each = var.parameter + for_each = var.elasticache_parameters content { name = parameter.value.name value = tostring(parameter.value.value) From e4ff9da00ac05dfb0097567aa3015b71863a41c3 Mon Sep 17 00:00:00 2001 From: Max Lobur Date: Wed, 1 Mar 2023 18:32:40 +0200 Subject: [PATCH 7/9] Update variables.tf --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index bdfade4..bedb57e 100644 --- a/variables.tf +++ b/variables.tf @@ -123,7 +123,7 @@ variable "elasticache_parameters" { value = 10485760 }, ] - description = "A list of Memcached parameters to apply. Note that parameters may differ from one Memcached family to another" + description = "A list of ElastiCache parameters to apply. Note that parameters may differ from one ElastiCache family to another" } variable "cloudwatch_metric_alarms_enabled" { From ab0cb417bbb97e1b2aace4e80e6e13b3bda4b9fc Mon Sep 17 00:00:00 2001 From: wiseelf Date: Wed, 3 Jan 2024 09:37:50 +0100 Subject: [PATCH 8/9] added encryption in-transit support --- main.tf | 1 + variables.tf | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/main.tf b/main.tf index 592c129..88b1714 100644 --- a/main.tf +++ b/main.tf @@ -122,6 +122,7 @@ resource "aws_elasticache_cluster" "default" { availability_zone = var.availability_zone preferred_availability_zones = var.availability_zones tags = module.this.tags + transit_encryption_enabled = var.transit_encryption_enabled } # diff --git a/variables.tf b/variables.tf index ac4e5ba..4ef8158 100644 --- a/variables.tf +++ b/variables.tf @@ -131,3 +131,9 @@ variable "cloudwatch_metric_alarms_enabled" { description = "Boolean flag to enable/disable CloudWatch metrics alarms" default = false } + +variable "transit_encryption_enabled" { + type = bool + description = "Enable encryption in-transit. Supported only with Memcached versions 1.6.12 and later, running in a VPC" + default = false +} From 7dbcb11e582b0d533d4ab661c0acf6ea6e7b69ab Mon Sep 17 00:00:00 2001 From: wiseelf Date: Wed, 29 May 2024 14:50:49 +0200 Subject: [PATCH 9/9] small fix --- README.md | 1 + main.tf | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e859be3..c9b0ecf 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,7 @@ Available targets: | Name | Source | Version | |------|--------|---------| | [aws\_security\_group](#module\_aws\_security\_group) | cloudposse/security-group/aws | 2.2.0 | +| [dns](#module\_dns) | cloudposse/route53-cluster-hostname/aws | 0.13.0 | | [this](#module\_this) | cloudposse/label/null | 0.25.0 | ## Resources diff --git a/main.tf b/main.tf index b2e0b23..e43302f 100644 --- a/main.tf +++ b/main.tf @@ -125,7 +125,6 @@ resource "aws_elasticache_cluster" "default" { availability_zone = var.availability_zone preferred_availability_zones = var.availability_zones tags = module.this.tags - transit_encryption_enabled = var.transit_encryption_enabled } #