Skip to content

Commit

Permalink
feat: Support IAM Auth mode for memorydb cluster (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
magreenbaum committed May 7, 2024
1 parent 93facd1 commit 6ad6de0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,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.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |

## Providers

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

## Modules

Expand Down Expand Up @@ -185,7 +185,7 @@ No modules.
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to use on all resources | `map(string)` | `{}` | no |
| <a name="input_tls_enabled"></a> [tls\_enabled](#input\_tls\_enabled) | A flag to enable in-transit encryption on the cluster. When set to `false`, the `acl_name` must be `open-access`. Defaults to `true` | `bool` | `null` | no |
| <a name="input_use_name_prefix"></a> [use\_name\_prefix](#input\_use\_name\_prefix) | Determines whether `name` is used as a prefix for the cluster | `bool` | `false` | no |
| <a name="input_users"></a> [users](#input\_users) | A map of user definitions (maps) to be created | `map(any)` | `{}` | no |
| <a name="input_users"></a> [users](#input\_users) | A map of user definitions (maps) to be created | `any` | `{}` | no |

## Outputs

Expand Down
6 changes: 3 additions & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,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.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.47 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |

## Providers

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

## Modules
Expand All @@ -43,7 +43,7 @@ Note that this example may create resources which will incur monetary charges on
| <a name="module_memory_db"></a> [memory\_db](#module\_memory\_db) | ../.. | n/a |
| <a name="module_memory_db_disabled"></a> [memory\_db\_disabled](#module\_memory\_db\_disabled) | ../.. | n/a |
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | terraform-aws-modules/security-group/aws | ~> 4.0 |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 4.0 |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |

## Resources

Expand Down
12 changes: 5 additions & 7 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module "memory_db" {
name = local.name
description = "Example MemoryDB cluster"

engine_version = "6.2"
engine_version = "7.0"
auto_minor_version_upgrade = true
node_type = "db.r6gd.xlarge"
num_shards = 2
Expand All @@ -49,13 +49,13 @@ module "memory_db" {
admin = {
user_name = "admin-user"
access_string = "on ~* &* +@all"
passwords = [random_password.password["admin"].result]
type = "iam"
tags = { user = "admin" }
}
readonly = {
user_name = "readonly-user"
access_string = "on ~* &* -@all +@read"
passwords = [random_password.password["readonly"].result]
passwords = [random_password.password.result]
tags = { user = "readonly" }
}
}
Expand All @@ -67,7 +67,7 @@ module "memory_db" {
# Parameter group
parameter_group_name = "${local.name}-param-group"
parameter_group_description = "Example MemoryDB parameter group"
parameter_group_family = "memorydb_redis6"
parameter_group_family = "memorydb_redis7"
parameter_group_parameters = [
{
name = "activedefrag"
Expand Down Expand Up @@ -95,7 +95,7 @@ module "memory_db" {

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 4.0"
version = "~> 5.0"

name = local.name
cidr = "10.99.0.0/18"
Expand Down Expand Up @@ -139,8 +139,6 @@ resource "aws_sns_topic" "example" {
}

resource "random_password" "password" {
for_each = toset(["admin", "readonly"])

length = 16
special = true
override_special = "_%@"
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/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.0"
version = ">= 5.47"
}
random = {
source = "hashicorp/random"
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ resource "aws_memorydb_user" "this" {
access_string = each.value.access_string

authentication_mode {
type = "password"
passwords = each.value.passwords
type = try(each.value.type, "password")
passwords = try(each.value.passwords, null)
}

tags = merge(var.tags, lookup(each.value, "tags", {}))
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ variable "create_users" {

variable "users" {
description = "A map of user definitions (maps) to be created"
type = map(any)
type = any
default = {}
}

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.0"
version = ">= 5.47"
}
}
}

0 comments on commit 6ad6de0

Please sign in to comment.