SubnetGroup

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

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var fooVpc = new Aws.Ec2.Vpc("fooVpc", new Aws.Ec2.VpcArgs
        {
            CidrBlock = "10.0.0.0/16",
            Tags = 
            {
                { "Name", "tf-test" },
            },
        });
        var fooSubnet = new Aws.Ec2.Subnet("fooSubnet", new Aws.Ec2.SubnetArgs
        {
            AvailabilityZone = "us-west-2a",
            CidrBlock = "10.0.0.0/24",
            Tags = 
            {
                { "Name", "tf-test" },
            },
            VpcId = fooVpc.Id,
        });
        var bar = new Aws.ElastiCache.SubnetGroup("bar", new Aws.ElastiCache.SubnetGroupArgs
        {
            SubnetIds = 
            {
                fooSubnet.Id,
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/elasticache"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        fooVpc, err := ec2.NewVpc(ctx, "fooVpc", &ec2.VpcArgs{
            CidrBlock: pulumi.String("10.0.0.0/16"),
            Tags: pulumi.StringMap{
                "Name": pulumi.String("tf-test"),
            },
        })
        if err != nil {
            return err
        }
        fooSubnet, err := ec2.NewSubnet(ctx, "fooSubnet", &ec2.SubnetArgs{
            AvailabilityZone: pulumi.String("us-west-2a"),
            CidrBlock:        pulumi.String("10.0.0.0/24"),
            Tags: pulumi.StringMap{
                "Name": pulumi.String("tf-test"),
            },
            VpcId: fooVpc.ID(),
        })
        if err != nil {
            return err
        }
        _, err = elasticache.NewSubnetGroup(ctx, "bar", &elasticache.SubnetGroupArgs{
            SubnetIds: pulumi.StringArray{
                fooSubnet.ID(),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

foo_vpc = aws.ec2.Vpc("fooVpc",
    cidr_block="10.0.0.0/16",
    tags={
        "Name": "tf-test",
    })
foo_subnet = aws.ec2.Subnet("fooSubnet",
    availability_zone="us-west-2a",
    cidr_block="10.0.0.0/24",
    tags={
        "Name": "tf-test",
    },
    vpc_id=foo_vpc.id)
bar = aws.elasticache.SubnetGroup("bar", subnet_ids=[foo_subnet.id])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const fooVpc = new aws.ec2.Vpc("foo", {
    cidrBlock: "10.0.0.0/16",
    tags: {
        Name: "tf-test",
    },
});
const fooSubnet = new aws.ec2.Subnet("foo", {
    availabilityZone: "us-west-2a",
    cidrBlock: "10.0.0.0/24",
    tags: {
        Name: "tf-test",
    },
    vpcId: fooVpc.id,
});
const bar = new aws.elasticache.SubnetGroup("bar", {
    subnetIds: [fooSubnet.id],
});

Create a SubnetGroup Resource

def SubnetGroup(resource_name, opts=None, description=None, name=None, subnet_ids=None, __props__=None);
func NewSubnetGroup(ctx *Context, name string, args SubnetGroupArgs, opts ...ResourceOption) (*SubnetGroup, error)
public SubnetGroup(string name, SubnetGroupArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args SubnetGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SubnetGroupArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SubnetGroupArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

SubnetGroup Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The SubnetGroup resource accepts the following input properties:

SubnetIds List<string>

List of VPC Subnet IDs for the cache subnet group

Description string

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

Name string

Name for the cache subnet group. Elasticache converts this name to lowercase.

SubnetIds []string

List of VPC Subnet IDs for the cache subnet group

Description string

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

Name string

Name for the cache subnet group. Elasticache converts this name to lowercase.

subnetIds string[]

List of VPC Subnet IDs for the cache subnet group

description string

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

name string

Name for the cache subnet group. Elasticache converts this name to lowercase.

subnet_ids List[str]

List of VPC Subnet IDs for the cache subnet group

description str

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

name str

Name for the cache subnet group. Elasticache converts this name to lowercase.

Outputs

All input properties are implicitly available as output properties. Additionally, the SubnetGroup resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing SubnetGroup Resource

Get an existing SubnetGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SubnetGroupState, opts?: CustomResourceOptions): SubnetGroup
static get(resource_name, id, opts=None, description=None, name=None, subnet_ids=None, __props__=None);
func GetSubnetGroup(ctx *Context, name string, id IDInput, state *SubnetGroupState, opts ...ResourceOption) (*SubnetGroup, error)
public static SubnetGroup Get(string name, Input<string> id, SubnetGroupState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Description string

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

Name string

Name for the cache subnet group. Elasticache converts this name to lowercase.

SubnetIds List<string>

List of VPC Subnet IDs for the cache subnet group

Description string

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

Name string

Name for the cache subnet group. Elasticache converts this name to lowercase.

SubnetIds []string

List of VPC Subnet IDs for the cache subnet group

description string

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

name string

Name for the cache subnet group. Elasticache converts this name to lowercase.

subnetIds string[]

List of VPC Subnet IDs for the cache subnet group

description str

Description for the cache subnet group. Defaults to “Managed by Pulumi”.

name str

Name for the cache subnet group. Elasticache converts this name to lowercase.

subnet_ids List[str]

List of VPC Subnet IDs for the cache subnet group

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.