Skip to content

Commit

Permalink
Changes required to work with AWS Provider >=5.x (#18)
Browse files Browse the repository at this point in the history
* Changes required to work with AWS Provider >=5.x

* Update redis/versions.tf

Co-authored-by: Philip Dubois <hello@philipdubois.be>

---------

Co-authored-by: Philip Dubois <hello@philipdubois.be>
  • Loading branch information
simonrondelez and duboisph committed Aug 9, 2023
1 parent 1bec3a2 commit ee974e3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 28 deletions.
4 changes: 2 additions & 2 deletions memcache/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource "aws_elasticache_cluster" "memcache" {
}

resource "aws_elasticache_subnet_group" "elasticache" {
name = "${var.project}-${var.environment}-memcache"
subnet_ids = var.subnets
name = "${var.project}-${var.environment}-memcache"
subnet_ids = var.subnets
}

2 changes: 1 addition & 1 deletion redis-snapshot-replicator/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ resource "aws_lambda_function" "redis_copy_snapshot" {
environment {
variables = {
TARGET_BUCKET = aws_s3_bucket.bucket[0].id
DB_INSTANCES = join(",", var.db_instances)
DB_INSTANCES = join(",", var.db_instances)
}
}
}
Expand Down
40 changes: 20 additions & 20 deletions redis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ locals {
}

resource "aws_elasticache_replication_group" "redis" {
replication_group_id = "${var.project}-${var.environment}-${var.name}"
replication_group_description = "Redis cluster for ${var.project}-${var.environment}-${var.name}"
engine = "redis"
engine_version = var.engine_version
port = var.port
node_type = var.node_type
number_cache_clusters = var.num_cache_nodes
parameter_group_name = var.parameter_group_name
security_group_ids = [aws_security_group.sg_redis.id]
subnet_group_name = aws_elasticache_subnet_group.elasticache.id
availability_zones = var.availability_zones
automatic_failover_enabled = var.automatic_failover_enabled
snapshot_window = var.snapshot_window
snapshot_retention_limit = var.snapshot_retention_limit
snapshot_arns = var.snapshot_arns
multi_az_enabled = var.multi_az_enabled
at_rest_encryption_enabled = var.at_rest_encryption_enabled
transit_encryption_enabled = var.transit_encryption_enabled
auth_token = var.auth_token
notification_topic_arn = var.notification_topic_arn
replication_group_id = "${var.project}-${var.environment}-${var.name}"
description = "Redis cluster for ${var.project}-${var.environment}-${var.name}"
engine = "redis"
engine_version = var.engine_version
port = var.port
node_type = var.node_type
num_cache_clusters = var.num_cache_nodes
parameter_group_name = var.parameter_group_name
security_group_ids = [aws_security_group.sg_redis.id]
subnet_group_name = aws_elasticache_subnet_group.elasticache.id
preferred_cache_cluster_azs = var.availability_zones
automatic_failover_enabled = var.automatic_failover_enabled
snapshot_window = var.snapshot_window
snapshot_retention_limit = var.snapshot_retention_limit
snapshot_arns = var.snapshot_arns
multi_az_enabled = var.multi_az_enabled
at_rest_encryption_enabled = var.at_rest_encryption_enabled
transit_encryption_enabled = var.transit_encryption_enabled
auth_token = var.auth_token
notification_topic_arn = var.notification_topic_arn

dynamic "log_delivery_configuration" {
for_each = local.log_delivery_configuration
Expand Down
8 changes: 3 additions & 5 deletions redis/versions.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@

terraform {
required_version = ">= 0.12"
required_version = ">= 0.15"

required_providers {
aws = {
source = "hashicorp/aws"
# Version 5.x introduces some breaking changes for aws_elasticache_* resources
# and this module does not support it
version = "< 5.0.0"
source = "hashicorp/aws"
version = ">= 5.0.0"
}
}
}

0 comments on commit ee974e3

Please sign in to comment.