5

I have what I think is a simple Terraform config for AWS ElastiCache with Redis:

resource "aws_elasticache_replication_group" "my_replication_group" {
  replication_group_id          = "my-rep-group",
  replication_group_description = "eln00b"

  node_type                     = "cache.m4.large"
  port                          = 6379
  parameter_group_name          = "default.redis5.0.cluster.on"

  snapshot_retention_limit      = 1
  snapshot_window               = "00:00-05:00"

  subnet_group_name             = "${aws_elasticache_subnet_group.my_subnet_group.name}"

  automatic_failover_enabled    = true

  cluster_mode {
    num_node_groups             = 1
    replicas_per_node_group     = 1
  }
}

I tried to define the endpoint output using:

output "my_cache" {
  value = "${aws_elasticache_replication_group.my_replication_group.primary_endpoint_address}"
}

When I run an apply through terragrunt I get:

Error: Error running plan: 1 error(s) occurred:

module.mod.output.my_cache: Resource 'aws_elasticache_replication_group.my_replication_group' does not have attribute 'primary_endpoint_address' for variable 'aws_elasticache_replication_group.my_replication_group.primary_endpoint_address'

What am I doing wrong here?

ydaetskcoR
  • 53,225
  • 8
  • 158
  • 177
el n00b
  • 1,957
  • 7
  • 37
  • 64
  • Documentation here says it should be available: https://www.terraform.io/docs/providers/aws/d/elasticache_replication_group.html – el n00b Jan 29 '19 at 01:02
  • Weird, is this issue applicable at all? https://github.com/cloudposse/terraform-aws-elasticache-redis/issues/16 – Adil B Jan 29 '19 at 01:13

1 Answers1

4

The primary_endpoint_address attribute is only available for non cluster-mode Redis replication groups as mentioned in the docs:

primary_endpoint_address - (Redis only) The address of the endpoint for the primary node in the replication group, if the cluster mode is disabled.

When using cluster mode you should use configuration_endpoint_address instead to connect to the Redis cluster.

ydaetskcoR
  • 53,225
  • 8
  • 158
  • 177