github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/memorydb/subnetGroup.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package memorydb
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a MemoryDB Subnet Group.
    16  //
    17  // More information about subnet groups can be found in the [MemoryDB User Guide](https://docs.aws.amazon.com/memorydb/latest/devguide/subnetgroups.html).
    18  //
    19  // ## Example Usage
    20  //
    21  // <!--Start PulumiCodeChooser -->
    22  // ```go
    23  // package main
    24  //
    25  // import (
    26  //
    27  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    28  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/memorydb"
    29  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    30  //
    31  // )
    32  //
    33  //	func main() {
    34  //		pulumi.Run(func(ctx *pulumi.Context) error {
    35  //			example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
    36  //				CidrBlock: pulumi.String("10.0.0.0/16"),
    37  //			})
    38  //			if err != nil {
    39  //				return err
    40  //			}
    41  //			exampleSubnet, err := ec2.NewSubnet(ctx, "example", &ec2.SubnetArgs{
    42  //				VpcId:            example.ID(),
    43  //				CidrBlock:        pulumi.String("10.0.0.0/24"),
    44  //				AvailabilityZone: pulumi.String("us-west-2a"),
    45  //			})
    46  //			if err != nil {
    47  //				return err
    48  //			}
    49  //			_, err = memorydb.NewSubnetGroup(ctx, "example", &memorydb.SubnetGroupArgs{
    50  //				Name: pulumi.String("my-subnet-group"),
    51  //				SubnetIds: pulumi.StringArray{
    52  //					exampleSubnet.ID(),
    53  //				},
    54  //			})
    55  //			if err != nil {
    56  //				return err
    57  //			}
    58  //			return nil
    59  //		})
    60  //	}
    61  //
    62  // ```
    63  // <!--End PulumiCodeChooser -->
    64  //
    65  // ## Import
    66  //
    67  // Using `pulumi import`, import a subnet group using its `name`. For example:
    68  //
    69  // ```sh
    70  // $ pulumi import aws:memorydb/subnetGroup:SubnetGroup example my-subnet-group
    71  // ```
    72  type SubnetGroup struct {
    73  	pulumi.CustomResourceState
    74  
    75  	// The ARN of the subnet group.
    76  	Arn pulumi.StringOutput `pulumi:"arn"`
    77  	// Description for the subnet group.
    78  	Description pulumi.StringPtrOutput `pulumi:"description"`
    79  	// Name of the subnet group. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
    80  	Name pulumi.StringOutput `pulumi:"name"`
    81  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
    82  	NamePrefix pulumi.StringOutput `pulumi:"namePrefix"`
    83  	// Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided.
    84  	//
    85  	// The following arguments are optional:
    86  	SubnetIds pulumi.StringArrayOutput `pulumi:"subnetIds"`
    87  	// 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.
    88  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    89  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    90  	//
    91  	// Deprecated: Please use `tags` instead.
    92  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    93  	// The VPC in which the subnet group exists.
    94  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
    95  }
    96  
    97  // NewSubnetGroup registers a new resource with the given unique name, arguments, and options.
    98  func NewSubnetGroup(ctx *pulumi.Context,
    99  	name string, args *SubnetGroupArgs, opts ...pulumi.ResourceOption) (*SubnetGroup, error) {
   100  	if args == nil {
   101  		return nil, errors.New("missing one or more required arguments")
   102  	}
   103  
   104  	if args.SubnetIds == nil {
   105  		return nil, errors.New("invalid value for required argument 'SubnetIds'")
   106  	}
   107  	opts = internal.PkgResourceDefaultOpts(opts)
   108  	var resource SubnetGroup
   109  	err := ctx.RegisterResource("aws:memorydb/subnetGroup:SubnetGroup", name, args, &resource, opts...)
   110  	if err != nil {
   111  		return nil, err
   112  	}
   113  	return &resource, nil
   114  }
   115  
   116  // GetSubnetGroup gets an existing SubnetGroup resource's state with the given name, ID, and optional
   117  // state properties that are used to uniquely qualify the lookup (nil if not required).
   118  func GetSubnetGroup(ctx *pulumi.Context,
   119  	name string, id pulumi.IDInput, state *SubnetGroupState, opts ...pulumi.ResourceOption) (*SubnetGroup, error) {
   120  	var resource SubnetGroup
   121  	err := ctx.ReadResource("aws:memorydb/subnetGroup:SubnetGroup", name, id, state, &resource, opts...)
   122  	if err != nil {
   123  		return nil, err
   124  	}
   125  	return &resource, nil
   126  }
   127  
   128  // Input properties used for looking up and filtering SubnetGroup resources.
   129  type subnetGroupState struct {
   130  	// The ARN of the subnet group.
   131  	Arn *string `pulumi:"arn"`
   132  	// Description for the subnet group.
   133  	Description *string `pulumi:"description"`
   134  	// Name of the subnet group. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
   135  	Name *string `pulumi:"name"`
   136  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   137  	NamePrefix *string `pulumi:"namePrefix"`
   138  	// Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided.
   139  	//
   140  	// The following arguments are optional:
   141  	SubnetIds []string `pulumi:"subnetIds"`
   142  	// 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.
   143  	Tags map[string]string `pulumi:"tags"`
   144  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   145  	//
   146  	// Deprecated: Please use `tags` instead.
   147  	TagsAll map[string]string `pulumi:"tagsAll"`
   148  	// The VPC in which the subnet group exists.
   149  	VpcId *string `pulumi:"vpcId"`
   150  }
   151  
   152  type SubnetGroupState struct {
   153  	// The ARN of the subnet group.
   154  	Arn pulumi.StringPtrInput
   155  	// Description for the subnet group.
   156  	Description pulumi.StringPtrInput
   157  	// Name of the subnet group. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
   158  	Name pulumi.StringPtrInput
   159  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   160  	NamePrefix pulumi.StringPtrInput
   161  	// Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided.
   162  	//
   163  	// The following arguments are optional:
   164  	SubnetIds pulumi.StringArrayInput
   165  	// 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.
   166  	Tags pulumi.StringMapInput
   167  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   168  	//
   169  	// Deprecated: Please use `tags` instead.
   170  	TagsAll pulumi.StringMapInput
   171  	// The VPC in which the subnet group exists.
   172  	VpcId pulumi.StringPtrInput
   173  }
   174  
   175  func (SubnetGroupState) ElementType() reflect.Type {
   176  	return reflect.TypeOf((*subnetGroupState)(nil)).Elem()
   177  }
   178  
   179  type subnetGroupArgs struct {
   180  	// Description for the subnet group.
   181  	Description *string `pulumi:"description"`
   182  	// Name of the subnet group. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
   183  	Name *string `pulumi:"name"`
   184  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   185  	NamePrefix *string `pulumi:"namePrefix"`
   186  	// Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided.
   187  	//
   188  	// The following arguments are optional:
   189  	SubnetIds []string `pulumi:"subnetIds"`
   190  	// 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.
   191  	Tags map[string]string `pulumi:"tags"`
   192  }
   193  
   194  // The set of arguments for constructing a SubnetGroup resource.
   195  type SubnetGroupArgs struct {
   196  	// Description for the subnet group.
   197  	Description pulumi.StringPtrInput
   198  	// Name of the subnet group. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
   199  	Name pulumi.StringPtrInput
   200  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   201  	NamePrefix pulumi.StringPtrInput
   202  	// Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided.
   203  	//
   204  	// The following arguments are optional:
   205  	SubnetIds pulumi.StringArrayInput
   206  	// 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.
   207  	Tags pulumi.StringMapInput
   208  }
   209  
   210  func (SubnetGroupArgs) ElementType() reflect.Type {
   211  	return reflect.TypeOf((*subnetGroupArgs)(nil)).Elem()
   212  }
   213  
   214  type SubnetGroupInput interface {
   215  	pulumi.Input
   216  
   217  	ToSubnetGroupOutput() SubnetGroupOutput
   218  	ToSubnetGroupOutputWithContext(ctx context.Context) SubnetGroupOutput
   219  }
   220  
   221  func (*SubnetGroup) ElementType() reflect.Type {
   222  	return reflect.TypeOf((**SubnetGroup)(nil)).Elem()
   223  }
   224  
   225  func (i *SubnetGroup) ToSubnetGroupOutput() SubnetGroupOutput {
   226  	return i.ToSubnetGroupOutputWithContext(context.Background())
   227  }
   228  
   229  func (i *SubnetGroup) ToSubnetGroupOutputWithContext(ctx context.Context) SubnetGroupOutput {
   230  	return pulumi.ToOutputWithContext(ctx, i).(SubnetGroupOutput)
   231  }
   232  
   233  // SubnetGroupArrayInput is an input type that accepts SubnetGroupArray and SubnetGroupArrayOutput values.
   234  // You can construct a concrete instance of `SubnetGroupArrayInput` via:
   235  //
   236  //	SubnetGroupArray{ SubnetGroupArgs{...} }
   237  type SubnetGroupArrayInput interface {
   238  	pulumi.Input
   239  
   240  	ToSubnetGroupArrayOutput() SubnetGroupArrayOutput
   241  	ToSubnetGroupArrayOutputWithContext(context.Context) SubnetGroupArrayOutput
   242  }
   243  
   244  type SubnetGroupArray []SubnetGroupInput
   245  
   246  func (SubnetGroupArray) ElementType() reflect.Type {
   247  	return reflect.TypeOf((*[]*SubnetGroup)(nil)).Elem()
   248  }
   249  
   250  func (i SubnetGroupArray) ToSubnetGroupArrayOutput() SubnetGroupArrayOutput {
   251  	return i.ToSubnetGroupArrayOutputWithContext(context.Background())
   252  }
   253  
   254  func (i SubnetGroupArray) ToSubnetGroupArrayOutputWithContext(ctx context.Context) SubnetGroupArrayOutput {
   255  	return pulumi.ToOutputWithContext(ctx, i).(SubnetGroupArrayOutput)
   256  }
   257  
   258  // SubnetGroupMapInput is an input type that accepts SubnetGroupMap and SubnetGroupMapOutput values.
   259  // You can construct a concrete instance of `SubnetGroupMapInput` via:
   260  //
   261  //	SubnetGroupMap{ "key": SubnetGroupArgs{...} }
   262  type SubnetGroupMapInput interface {
   263  	pulumi.Input
   264  
   265  	ToSubnetGroupMapOutput() SubnetGroupMapOutput
   266  	ToSubnetGroupMapOutputWithContext(context.Context) SubnetGroupMapOutput
   267  }
   268  
   269  type SubnetGroupMap map[string]SubnetGroupInput
   270  
   271  func (SubnetGroupMap) ElementType() reflect.Type {
   272  	return reflect.TypeOf((*map[string]*SubnetGroup)(nil)).Elem()
   273  }
   274  
   275  func (i SubnetGroupMap) ToSubnetGroupMapOutput() SubnetGroupMapOutput {
   276  	return i.ToSubnetGroupMapOutputWithContext(context.Background())
   277  }
   278  
   279  func (i SubnetGroupMap) ToSubnetGroupMapOutputWithContext(ctx context.Context) SubnetGroupMapOutput {
   280  	return pulumi.ToOutputWithContext(ctx, i).(SubnetGroupMapOutput)
   281  }
   282  
   283  type SubnetGroupOutput struct{ *pulumi.OutputState }
   284  
   285  func (SubnetGroupOutput) ElementType() reflect.Type {
   286  	return reflect.TypeOf((**SubnetGroup)(nil)).Elem()
   287  }
   288  
   289  func (o SubnetGroupOutput) ToSubnetGroupOutput() SubnetGroupOutput {
   290  	return o
   291  }
   292  
   293  func (o SubnetGroupOutput) ToSubnetGroupOutputWithContext(ctx context.Context) SubnetGroupOutput {
   294  	return o
   295  }
   296  
   297  // The ARN of the subnet group.
   298  func (o SubnetGroupOutput) Arn() pulumi.StringOutput {
   299  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   300  }
   301  
   302  // Description for the subnet group.
   303  func (o SubnetGroupOutput) Description() pulumi.StringPtrOutput {
   304  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
   305  }
   306  
   307  // Name of the subnet group. If omitted, the provider will assign a random, unique name. Conflicts with `namePrefix`.
   308  func (o SubnetGroupOutput) Name() pulumi.StringOutput {
   309  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   310  }
   311  
   312  // Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   313  func (o SubnetGroupOutput) NamePrefix() pulumi.StringOutput {
   314  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput)
   315  }
   316  
   317  // Set of VPC Subnet ID-s for the subnet group. At least one subnet must be provided.
   318  //
   319  // The following arguments are optional:
   320  func (o SubnetGroupOutput) SubnetIds() pulumi.StringArrayOutput {
   321  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringArrayOutput { return v.SubnetIds }).(pulumi.StringArrayOutput)
   322  }
   323  
   324  // 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.
   325  func (o SubnetGroupOutput) Tags() pulumi.StringMapOutput {
   326  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   327  }
   328  
   329  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   330  //
   331  // Deprecated: Please use `tags` instead.
   332  func (o SubnetGroupOutput) TagsAll() pulumi.StringMapOutput {
   333  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   334  }
   335  
   336  // The VPC in which the subnet group exists.
   337  func (o SubnetGroupOutput) VpcId() pulumi.StringOutput {
   338  	return o.ApplyT(func(v *SubnetGroup) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   339  }
   340  
   341  type SubnetGroupArrayOutput struct{ *pulumi.OutputState }
   342  
   343  func (SubnetGroupArrayOutput) ElementType() reflect.Type {
   344  	return reflect.TypeOf((*[]*SubnetGroup)(nil)).Elem()
   345  }
   346  
   347  func (o SubnetGroupArrayOutput) ToSubnetGroupArrayOutput() SubnetGroupArrayOutput {
   348  	return o
   349  }
   350  
   351  func (o SubnetGroupArrayOutput) ToSubnetGroupArrayOutputWithContext(ctx context.Context) SubnetGroupArrayOutput {
   352  	return o
   353  }
   354  
   355  func (o SubnetGroupArrayOutput) Index(i pulumi.IntInput) SubnetGroupOutput {
   356  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SubnetGroup {
   357  		return vs[0].([]*SubnetGroup)[vs[1].(int)]
   358  	}).(SubnetGroupOutput)
   359  }
   360  
   361  type SubnetGroupMapOutput struct{ *pulumi.OutputState }
   362  
   363  func (SubnetGroupMapOutput) ElementType() reflect.Type {
   364  	return reflect.TypeOf((*map[string]*SubnetGroup)(nil)).Elem()
   365  }
   366  
   367  func (o SubnetGroupMapOutput) ToSubnetGroupMapOutput() SubnetGroupMapOutput {
   368  	return o
   369  }
   370  
   371  func (o SubnetGroupMapOutput) ToSubnetGroupMapOutputWithContext(ctx context.Context) SubnetGroupMapOutput {
   372  	return o
   373  }
   374  
   375  func (o SubnetGroupMapOutput) MapIndex(k pulumi.StringInput) SubnetGroupOutput {
   376  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SubnetGroup {
   377  		return vs[0].(map[string]*SubnetGroup)[vs[1].(string)]
   378  	}).(SubnetGroupOutput)
   379  }
   380  
   381  func init() {
   382  	pulumi.RegisterInputType(reflect.TypeOf((*SubnetGroupInput)(nil)).Elem(), &SubnetGroup{})
   383  	pulumi.RegisterInputType(reflect.TypeOf((*SubnetGroupArrayInput)(nil)).Elem(), SubnetGroupArray{})
   384  	pulumi.RegisterInputType(reflect.TypeOf((*SubnetGroupMapInput)(nil)).Elem(), SubnetGroupMap{})
   385  	pulumi.RegisterOutputType(SubnetGroupOutput{})
   386  	pulumi.RegisterOutputType(SubnetGroupArrayOutput{})
   387  	pulumi.RegisterOutputType(SubnetGroupMapOutput{})
   388  }