github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/dms/replicationSubnetGroup.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 dms 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 DMS (Data Migration Service) replication subnet group resource. DMS replication subnet groups can be created, updated, deleted, and imported. 16 // 17 // > **Note:** AWS requires a special IAM role called `dms-vpc-role` when using this resource. See the example below to create it as part of your configuration. 18 // 19 // ## Example Usage 20 // 21 // ### Basic 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dms" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // // Create a new replication subnet group 37 // _, err := dms.NewReplicationSubnetGroup(ctx, "example", &dms.ReplicationSubnetGroupArgs{ 38 // ReplicationSubnetGroupDescription: pulumi.String("Example replication subnet group"), 39 // ReplicationSubnetGroupId: pulumi.String("example-dms-replication-subnet-group-tf"), 40 // SubnetIds: pulumi.StringArray{ 41 // pulumi.String("subnet-12345678"), 42 // pulumi.String("subnet-12345679"), 43 // }, 44 // Tags: pulumi.StringMap{ 45 // "Name": pulumi.String("example"), 46 // }, 47 // }) 48 // if err != nil { 49 // return err 50 // } 51 // return nil 52 // }) 53 // } 54 // 55 // ``` 56 // <!--End PulumiCodeChooser --> 57 // 58 // ### Creating special IAM role 59 // 60 // If your account does not already include the `dms-vpc-role` IAM role, you will need to create it to allow DMS to manage subnets in the VPC. 61 // 62 // <!--Start PulumiCodeChooser --> 63 // ```go 64 // package main 65 // 66 // import ( 67 // 68 // "encoding/json" 69 // 70 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dms" 71 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam" 72 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 73 // 74 // ) 75 // 76 // func main() { 77 // pulumi.Run(func(ctx *pulumi.Context) error { 78 // tmpJSON0, err := json.Marshal(map[string]interface{}{ 79 // "Version": "2012-10-17", 80 // "Statement": []map[string]interface{}{ 81 // map[string]interface{}{ 82 // "Effect": "Allow", 83 // "Principal": map[string]interface{}{ 84 // "Service": "dms.amazonaws.com", 85 // }, 86 // "Action": "sts:AssumeRole", 87 // }, 88 // }, 89 // }) 90 // if err != nil { 91 // return err 92 // } 93 // json0 := string(tmpJSON0) 94 // _, err = iam.NewRole(ctx, "dms-vpc-role", &iam.RoleArgs{ 95 // Name: pulumi.String("dms-vpc-role"), 96 // Description: pulumi.String("Allows DMS to manage VPC"), 97 // AssumeRolePolicy: pulumi.String(json0), 98 // }) 99 // if err != nil { 100 // return err 101 // } 102 // example, err := iam.NewRolePolicyAttachment(ctx, "example", &iam.RolePolicyAttachmentArgs{ 103 // Role: dms_vpc_role.Name, 104 // PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AmazonDMSVPCManagementRole"), 105 // }) 106 // if err != nil { 107 // return err 108 // } 109 // _, err = dms.NewReplicationSubnetGroup(ctx, "example", &dms.ReplicationSubnetGroupArgs{ 110 // ReplicationSubnetGroupDescription: pulumi.String("Example"), 111 // ReplicationSubnetGroupId: pulumi.String("example-id"), 112 // SubnetIds: pulumi.StringArray{ 113 // pulumi.String("subnet-12345678"), 114 // pulumi.String("subnet-12345679"), 115 // }, 116 // Tags: pulumi.StringMap{ 117 // "Name": pulumi.String("example-id"), 118 // }, 119 // }, pulumi.DependsOn([]pulumi.Resource{ 120 // example, 121 // })) 122 // if err != nil { 123 // return err 124 // } 125 // return nil 126 // }) 127 // } 128 // 129 // ``` 130 // <!--End PulumiCodeChooser --> 131 // 132 // ## Import 133 // 134 // Using `pulumi import`, import replication subnet groups using the `replication_subnet_group_id`. For example: 135 // 136 // ```sh 137 // $ pulumi import aws:dms/replicationSubnetGroup:ReplicationSubnetGroup test test-dms-replication-subnet-group-tf 138 // ``` 139 type ReplicationSubnetGroup struct { 140 pulumi.CustomResourceState 141 142 ReplicationSubnetGroupArn pulumi.StringOutput `pulumi:"replicationSubnetGroupArn"` 143 // Description for the subnet group. 144 ReplicationSubnetGroupDescription pulumi.StringOutput `pulumi:"replicationSubnetGroupDescription"` 145 // Name for the replication subnet group. This value is stored as a lowercase string. It must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens and cannot be `default`. 146 ReplicationSubnetGroupId pulumi.StringOutput `pulumi:"replicationSubnetGroupId"` 147 // List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones. 148 SubnetIds pulumi.StringArrayOutput `pulumi:"subnetIds"` 149 // 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. 150 Tags pulumi.StringMapOutput `pulumi:"tags"` 151 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 152 // 153 // Deprecated: Please use `tags` instead. 154 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 155 // The ID of the VPC the subnet group is in. 156 VpcId pulumi.StringOutput `pulumi:"vpcId"` 157 } 158 159 // NewReplicationSubnetGroup registers a new resource with the given unique name, arguments, and options. 160 func NewReplicationSubnetGroup(ctx *pulumi.Context, 161 name string, args *ReplicationSubnetGroupArgs, opts ...pulumi.ResourceOption) (*ReplicationSubnetGroup, error) { 162 if args == nil { 163 return nil, errors.New("missing one or more required arguments") 164 } 165 166 if args.ReplicationSubnetGroupDescription == nil { 167 return nil, errors.New("invalid value for required argument 'ReplicationSubnetGroupDescription'") 168 } 169 if args.ReplicationSubnetGroupId == nil { 170 return nil, errors.New("invalid value for required argument 'ReplicationSubnetGroupId'") 171 } 172 if args.SubnetIds == nil { 173 return nil, errors.New("invalid value for required argument 'SubnetIds'") 174 } 175 opts = internal.PkgResourceDefaultOpts(opts) 176 var resource ReplicationSubnetGroup 177 err := ctx.RegisterResource("aws:dms/replicationSubnetGroup:ReplicationSubnetGroup", name, args, &resource, opts...) 178 if err != nil { 179 return nil, err 180 } 181 return &resource, nil 182 } 183 184 // GetReplicationSubnetGroup gets an existing ReplicationSubnetGroup resource's state with the given name, ID, and optional 185 // state properties that are used to uniquely qualify the lookup (nil if not required). 186 func GetReplicationSubnetGroup(ctx *pulumi.Context, 187 name string, id pulumi.IDInput, state *ReplicationSubnetGroupState, opts ...pulumi.ResourceOption) (*ReplicationSubnetGroup, error) { 188 var resource ReplicationSubnetGroup 189 err := ctx.ReadResource("aws:dms/replicationSubnetGroup:ReplicationSubnetGroup", name, id, state, &resource, opts...) 190 if err != nil { 191 return nil, err 192 } 193 return &resource, nil 194 } 195 196 // Input properties used for looking up and filtering ReplicationSubnetGroup resources. 197 type replicationSubnetGroupState struct { 198 ReplicationSubnetGroupArn *string `pulumi:"replicationSubnetGroupArn"` 199 // Description for the subnet group. 200 ReplicationSubnetGroupDescription *string `pulumi:"replicationSubnetGroupDescription"` 201 // Name for the replication subnet group. This value is stored as a lowercase string. It must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens and cannot be `default`. 202 ReplicationSubnetGroupId *string `pulumi:"replicationSubnetGroupId"` 203 // List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones. 204 SubnetIds []string `pulumi:"subnetIds"` 205 // 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. 206 Tags map[string]string `pulumi:"tags"` 207 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 208 // 209 // Deprecated: Please use `tags` instead. 210 TagsAll map[string]string `pulumi:"tagsAll"` 211 // The ID of the VPC the subnet group is in. 212 VpcId *string `pulumi:"vpcId"` 213 } 214 215 type ReplicationSubnetGroupState struct { 216 ReplicationSubnetGroupArn pulumi.StringPtrInput 217 // Description for the subnet group. 218 ReplicationSubnetGroupDescription pulumi.StringPtrInput 219 // Name for the replication subnet group. This value is stored as a lowercase string. It must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens and cannot be `default`. 220 ReplicationSubnetGroupId pulumi.StringPtrInput 221 // List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones. 222 SubnetIds pulumi.StringArrayInput 223 // 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. 224 Tags pulumi.StringMapInput 225 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 226 // 227 // Deprecated: Please use `tags` instead. 228 TagsAll pulumi.StringMapInput 229 // The ID of the VPC the subnet group is in. 230 VpcId pulumi.StringPtrInput 231 } 232 233 func (ReplicationSubnetGroupState) ElementType() reflect.Type { 234 return reflect.TypeOf((*replicationSubnetGroupState)(nil)).Elem() 235 } 236 237 type replicationSubnetGroupArgs struct { 238 // Description for the subnet group. 239 ReplicationSubnetGroupDescription string `pulumi:"replicationSubnetGroupDescription"` 240 // Name for the replication subnet group. This value is stored as a lowercase string. It must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens and cannot be `default`. 241 ReplicationSubnetGroupId string `pulumi:"replicationSubnetGroupId"` 242 // List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones. 243 SubnetIds []string `pulumi:"subnetIds"` 244 // 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. 245 Tags map[string]string `pulumi:"tags"` 246 } 247 248 // The set of arguments for constructing a ReplicationSubnetGroup resource. 249 type ReplicationSubnetGroupArgs struct { 250 // Description for the subnet group. 251 ReplicationSubnetGroupDescription pulumi.StringInput 252 // Name for the replication subnet group. This value is stored as a lowercase string. It must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens and cannot be `default`. 253 ReplicationSubnetGroupId pulumi.StringInput 254 // List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones. 255 SubnetIds pulumi.StringArrayInput 256 // 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. 257 Tags pulumi.StringMapInput 258 } 259 260 func (ReplicationSubnetGroupArgs) ElementType() reflect.Type { 261 return reflect.TypeOf((*replicationSubnetGroupArgs)(nil)).Elem() 262 } 263 264 type ReplicationSubnetGroupInput interface { 265 pulumi.Input 266 267 ToReplicationSubnetGroupOutput() ReplicationSubnetGroupOutput 268 ToReplicationSubnetGroupOutputWithContext(ctx context.Context) ReplicationSubnetGroupOutput 269 } 270 271 func (*ReplicationSubnetGroup) ElementType() reflect.Type { 272 return reflect.TypeOf((**ReplicationSubnetGroup)(nil)).Elem() 273 } 274 275 func (i *ReplicationSubnetGroup) ToReplicationSubnetGroupOutput() ReplicationSubnetGroupOutput { 276 return i.ToReplicationSubnetGroupOutputWithContext(context.Background()) 277 } 278 279 func (i *ReplicationSubnetGroup) ToReplicationSubnetGroupOutputWithContext(ctx context.Context) ReplicationSubnetGroupOutput { 280 return pulumi.ToOutputWithContext(ctx, i).(ReplicationSubnetGroupOutput) 281 } 282 283 // ReplicationSubnetGroupArrayInput is an input type that accepts ReplicationSubnetGroupArray and ReplicationSubnetGroupArrayOutput values. 284 // You can construct a concrete instance of `ReplicationSubnetGroupArrayInput` via: 285 // 286 // ReplicationSubnetGroupArray{ ReplicationSubnetGroupArgs{...} } 287 type ReplicationSubnetGroupArrayInput interface { 288 pulumi.Input 289 290 ToReplicationSubnetGroupArrayOutput() ReplicationSubnetGroupArrayOutput 291 ToReplicationSubnetGroupArrayOutputWithContext(context.Context) ReplicationSubnetGroupArrayOutput 292 } 293 294 type ReplicationSubnetGroupArray []ReplicationSubnetGroupInput 295 296 func (ReplicationSubnetGroupArray) ElementType() reflect.Type { 297 return reflect.TypeOf((*[]*ReplicationSubnetGroup)(nil)).Elem() 298 } 299 300 func (i ReplicationSubnetGroupArray) ToReplicationSubnetGroupArrayOutput() ReplicationSubnetGroupArrayOutput { 301 return i.ToReplicationSubnetGroupArrayOutputWithContext(context.Background()) 302 } 303 304 func (i ReplicationSubnetGroupArray) ToReplicationSubnetGroupArrayOutputWithContext(ctx context.Context) ReplicationSubnetGroupArrayOutput { 305 return pulumi.ToOutputWithContext(ctx, i).(ReplicationSubnetGroupArrayOutput) 306 } 307 308 // ReplicationSubnetGroupMapInput is an input type that accepts ReplicationSubnetGroupMap and ReplicationSubnetGroupMapOutput values. 309 // You can construct a concrete instance of `ReplicationSubnetGroupMapInput` via: 310 // 311 // ReplicationSubnetGroupMap{ "key": ReplicationSubnetGroupArgs{...} } 312 type ReplicationSubnetGroupMapInput interface { 313 pulumi.Input 314 315 ToReplicationSubnetGroupMapOutput() ReplicationSubnetGroupMapOutput 316 ToReplicationSubnetGroupMapOutputWithContext(context.Context) ReplicationSubnetGroupMapOutput 317 } 318 319 type ReplicationSubnetGroupMap map[string]ReplicationSubnetGroupInput 320 321 func (ReplicationSubnetGroupMap) ElementType() reflect.Type { 322 return reflect.TypeOf((*map[string]*ReplicationSubnetGroup)(nil)).Elem() 323 } 324 325 func (i ReplicationSubnetGroupMap) ToReplicationSubnetGroupMapOutput() ReplicationSubnetGroupMapOutput { 326 return i.ToReplicationSubnetGroupMapOutputWithContext(context.Background()) 327 } 328 329 func (i ReplicationSubnetGroupMap) ToReplicationSubnetGroupMapOutputWithContext(ctx context.Context) ReplicationSubnetGroupMapOutput { 330 return pulumi.ToOutputWithContext(ctx, i).(ReplicationSubnetGroupMapOutput) 331 } 332 333 type ReplicationSubnetGroupOutput struct{ *pulumi.OutputState } 334 335 func (ReplicationSubnetGroupOutput) ElementType() reflect.Type { 336 return reflect.TypeOf((**ReplicationSubnetGroup)(nil)).Elem() 337 } 338 339 func (o ReplicationSubnetGroupOutput) ToReplicationSubnetGroupOutput() ReplicationSubnetGroupOutput { 340 return o 341 } 342 343 func (o ReplicationSubnetGroupOutput) ToReplicationSubnetGroupOutputWithContext(ctx context.Context) ReplicationSubnetGroupOutput { 344 return o 345 } 346 347 func (o ReplicationSubnetGroupOutput) ReplicationSubnetGroupArn() pulumi.StringOutput { 348 return o.ApplyT(func(v *ReplicationSubnetGroup) pulumi.StringOutput { return v.ReplicationSubnetGroupArn }).(pulumi.StringOutput) 349 } 350 351 // Description for the subnet group. 352 func (o ReplicationSubnetGroupOutput) ReplicationSubnetGroupDescription() pulumi.StringOutput { 353 return o.ApplyT(func(v *ReplicationSubnetGroup) pulumi.StringOutput { return v.ReplicationSubnetGroupDescription }).(pulumi.StringOutput) 354 } 355 356 // Name for the replication subnet group. This value is stored as a lowercase string. It must contain no more than 255 alphanumeric characters, periods, spaces, underscores, or hyphens and cannot be `default`. 357 func (o ReplicationSubnetGroupOutput) ReplicationSubnetGroupId() pulumi.StringOutput { 358 return o.ApplyT(func(v *ReplicationSubnetGroup) pulumi.StringOutput { return v.ReplicationSubnetGroupId }).(pulumi.StringOutput) 359 } 360 361 // List of at least 2 EC2 subnet IDs for the subnet group. The subnets must cover at least 2 availability zones. 362 func (o ReplicationSubnetGroupOutput) SubnetIds() pulumi.StringArrayOutput { 363 return o.ApplyT(func(v *ReplicationSubnetGroup) pulumi.StringArrayOutput { return v.SubnetIds }).(pulumi.StringArrayOutput) 364 } 365 366 // 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. 367 func (o ReplicationSubnetGroupOutput) Tags() pulumi.StringMapOutput { 368 return o.ApplyT(func(v *ReplicationSubnetGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 369 } 370 371 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 372 // 373 // Deprecated: Please use `tags` instead. 374 func (o ReplicationSubnetGroupOutput) TagsAll() pulumi.StringMapOutput { 375 return o.ApplyT(func(v *ReplicationSubnetGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 376 } 377 378 // The ID of the VPC the subnet group is in. 379 func (o ReplicationSubnetGroupOutput) VpcId() pulumi.StringOutput { 380 return o.ApplyT(func(v *ReplicationSubnetGroup) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput) 381 } 382 383 type ReplicationSubnetGroupArrayOutput struct{ *pulumi.OutputState } 384 385 func (ReplicationSubnetGroupArrayOutput) ElementType() reflect.Type { 386 return reflect.TypeOf((*[]*ReplicationSubnetGroup)(nil)).Elem() 387 } 388 389 func (o ReplicationSubnetGroupArrayOutput) ToReplicationSubnetGroupArrayOutput() ReplicationSubnetGroupArrayOutput { 390 return o 391 } 392 393 func (o ReplicationSubnetGroupArrayOutput) ToReplicationSubnetGroupArrayOutputWithContext(ctx context.Context) ReplicationSubnetGroupArrayOutput { 394 return o 395 } 396 397 func (o ReplicationSubnetGroupArrayOutput) Index(i pulumi.IntInput) ReplicationSubnetGroupOutput { 398 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ReplicationSubnetGroup { 399 return vs[0].([]*ReplicationSubnetGroup)[vs[1].(int)] 400 }).(ReplicationSubnetGroupOutput) 401 } 402 403 type ReplicationSubnetGroupMapOutput struct{ *pulumi.OutputState } 404 405 func (ReplicationSubnetGroupMapOutput) ElementType() reflect.Type { 406 return reflect.TypeOf((*map[string]*ReplicationSubnetGroup)(nil)).Elem() 407 } 408 409 func (o ReplicationSubnetGroupMapOutput) ToReplicationSubnetGroupMapOutput() ReplicationSubnetGroupMapOutput { 410 return o 411 } 412 413 func (o ReplicationSubnetGroupMapOutput) ToReplicationSubnetGroupMapOutputWithContext(ctx context.Context) ReplicationSubnetGroupMapOutput { 414 return o 415 } 416 417 func (o ReplicationSubnetGroupMapOutput) MapIndex(k pulumi.StringInput) ReplicationSubnetGroupOutput { 418 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ReplicationSubnetGroup { 419 return vs[0].(map[string]*ReplicationSubnetGroup)[vs[1].(string)] 420 }).(ReplicationSubnetGroupOutput) 421 } 422 423 func init() { 424 pulumi.RegisterInputType(reflect.TypeOf((*ReplicationSubnetGroupInput)(nil)).Elem(), &ReplicationSubnetGroup{}) 425 pulumi.RegisterInputType(reflect.TypeOf((*ReplicationSubnetGroupArrayInput)(nil)).Elem(), ReplicationSubnetGroupArray{}) 426 pulumi.RegisterInputType(reflect.TypeOf((*ReplicationSubnetGroupMapInput)(nil)).Elem(), ReplicationSubnetGroupMap{}) 427 pulumi.RegisterOutputType(ReplicationSubnetGroupOutput{}) 428 pulumi.RegisterOutputType(ReplicationSubnetGroupArrayOutput{}) 429 pulumi.RegisterOutputType(ReplicationSubnetGroupMapOutput{}) 430 }