mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-15 07:00:14 -04:00
The Elasticache API accepts a mixed-case subnet name on create, but normalizes it to lowercase before storing it. When retrieving a subnet, the name is treated as case-sensitive, so the lowercase version must be used. Given that case within subnet names is not significant, the new StateFunc on the name attribute causes the state to reflect the lowercase version that the API uses, and changes in case alone will not show as a diff. Given that we must look up subnet names in lower case, we set the instance id to be a lowercase version of the user's provided name. This then allows a later Refresh call to succeed even if the user provided a mixed-case name. Previously users could work around this by just avoiding putting uppercase letters in the name, but that is often inconvenient if e.g. the name is being constructed from variables defined elsewhere that may already have uppercase letters present.
1.4 KiB
1.4 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| aws | AWS: aws_elasticache_subnet_group | docs-aws-resource-elasticache-subnet-group | Provides an ElastiCache Subnet Group resource. |
aws_elasticache_subnet_group
Provides an ElastiCache Subnet Group resource.
~> NOTE: ElastiCache Subnet Groups are only for use when working with an ElastiCache cluster inside of a VPC. If you are on EC2 Classic, see the ElastiCache Security Group resource.
Example Usage
resource "aws_vpc" "foo" {
cidr_block = "10.0.0.0/16"
tags {
Name = "tf-test"
}
}
resource "aws_subnet" "foo" {
vpc_id = "${aws_vpc.foo.id}"
cidr_block = "10.0.0.0/24"
availability_zone = "us-west-2a"
tags {
Name = "tf-test"
}
}
resource "aws_elasticache_subnet_group" "bar" {
name = "tf-test-cache-subnet"
description = "tf-test-cache-subnet-group-descr"
subnet_ids = ["${aws_subnet.foo.id}"]
}
Argument Reference
The following arguments are supported:
description– (Required) Description for the cache subnet groupname– (Required) Name for the cache subnet group. Elasticache converts this name to lowercase.subnet_ids– (Required) List of VPC Subnet IDs for the cache subnet group
Attributes Reference
The following attributes are exported:
descriptionnamesubnet_ids