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