Skip to content

Commit

Permalink
feat: Support aws_elasticache_user_group_association.timeouts and `…
Browse files Browse the repository at this point in the history
…aws_elasticache_replication_group.cluster_mode` (#21)
  • Loading branch information
magreenbaum authored Oct 17, 2024
1 parent 1bd81be commit 1135640
Show file tree
Hide file tree
Showing 23 changed files with 49 additions and 29 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |

## Modules
Expand Down Expand Up @@ -327,6 +327,7 @@ No modules.
| <a name="input_availability_zone"></a> [availability\_zone](#input\_availability\_zone) | Availability Zone for the cache cluster. If you want to create cache nodes in multi-az, use `preferred_availability_zones` instead | `string` | `null` | no |
| <a name="input_az_mode"></a> [az\_mode](#input\_az\_mode) | Whether the nodes in this Memcached node group are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region. Valid values for this parameter are `single-az` or `cross-az`, default is `single-az` | `string` | `null` | no |
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | Group identifier. ElastiCache converts this name to lowercase. Changing this value will re-create the resource | `string` | `""` | no |
| <a name="input_cluster_mode"></a> [cluster\_mode](#input\_cluster\_mode) | Specifies whether cluster mode is enabled or disabled. Valid values are enabled or disabled or compatible | `string` | `null` | no |
| <a name="input_cluster_mode_enabled"></a> [cluster\_mode\_enabled](#input\_cluster\_mode\_enabled) | Whether to enable Redis [cluster mode https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Replication.Redis-RedisCluster.html] | `bool` | `false` | no |
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
| <a name="input_create_cluster"></a> [create\_cluster](#input\_create\_cluster) | Determines whether an ElastiCache cluster will be created or not | `bool` | `false` | no |
Expand Down
4 changes: 2 additions & 2 deletions examples/memcached-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/memcached-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
4 changes: 2 additions & 2 deletions examples/redis-cluster-mode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/redis-cluster-mode/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
4 changes: 2 additions & 2 deletions examples/redis-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/redis-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
6 changes: 3 additions & 3 deletions examples/redis-global-replication-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws.euwest1"></a> [aws.euwest1](#provider\_aws.euwest1) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |
| <a name="provider_aws.euwest1"></a> [aws.euwest1](#provider\_aws.euwest1) | >= 5.71 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/redis-global-replication-group/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |

## Modules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
4 changes: 2 additions & 2 deletions examples/redis-replication-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/redis-replication-group/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
3 changes: 3 additions & 0 deletions examples/serverless-cache/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ module "cache_user_group" {
authentication_mode = {
type = "no-password-required"
}
timeouts = {
create = "20m"
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/serverless-cache/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ resource "aws_elasticache_replication_group" "this" {
auth_token_update_strategy = var.auth_token_update_strategy
auto_minor_version_upgrade = var.auto_minor_version_upgrade
automatic_failover_enabled = var.multi_az_enabled || var.cluster_mode_enabled ? true : var.automatic_failover_enabled
cluster_mode = var.cluster_mode
data_tiering_enabled = var.data_tiering_enabled
description = coalesce(var.description, "Replication group")
engine = var.engine
Expand Down Expand Up @@ -152,6 +153,7 @@ resource "aws_elasticache_replication_group" "global" {
auth_token_update_strategy = var.auth_token_update_strategy
auto_minor_version_upgrade = var.auto_minor_version_upgrade
automatic_failover_enabled = var.multi_az_enabled || var.cluster_mode_enabled ? true : var.automatic_failover_enabled
cluster_mode = var.cluster_mode
data_tiering_enabled = var.data_tiering_enabled
description = coalesce(var.description, "Global replication group")
engine = var.create_secondary_global_replication_group ? null : var.engine
Expand Down
4 changes: 2 additions & 2 deletions modules/serverless-cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/serverless-cache/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
4 changes: 2 additions & 2 deletions modules/user-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.71 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.47 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.71 |

## Modules

Expand Down
8 changes: 8 additions & 0 deletions modules/user-group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,12 @@ resource "aws_elasticache_user_group_association" "this" {

user_group_id = var.create && var.create_group ? aws_elasticache_user_group.this[0].user_group_id : each.value.user_group_id
user_id = aws_elasticache_user.this[each.key].user_id

dynamic "timeouts" {
for_each = try([each.value.timeouts], [])
content {
create = try(timeouts.value.create, null)
delete = try(timeouts.value.delete, null)
}
}
}
2 changes: 1 addition & 1 deletion modules/user-group/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
}
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ variable "replicas_per_node_group" {
default = null
}

variable "cluster_mode" {
description = "Specifies whether cluster mode is enabled or disabled. Valid values are enabled or disabled or compatible"
type = string
default = null
}

variable "replication_group_id" {
description = "Replication group identifier. When `create_replication_group` is set to `true`, this is the ID assigned to the replication group created. When `create_replication_group` is set to `false`, this is the ID of an externally created replication group"
type = string
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.47"
version = ">= 5.71"
}
random = {
source = "hashicorp/random"
Expand Down

0 comments on commit 1135640

Please sign in to comment.