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