Skip to content

Resource: awsMemorydbSubnetGroup

Provides a MemoryDB Subnet Group.

More information about subnet groups can be found in the MemoryDB User Guide.

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 awsVpcExample = new aws.vpc.Vpc(this, "example", {
  cidrBlock: "10.0.0.0/16",
});
const awsSubnetExample = new aws.subnet.Subnet(this, "example_1", {
  availabilityZone: "us-west-2a",
  cidrBlock: "10.0.0.0/24",
  vpcId: awsVpcExample.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.*/
awsSubnetExample.overrideLogicalId("example");
const awsMemorydbSubnetGroupExample =
  new aws.memorydbSubnetGroup.MemorydbSubnetGroup(this, "example_2", {
    name: "my-subnet-group",
    subnetIds: [awsSubnetExample.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.*/
awsMemorydbSubnetGroupExample.overrideLogicalId("example");

Argument Reference

The following arguments are required:

  • subnetIds - (Required) Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided.

The following arguments are optional:

  • name - (Optional, Forces new resource) Name of the subnet group. If omitted, Terraform will assign a random, unique name. Conflicts with namePrefix.
  • namePrefix - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with name.
  • description - (Optional) Description for the subnet group. Defaults to "managedByTerraform".
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags 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:

  • id - The name of the subnet group.
  • arn - The ARN of the subnet group.
  • vpcId - The VPC in which the subnet group exists.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

Use the name to import a subnet group. For example:

$ terraform import aws_memorydb_subnet_group.example my-subnet-group