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

aws_elasticache_cluster does not export node endpoints or IP addresses #1918

Closed
juniorplenty opened this issue May 12, 2015 · 4 comments
Closed

Comments

@juniorplenty
Copy link

(This is an issue for both memcache and redis cluster types - the example below is for redis)

Terraform 0.5.0

Sample configs:

### VARS #################################
variable "aws_access_key" {}
variable "aws_secret_key" {}
variable "region" {
  default = "us-east-1"
}
variable "availability_zone" {
  default = "us-east-1e"
}
variable "vpc_name" {
  default = "test-cache"
}

### VPC ##################################
provider "aws" {
  access_key = "${var.aws_access_key}"
  secret_key = "${var.aws_secret_key}"
  region     = "${var.region}"
}
resource "aws_vpc" "default" {
  cidr_block = "10.250.0.0/16"
  tags{
    Name = "${var.vpc_name}"
  }
}
resource "aws_internet_gateway" "default" {
  vpc_id = "${aws_vpc.default.id}"
}
resource "aws_subnet" "public" {
  vpc_id = "${aws_vpc.default.id}"
  cidr_block = "10.250.2.0/24"
  availability_zone = "${var.availability_zone}"
  map_public_ip_on_launch = true
}
resource "aws_subnet" "private" {
  vpc_id = "${aws_vpc.default.id}"
  cidr_block = "10.250.3.0/24"
  availability_zone = "${var.availability_zone}"
  map_public_ip_on_launch = true
}
resource "aws_route_table_association" "private" {
  subnet_id = "${aws_subnet.private.id}"
  route_table_id = "${aws_route_table.public.id}"
}
resource "aws_route_table" "public" {
  vpc_id = "${aws_vpc.default.id}"
  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = "${aws_internet_gateway.default.id}"
  }
}
resource "aws_route_table_association" "public" {
  subnet_id = "${aws_subnet.public.id}"
  route_table_id = "${aws_route_table.public.id}"
}

### ELASTICACHE ##########################
resource "aws_elasticache_subnet_group" "test-cache" {
  name = "test-cache-subnet"
  description = "Redis Subnet Group"
  subnet_ids = ["${aws_subnet.private.id}"]
}
resource "aws_elasticache_cluster" "test-cache" {
  cluster_id = "test-cluster"
  subnet_group_name = "${aws_elasticache_subnet_group.test-cache.name}"
  engine = "redis"
  engine_version = "2.8.19"
  node_type = "cache.t2.micro"
  num_cache_nodes = 1
  parameter_group_name = "default.redis2.8"
}

Resulting elasticache_cluster in state - note no connection information:

"aws_elasticache_cluster.test-cache": {
                    "type": "aws_elasticache_cluster",
                    "depends_on": [
                        "aws_elasticache_subnet_group.test-cache"
                    ],
                    "primary": {
                        "id": "test-cluster",
                        "attributes": {
                            "cluster_id": "test-cluster",
                            "engine": "redis",
                            "engine_version": "2.8.19",
                            "id": "test-cluster",
                            "node_type": "cache.t2.micro",
                            "num_cache_nodes": "1",
                            "parameter_group_name": "default.redis2.8",
                            "port": "11211",
                            "security_group_ids.#": "0",
                            "security_group_names.#": "0",
                            "subnet_group_name": "test-cache-subnet"
                        }
                    }
                },

Resulting entire state file:

{
    "version": 1,
    "serial": 2,
    "modules": [
        {
            "path": [
                "root"
            ],
            "outputs": {},
            "resources": {
                "aws_elasticache_cluster.test-cache": {
                    "type": "aws_elasticache_cluster",
                    "depends_on": [
                        "aws_elasticache_subnet_group.test-cache"
                    ],
                    "primary": {
                        "id": "test-cluster",
                        "attributes": {
                            "cluster_id": "test-cluster",
                            "engine": "redis",
                            "engine_version": "2.8.19",
                            "id": "test-cluster",
                            "node_type": "cache.t2.micro",
                            "num_cache_nodes": "1",
                            "parameter_group_name": "default.redis2.8",
                            "port": "11211",
                            "security_group_ids.#": "0",
                            "security_group_names.#": "0",
                            "subnet_group_name": "test-cache-subnet"
                        }
                    }
                },
                "aws_elasticache_subnet_group.test-cache": {
                    "type": "aws_elasticache_subnet_group",
                    "depends_on": [
                        "aws_subnet.private"
                    ],
                    "primary": {
                        "id": "test-cache-subnet",
                        "attributes": {
                            "description": "Redis Subnet Group",
                            "id": "test-cache-subnet",
                            "name": "test-cache-subnet",
                            "subnet_ids.#": "1",
                            "subnet_ids.470247010": "subnet-b2033588"
                        }
                    }
                },
                "aws_internet_gateway.default": {
                    "type": "aws_internet_gateway",
                    "depends_on": [
                        "aws_vpc.default"
                    ],
                    "primary": {
                        "id": "igw-391a745c",
                        "attributes": {
                            "id": "igw-391a745c",
                            "tags.#": "0",
                            "vpc_id": "vpc-5856633d"
                        }
                    }
                },
                "aws_route_table.public": {
                    "type": "aws_route_table",
                    "depends_on": [
                        "aws_internet_gateway.default",
                        "aws_vpc.default"
                    ],
                    "primary": {
                        "id": "rtb-c7626ba2",
                        "attributes": {
                            "id": "rtb-c7626ba2",
                            "propagating_vgws.#": "0",
                            "route.#": "1",
                            "route.1115501861.cidr_block": "0.0.0.0/0",
                            "route.1115501861.gateway_id": "igw-391a745c",
                            "route.1115501861.instance_id": "",
                            "route.1115501861.network_interface_id": "",
                            "route.1115501861.vpc_peering_connection_id": "",
                            "tags.#": "0",
                            "vpc_id": "vpc-5856633d"
                        }
                    }
                },
                "aws_route_table_association.private": {
                    "type": "aws_route_table_association",
                    "depends_on": [
                        "aws_route_table.public",
                        "aws_subnet.private"
                    ],
                    "primary": {
                        "id": "rtbassoc-02ce0966",
                        "attributes": {
                            "id": "rtbassoc-02ce0966",
                            "route_table_id": "rtb-c7626ba2",
                            "subnet_id": "subnet-b2033588"
                        }
                    }
                },
                "aws_route_table_association.public": {
                    "type": "aws_route_table_association",
                    "depends_on": [
                        "aws_route_table.public",
                        "aws_subnet.public"
                    ],
                    "primary": {
                        "id": "rtbassoc-01ce0965",
                        "attributes": {
                            "id": "rtbassoc-01ce0965",
                            "route_table_id": "rtb-c7626ba2",
                            "subnet_id": "subnet-bd033587"
                        }
                    }
                },
                "aws_subnet.private": {
                    "type": "aws_subnet",
                    "depends_on": [
                        "aws_vpc.default"
                    ],
                    "primary": {
                        "id": "subnet-b2033588",
                        "attributes": {
                            "availability_zone": "us-east-1e",
                            "cidr_block": "10.250.3.0/24",
                            "id": "subnet-b2033588",
                            "map_public_ip_on_launch": "true",
                            "tags.#": "0",
                            "vpc_id": "vpc-5856633d"
                        }
                    }
                },
                "aws_subnet.public": {
                    "type": "aws_subnet",
                    "depends_on": [
                        "aws_vpc.default"
                    ],
                    "primary": {
                        "id": "subnet-bd033587",
                        "attributes": {
                            "availability_zone": "us-east-1e",
                            "cidr_block": "10.250.2.0/24",
                            "id": "subnet-bd033587",
                            "map_public_ip_on_launch": "true",
                            "tags.#": "0",
                            "vpc_id": "vpc-5856633d"
                        }
                    }
                },
                "aws_vpc.default": {
                    "type": "aws_vpc",
                    "primary": {
                        "id": "vpc-5856633d",
                        "attributes": {
                            "cidr_block": "10.250.0.0/16",
                            "default_network_acl_id": "acl-c0674ca5",
                            "default_security_group_id": "sg-df2a09bb",
                            "dhcp_options_id": "dopt-8ce70be9",
                            "id": "vpc-5856633d",
                            "main_route_table_id": "rtb-fa626b9f",
                            "tags.#": "1",
                            "tags.Name": "test-cache"
                        }
                    }
                }
            }
        }
    ]
}
@juniorplenty juniorplenty changed the title aws_elasticache_cluster does not export redis node endpoint aws_elasticache_cluster does not export redis node endpoint or IP address May 12, 2015
@juniorplenty
Copy link
Author

This feels more like a bug - it's inconsistent with the behavior of other modules, it makes it impossible to use/address the elasticsearch clusters without manual intervention, and is currently a blocking issue for us, and I'm sure other shops as well...

@juniorplenty juniorplenty changed the title aws_elasticache_cluster does not export redis node endpoint or IP address aws_elasticache_cluster does not export node endpoints or IP addresses May 12, 2015
@catsby catsby added bug and removed enhancement labels May 14, 2015
@catsby
Copy link
Contributor

catsby commented May 14, 2015

Apologies for not labeling correctly, I most likely just didn't grok the full issue here. I've relabeled it, and a PR was started to address this (#1965). Hopefully should get it in soon, thanks for the issue!

@catsby
Copy link
Contributor

catsby commented May 14, 2015

Closing, this is implemented in #1965, can you check that out and update over there?

@ghost
Copy link

ghost commented May 2, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants