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