Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,31 @@ cache:
```

```hcl
resource "aws_kms_key" "redis_key" {}
resource "aws_kms_key" "redis_key" {
for_each = { for redis in local.workspace.cache.redis : redis.name => redis }
description = "redis-${each.value.name}"
}

resource "aws_kms_alias" "redis_alias" {
name = "alias/redis-${local.workspace.environment_name}"
target_key_id = aws_kms_key.redis_key.key_id
for_each = { for redis in local.workspace.cache.redis : redis.name => redis }
name = "alias/redis-${each.value.name}"
target_key_id = aws_kms_key.redis_key[each.key].key_id
}

module "cache_redis" {
source = "git::https://github.com/DNXLabs/terraform-aws-redis.git"
source = "git::https://github.com/DNXLabs/terraform-aws-redis.git?ref=change_ssm_sg"
for_each = { for redis in local.workspace.cache.redis : redis.name => redis }

name = "redis-${each.value.environment_name}"
name = try(each.value.identifier_name, "redis-${each.value.name}")
environment_name = each.value.environment_name
automatic_failover_enabled = try(each.value.automatic_failover_enabled, false)
at_rest_encryption_enabled = try(each.value.at_rest_encryption_enabled, false)
transit_encryption_enabled = try(each.value.transit_encryption_enabled, false)
multi_az_enabled = try(each.value.multi_az_enabled, false)
# auth_token = try(each.value.auth_token, "")
engine = try(each.value.engine, "redis")
engine_version = each.value.engine_version
kms_key_id = try(each.value.at_rest_encryption_enabled, false ) ? aws_kms_key.redis_key.arn : ""
kms_key_id = try(each.value.at_rest_encryption_enabled, false ) ? aws_kms_key.redis_key[each.key].arn : ""
maintenance_window = try(each.value.maintenance_window, "sun:05:00-sun:07:00")
node_type = each.value.node_type
notification_topic_arn = try(each.value.notification_topic_arn, "")
Expand All @@ -51,10 +56,9 @@ module "cache_redis" {
subnet_group_name = "${each.value.environment_name}-cachesubnet"

allow_security_group_ids = concat(
[for cluster_name in try(each.value.ecs_cluster_names, []) : module.ecs_cluster[cluster_name].ecs_nodes_secgrp_id], []
)
[for cluster_name in try(each.value.ecs_cluster_names, []) : module.ecs_cluster[cluster_name].ecs_nodes_secgrp_id], [data.aws_security_group.openvpn.id])

allow_cidrs = try(each.value.allow_cidrs, [local.common.vpn_cidr])
allow_cidrs = try(each.value.allow_cidrs, [])
subnet_ids = data.aws_subnet_ids.secure.ids
vpc_id = data.aws_vpc.selected.id

Expand Down Expand Up @@ -121,4 +125,4 @@ Module managed by [DNX Solutions](https://github.com/DNXLabs).

## License

Apache 2 Licensed. See [LICENSE](https://github.com/DNXLabs/terraform-aws-template/blob/master/LICENSE) for full details.
Apache 2 Licensed. See [LICENSE](https://github.com/DNXLabs/terraform-aws-template/blob/master/LICENSE) for full details.