Resource: awsElasticacheSubnetGroup
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
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsVpcFoo = new aws.vpc.Vpc(this, "foo", {
cidrBlock: "10.0.0.0/16",
tags: {
Name: "tf-test",
},
});
const awsSubnetFoo = new aws.subnet.Subnet(this, "foo_1", {
availabilityZone: "us-west-2a",
cidrBlock: "10.0.0.0/24",
tags: {
Name: "tf-test",
},
vpcId: awsVpcFoo.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsSubnetFoo.overrideLogicalId("foo");
new aws.elasticacheSubnetGroup.ElasticacheSubnetGroup(this, "bar", {
name: "tf-test-cache-subnet",
subnetIds: [awsSubnetFoo.id],
});
Argument Reference
The following arguments are supported:
name
– (Required) Name for the cache subnet group. ElastiCache converts this name to lowercase.description
– (Optional) Description for the cache subnet group. Defaults to "Managed by Terraform".subnetIds
– (Required) List of VPC Subnet IDs for the cache subnet grouptags
- (Optional) Key-value map of resource tags. If configured with a providerdefaultTags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
description
- The Description of the ElastiCache Subnet Group.name
- The Name of the ElastiCache Subnet Group.subnetIds
- The Subnet IDs of the ElastiCache Subnet Group.tagsAll
- A map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.
Import
ElastiCache Subnet Groups can be imported using the name
, e.g.,