/
shardingInstance.go
710 lines (638 loc) · 40.6 KB
/
shardingInstance.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package mongodb
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a MongoDB Sharding Instance resource supports replica set instances only. the MongoDB provides stable, reliable, and automatic scalable database services.
// It offers a full range of database solutions, such as disaster recovery, backup, recovery, monitoring, and alarms.
// You can see detail product introduction [here](https://www.alibabacloud.com/help/doc-detail/26558.htm)
//
// > **NOTE:** Available since v1.40.0.
//
// > **NOTE:** The following regions don't support create Classic network MongoDB Sharding Instance.
// [`cn-zhangjiakou`,`cn-huhehaote`,`ap-southeast-3`,`ap-southeast-5`,`me-east-1`,`ap-northeast-1`,`eu-west-1`]
//
// > **NOTE:** Create MongoDB Sharding instance or change instance type and storage would cost 10~20 minutes. Please make full preparation.
//
// ## Example Usage
//
// ### Create a Mongodb Sharding instance
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/mongodb"
// "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// name := "terraform-example"
// if param := cfg.Get("name"); param != "" {
// name = param
// }
// _default, err := mongodb.GetZones(ctx, nil, nil)
// if err != nil {
// return err
// }
// index := len(_default.Zones) - 1
// zoneId := _default.Zones[index].Id
// defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
// VpcName: pulumi.String(name),
// CidrBlock: pulumi.String("172.17.3.0/24"),
// })
// if err != nil {
// return err
// }
// defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
// VswitchName: pulumi.String(name),
// CidrBlock: pulumi.String("172.17.3.0/24"),
// VpcId: defaultNetwork.ID(),
// ZoneId: pulumi.String(zoneId),
// })
// if err != nil {
// return err
// }
// _, err = mongodb.NewShardingInstance(ctx, "default", &mongodb.ShardingInstanceArgs{
// EngineVersion: pulumi.String("4.2"),
// VswitchId: defaultSwitch.ID(),
// ZoneId: pulumi.String(zoneId),
// Name: pulumi.String(name),
// MongoLists: mongodb.ShardingInstanceMongoListArray{
// &mongodb.ShardingInstanceMongoListArgs{
// NodeClass: pulumi.String("dds.mongos.mid"),
// },
// &mongodb.ShardingInstanceMongoListArgs{
// NodeClass: pulumi.String("dds.mongos.mid"),
// },
// },
// ShardLists: mongodb.ShardingInstanceShardListArray{
// &mongodb.ShardingInstanceShardListArgs{
// NodeClass: pulumi.String("dds.shard.mid"),
// NodeStorage: pulumi.Int(10),
// },
// &mongodb.ShardingInstanceShardListArgs{
// NodeClass: pulumi.String("dds.shard.standard"),
// NodeStorage: pulumi.Int(20),
// ReadonlyReplicas: pulumi.Int(1),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Module Support
//
// You can use to the existing mongodb-sharding module
// to create a MongoDB Sharding Instance resource one-click.
//
// ## Import
//
// MongoDB Sharding Instance can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:mongodb/shardingInstance:ShardingInstance example dds-bp1291daeda44195
// ```
type ShardingInstance struct {
pulumi.CustomResourceState
// Password of the root account. It is a string of 6 to 32 characters and is composed of letters, numbers, and underlines.
AccountPassword pulumi.StringPtrOutput `pulumi:"accountPassword"`
// Auto renew for prepaid. Default value: `false`. Valid values: `true`, `false`.
AutoRenew pulumi.BoolPtrOutput `pulumi:"autoRenew"`
// MongoDB Instance backup period. It is required when `backupTime` was existed. Valid values: [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]. Default to [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
BackupPeriods pulumi.StringArrayOutput `pulumi:"backupPeriods"`
// Sharding Instance backup time. It is required when `backupPeriod` was existed. In the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. If not set, the system will return a default, like "23:00Z-24:00Z".
BackupTime pulumi.StringOutput `pulumi:"backupTime"`
// The ConfigServer nodes of the instance. See `configServerList` below.
ConfigServerLists ShardingInstanceConfigServerListArrayOutput `pulumi:"configServerLists"`
// Database version. Value options can refer to the latest docs [CreateDBInstance](https://www.alibabacloud.com/help/en/doc-detail/61884.htm) `EngineVersion`.
EngineVersion pulumi.StringOutput `pulumi:"engineVersion"`
// The billing method of the instance. Default value: `PostPaid`. Valid values: `PrePaid`, `PostPaid`. **NOTE:** It can be modified from `PostPaid` to `PrePaid` after version v1.141.0.
InstanceChargeType pulumi.StringOutput `pulumi:"instanceChargeType"`
// An KMS encrypts password used to a instance. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword pulumi.StringPtrOutput `pulumi:"kmsEncryptedPassword"`
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating instance with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext pulumi.MapOutput `pulumi:"kmsEncryptionContext"`
// The Mongo nodes of the instance. The mongo-node count can be purchased is in range of [2, 32]. See `mongoList` below.
MongoLists ShardingInstanceMongoListArrayOutput `pulumi:"mongoLists"`
// The name of DB instance. It must be 2 to 256 characters in length.
Name pulumi.StringOutput `pulumi:"name"`
// The network type of the instance. Valid values:`Classic` or `VPC`.
NetworkType pulumi.StringOutput `pulumi:"networkType"`
// The type of configuration changes performed. Default value: `DOWNGRADE`. Valid values:
OrderType pulumi.StringPtrOutput `pulumi:"orderType"`
// The duration that you will buy DB instance (in month). It is valid when `instanceChargeType` is `PrePaid`. Default value: `1`. Valid values: [1~9], 12, 24, 36.
Period pulumi.IntOutput `pulumi:"period"`
// The type of the access protocol. Valid values: `mongodb` or `dynamodb`.
ProtocolType pulumi.StringOutput `pulumi:"protocolType"`
// The ID of the Resource Group.
ResourceGroupId pulumi.StringOutput `pulumi:"resourceGroupId"`
// (Available since v1.42.0) Instance data backup retention days.
RetentionPeriod pulumi.IntOutput `pulumi:"retentionPeriod"`
// The Security Group ID of ECS.
SecurityGroupId pulumi.StringOutput `pulumi:"securityGroupId"`
// List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). System default to `["127.0.0.1"]`.
SecurityIpLists pulumi.StringArrayOutput `pulumi:"securityIpLists"`
// The Shard nodes of the instance. The shard-node count can be purchased is in range of [2, 32]. See `shardList` below.
ShardLists ShardingInstanceShardListArrayOutput `pulumi:"shardLists"`
// The storage engine of the instance. Default value: `WiredTiger`. Valid values: `WiredTiger`, `RocksDB`.
StorageEngine pulumi.StringOutput `pulumi:"storageEngine"`
// A mapping of tags to assign to the resource.
Tags pulumi.MapOutput `pulumi:"tags"`
// The TDE(Transparent Data Encryption) status. It can be updated from version 1.160.0.
TdeStatus pulumi.StringOutput `pulumi:"tdeStatus"`
// The ID of the VPC. > **NOTE:** `vpcId` is valid only when `networkType` is set to `VPC`.
VpcId pulumi.StringOutput `pulumi:"vpcId"`
// The virtual switch ID to launch DB instances in one VPC.
VswitchId pulumi.StringOutput `pulumi:"vswitchId"`
// The Zone to launch the DB instance. MongoDB Sharding Instance does not support multiple-zone.
// If it is a multi-zone and `vswitchId` is specified, the vswitch must in one of them.
ZoneId pulumi.StringOutput `pulumi:"zoneId"`
}
// NewShardingInstance registers a new resource with the given unique name, arguments, and options.
func NewShardingInstance(ctx *pulumi.Context,
name string, args *ShardingInstanceArgs, opts ...pulumi.ResourceOption) (*ShardingInstance, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.EngineVersion == nil {
return nil, errors.New("invalid value for required argument 'EngineVersion'")
}
if args.MongoLists == nil {
return nil, errors.New("invalid value for required argument 'MongoLists'")
}
if args.ShardLists == nil {
return nil, errors.New("invalid value for required argument 'ShardLists'")
}
if args.AccountPassword != nil {
args.AccountPassword = pulumi.ToSecret(args.AccountPassword).(pulumi.StringPtrInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"accountPassword",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource ShardingInstance
err := ctx.RegisterResource("alicloud:mongodb/shardingInstance:ShardingInstance", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetShardingInstance gets an existing ShardingInstance resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetShardingInstance(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ShardingInstanceState, opts ...pulumi.ResourceOption) (*ShardingInstance, error) {
var resource ShardingInstance
err := ctx.ReadResource("alicloud:mongodb/shardingInstance:ShardingInstance", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ShardingInstance resources.
type shardingInstanceState struct {
// Password of the root account. It is a string of 6 to 32 characters and is composed of letters, numbers, and underlines.
AccountPassword *string `pulumi:"accountPassword"`
// Auto renew for prepaid. Default value: `false`. Valid values: `true`, `false`.
AutoRenew *bool `pulumi:"autoRenew"`
// MongoDB Instance backup period. It is required when `backupTime` was existed. Valid values: [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]. Default to [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
BackupPeriods []string `pulumi:"backupPeriods"`
// Sharding Instance backup time. It is required when `backupPeriod` was existed. In the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. If not set, the system will return a default, like "23:00Z-24:00Z".
BackupTime *string `pulumi:"backupTime"`
// The ConfigServer nodes of the instance. See `configServerList` below.
ConfigServerLists []ShardingInstanceConfigServerList `pulumi:"configServerLists"`
// Database version. Value options can refer to the latest docs [CreateDBInstance](https://www.alibabacloud.com/help/en/doc-detail/61884.htm) `EngineVersion`.
EngineVersion *string `pulumi:"engineVersion"`
// The billing method of the instance. Default value: `PostPaid`. Valid values: `PrePaid`, `PostPaid`. **NOTE:** It can be modified from `PostPaid` to `PrePaid` after version v1.141.0.
InstanceChargeType *string `pulumi:"instanceChargeType"`
// An KMS encrypts password used to a instance. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword *string `pulumi:"kmsEncryptedPassword"`
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating instance with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext map[string]interface{} `pulumi:"kmsEncryptionContext"`
// The Mongo nodes of the instance. The mongo-node count can be purchased is in range of [2, 32]. See `mongoList` below.
MongoLists []ShardingInstanceMongoList `pulumi:"mongoLists"`
// The name of DB instance. It must be 2 to 256 characters in length.
Name *string `pulumi:"name"`
// The network type of the instance. Valid values:`Classic` or `VPC`.
NetworkType *string `pulumi:"networkType"`
// The type of configuration changes performed. Default value: `DOWNGRADE`. Valid values:
OrderType *string `pulumi:"orderType"`
// The duration that you will buy DB instance (in month). It is valid when `instanceChargeType` is `PrePaid`. Default value: `1`. Valid values: [1~9], 12, 24, 36.
Period *int `pulumi:"period"`
// The type of the access protocol. Valid values: `mongodb` or `dynamodb`.
ProtocolType *string `pulumi:"protocolType"`
// The ID of the Resource Group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// (Available since v1.42.0) Instance data backup retention days.
RetentionPeriod *int `pulumi:"retentionPeriod"`
// The Security Group ID of ECS.
SecurityGroupId *string `pulumi:"securityGroupId"`
// List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). System default to `["127.0.0.1"]`.
SecurityIpLists []string `pulumi:"securityIpLists"`
// The Shard nodes of the instance. The shard-node count can be purchased is in range of [2, 32]. See `shardList` below.
ShardLists []ShardingInstanceShardList `pulumi:"shardLists"`
// The storage engine of the instance. Default value: `WiredTiger`. Valid values: `WiredTiger`, `RocksDB`.
StorageEngine *string `pulumi:"storageEngine"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// The TDE(Transparent Data Encryption) status. It can be updated from version 1.160.0.
TdeStatus *string `pulumi:"tdeStatus"`
// The ID of the VPC. > **NOTE:** `vpcId` is valid only when `networkType` is set to `VPC`.
VpcId *string `pulumi:"vpcId"`
// The virtual switch ID to launch DB instances in one VPC.
VswitchId *string `pulumi:"vswitchId"`
// The Zone to launch the DB instance. MongoDB Sharding Instance does not support multiple-zone.
// If it is a multi-zone and `vswitchId` is specified, the vswitch must in one of them.
ZoneId *string `pulumi:"zoneId"`
}
type ShardingInstanceState struct {
// Password of the root account. It is a string of 6 to 32 characters and is composed of letters, numbers, and underlines.
AccountPassword pulumi.StringPtrInput
// Auto renew for prepaid. Default value: `false`. Valid values: `true`, `false`.
AutoRenew pulumi.BoolPtrInput
// MongoDB Instance backup period. It is required when `backupTime` was existed. Valid values: [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]. Default to [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
BackupPeriods pulumi.StringArrayInput
// Sharding Instance backup time. It is required when `backupPeriod` was existed. In the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. If not set, the system will return a default, like "23:00Z-24:00Z".
BackupTime pulumi.StringPtrInput
// The ConfigServer nodes of the instance. See `configServerList` below.
ConfigServerLists ShardingInstanceConfigServerListArrayInput
// Database version. Value options can refer to the latest docs [CreateDBInstance](https://www.alibabacloud.com/help/en/doc-detail/61884.htm) `EngineVersion`.
EngineVersion pulumi.StringPtrInput
// The billing method of the instance. Default value: `PostPaid`. Valid values: `PrePaid`, `PostPaid`. **NOTE:** It can be modified from `PostPaid` to `PrePaid` after version v1.141.0.
InstanceChargeType pulumi.StringPtrInput
// An KMS encrypts password used to a instance. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword pulumi.StringPtrInput
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating instance with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext pulumi.MapInput
// The Mongo nodes of the instance. The mongo-node count can be purchased is in range of [2, 32]. See `mongoList` below.
MongoLists ShardingInstanceMongoListArrayInput
// The name of DB instance. It must be 2 to 256 characters in length.
Name pulumi.StringPtrInput
// The network type of the instance. Valid values:`Classic` or `VPC`.
NetworkType pulumi.StringPtrInput
// The type of configuration changes performed. Default value: `DOWNGRADE`. Valid values:
OrderType pulumi.StringPtrInput
// The duration that you will buy DB instance (in month). It is valid when `instanceChargeType` is `PrePaid`. Default value: `1`. Valid values: [1~9], 12, 24, 36.
Period pulumi.IntPtrInput
// The type of the access protocol. Valid values: `mongodb` or `dynamodb`.
ProtocolType pulumi.StringPtrInput
// The ID of the Resource Group.
ResourceGroupId pulumi.StringPtrInput
// (Available since v1.42.0) Instance data backup retention days.
RetentionPeriod pulumi.IntPtrInput
// The Security Group ID of ECS.
SecurityGroupId pulumi.StringPtrInput
// List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). System default to `["127.0.0.1"]`.
SecurityIpLists pulumi.StringArrayInput
// The Shard nodes of the instance. The shard-node count can be purchased is in range of [2, 32]. See `shardList` below.
ShardLists ShardingInstanceShardListArrayInput
// The storage engine of the instance. Default value: `WiredTiger`. Valid values: `WiredTiger`, `RocksDB`.
StorageEngine pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// The TDE(Transparent Data Encryption) status. It can be updated from version 1.160.0.
TdeStatus pulumi.StringPtrInput
// The ID of the VPC. > **NOTE:** `vpcId` is valid only when `networkType` is set to `VPC`.
VpcId pulumi.StringPtrInput
// The virtual switch ID to launch DB instances in one VPC.
VswitchId pulumi.StringPtrInput
// The Zone to launch the DB instance. MongoDB Sharding Instance does not support multiple-zone.
// If it is a multi-zone and `vswitchId` is specified, the vswitch must in one of them.
ZoneId pulumi.StringPtrInput
}
func (ShardingInstanceState) ElementType() reflect.Type {
return reflect.TypeOf((*shardingInstanceState)(nil)).Elem()
}
type shardingInstanceArgs struct {
// Password of the root account. It is a string of 6 to 32 characters and is composed of letters, numbers, and underlines.
AccountPassword *string `pulumi:"accountPassword"`
// Auto renew for prepaid. Default value: `false`. Valid values: `true`, `false`.
AutoRenew *bool `pulumi:"autoRenew"`
// MongoDB Instance backup period. It is required when `backupTime` was existed. Valid values: [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]. Default to [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
BackupPeriods []string `pulumi:"backupPeriods"`
// Sharding Instance backup time. It is required when `backupPeriod` was existed. In the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. If not set, the system will return a default, like "23:00Z-24:00Z".
BackupTime *string `pulumi:"backupTime"`
// The ConfigServer nodes of the instance. See `configServerList` below.
ConfigServerLists []ShardingInstanceConfigServerList `pulumi:"configServerLists"`
// Database version. Value options can refer to the latest docs [CreateDBInstance](https://www.alibabacloud.com/help/en/doc-detail/61884.htm) `EngineVersion`.
EngineVersion string `pulumi:"engineVersion"`
// The billing method of the instance. Default value: `PostPaid`. Valid values: `PrePaid`, `PostPaid`. **NOTE:** It can be modified from `PostPaid` to `PrePaid` after version v1.141.0.
InstanceChargeType *string `pulumi:"instanceChargeType"`
// An KMS encrypts password used to a instance. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword *string `pulumi:"kmsEncryptedPassword"`
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating instance with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext map[string]interface{} `pulumi:"kmsEncryptionContext"`
// The Mongo nodes of the instance. The mongo-node count can be purchased is in range of [2, 32]. See `mongoList` below.
MongoLists []ShardingInstanceMongoList `pulumi:"mongoLists"`
// The name of DB instance. It must be 2 to 256 characters in length.
Name *string `pulumi:"name"`
// The network type of the instance. Valid values:`Classic` or `VPC`.
NetworkType *string `pulumi:"networkType"`
// The type of configuration changes performed. Default value: `DOWNGRADE`. Valid values:
OrderType *string `pulumi:"orderType"`
// The duration that you will buy DB instance (in month). It is valid when `instanceChargeType` is `PrePaid`. Default value: `1`. Valid values: [1~9], 12, 24, 36.
Period *int `pulumi:"period"`
// The type of the access protocol. Valid values: `mongodb` or `dynamodb`.
ProtocolType *string `pulumi:"protocolType"`
// The ID of the Resource Group.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The Security Group ID of ECS.
SecurityGroupId *string `pulumi:"securityGroupId"`
// List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). System default to `["127.0.0.1"]`.
SecurityIpLists []string `pulumi:"securityIpLists"`
// The Shard nodes of the instance. The shard-node count can be purchased is in range of [2, 32]. See `shardList` below.
ShardLists []ShardingInstanceShardList `pulumi:"shardLists"`
// The storage engine of the instance. Default value: `WiredTiger`. Valid values: `WiredTiger`, `RocksDB`.
StorageEngine *string `pulumi:"storageEngine"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
// The TDE(Transparent Data Encryption) status. It can be updated from version 1.160.0.
TdeStatus *string `pulumi:"tdeStatus"`
// The ID of the VPC. > **NOTE:** `vpcId` is valid only when `networkType` is set to `VPC`.
VpcId *string `pulumi:"vpcId"`
// The virtual switch ID to launch DB instances in one VPC.
VswitchId *string `pulumi:"vswitchId"`
// The Zone to launch the DB instance. MongoDB Sharding Instance does not support multiple-zone.
// If it is a multi-zone and `vswitchId` is specified, the vswitch must in one of them.
ZoneId *string `pulumi:"zoneId"`
}
// The set of arguments for constructing a ShardingInstance resource.
type ShardingInstanceArgs struct {
// Password of the root account. It is a string of 6 to 32 characters and is composed of letters, numbers, and underlines.
AccountPassword pulumi.StringPtrInput
// Auto renew for prepaid. Default value: `false`. Valid values: `true`, `false`.
AutoRenew pulumi.BoolPtrInput
// MongoDB Instance backup period. It is required when `backupTime` was existed. Valid values: [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]. Default to [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
BackupPeriods pulumi.StringArrayInput
// Sharding Instance backup time. It is required when `backupPeriod` was existed. In the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. If not set, the system will return a default, like "23:00Z-24:00Z".
BackupTime pulumi.StringPtrInput
// The ConfigServer nodes of the instance. See `configServerList` below.
ConfigServerLists ShardingInstanceConfigServerListArrayInput
// Database version. Value options can refer to the latest docs [CreateDBInstance](https://www.alibabacloud.com/help/en/doc-detail/61884.htm) `EngineVersion`.
EngineVersion pulumi.StringInput
// The billing method of the instance. Default value: `PostPaid`. Valid values: `PrePaid`, `PostPaid`. **NOTE:** It can be modified from `PostPaid` to `PrePaid` after version v1.141.0.
InstanceChargeType pulumi.StringPtrInput
// An KMS encrypts password used to a instance. If the `accountPassword` is filled in, this field will be ignored.
KmsEncryptedPassword pulumi.StringPtrInput
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating instance with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
KmsEncryptionContext pulumi.MapInput
// The Mongo nodes of the instance. The mongo-node count can be purchased is in range of [2, 32]. See `mongoList` below.
MongoLists ShardingInstanceMongoListArrayInput
// The name of DB instance. It must be 2 to 256 characters in length.
Name pulumi.StringPtrInput
// The network type of the instance. Valid values:`Classic` or `VPC`.
NetworkType pulumi.StringPtrInput
// The type of configuration changes performed. Default value: `DOWNGRADE`. Valid values:
OrderType pulumi.StringPtrInput
// The duration that you will buy DB instance (in month). It is valid when `instanceChargeType` is `PrePaid`. Default value: `1`. Valid values: [1~9], 12, 24, 36.
Period pulumi.IntPtrInput
// The type of the access protocol. Valid values: `mongodb` or `dynamodb`.
ProtocolType pulumi.StringPtrInput
// The ID of the Resource Group.
ResourceGroupId pulumi.StringPtrInput
// The Security Group ID of ECS.
SecurityGroupId pulumi.StringPtrInput
// List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). System default to `["127.0.0.1"]`.
SecurityIpLists pulumi.StringArrayInput
// The Shard nodes of the instance. The shard-node count can be purchased is in range of [2, 32]. See `shardList` below.
ShardLists ShardingInstanceShardListArrayInput
// The storage engine of the instance. Default value: `WiredTiger`. Valid values: `WiredTiger`, `RocksDB`.
StorageEngine pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
// The TDE(Transparent Data Encryption) status. It can be updated from version 1.160.0.
TdeStatus pulumi.StringPtrInput
// The ID of the VPC. > **NOTE:** `vpcId` is valid only when `networkType` is set to `VPC`.
VpcId pulumi.StringPtrInput
// The virtual switch ID to launch DB instances in one VPC.
VswitchId pulumi.StringPtrInput
// The Zone to launch the DB instance. MongoDB Sharding Instance does not support multiple-zone.
// If it is a multi-zone and `vswitchId` is specified, the vswitch must in one of them.
ZoneId pulumi.StringPtrInput
}
func (ShardingInstanceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*shardingInstanceArgs)(nil)).Elem()
}
type ShardingInstanceInput interface {
pulumi.Input
ToShardingInstanceOutput() ShardingInstanceOutput
ToShardingInstanceOutputWithContext(ctx context.Context) ShardingInstanceOutput
}
func (*ShardingInstance) ElementType() reflect.Type {
return reflect.TypeOf((**ShardingInstance)(nil)).Elem()
}
func (i *ShardingInstance) ToShardingInstanceOutput() ShardingInstanceOutput {
return i.ToShardingInstanceOutputWithContext(context.Background())
}
func (i *ShardingInstance) ToShardingInstanceOutputWithContext(ctx context.Context) ShardingInstanceOutput {
return pulumi.ToOutputWithContext(ctx, i).(ShardingInstanceOutput)
}
// ShardingInstanceArrayInput is an input type that accepts ShardingInstanceArray and ShardingInstanceArrayOutput values.
// You can construct a concrete instance of `ShardingInstanceArrayInput` via:
//
// ShardingInstanceArray{ ShardingInstanceArgs{...} }
type ShardingInstanceArrayInput interface {
pulumi.Input
ToShardingInstanceArrayOutput() ShardingInstanceArrayOutput
ToShardingInstanceArrayOutputWithContext(context.Context) ShardingInstanceArrayOutput
}
type ShardingInstanceArray []ShardingInstanceInput
func (ShardingInstanceArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ShardingInstance)(nil)).Elem()
}
func (i ShardingInstanceArray) ToShardingInstanceArrayOutput() ShardingInstanceArrayOutput {
return i.ToShardingInstanceArrayOutputWithContext(context.Background())
}
func (i ShardingInstanceArray) ToShardingInstanceArrayOutputWithContext(ctx context.Context) ShardingInstanceArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ShardingInstanceArrayOutput)
}
// ShardingInstanceMapInput is an input type that accepts ShardingInstanceMap and ShardingInstanceMapOutput values.
// You can construct a concrete instance of `ShardingInstanceMapInput` via:
//
// ShardingInstanceMap{ "key": ShardingInstanceArgs{...} }
type ShardingInstanceMapInput interface {
pulumi.Input
ToShardingInstanceMapOutput() ShardingInstanceMapOutput
ToShardingInstanceMapOutputWithContext(context.Context) ShardingInstanceMapOutput
}
type ShardingInstanceMap map[string]ShardingInstanceInput
func (ShardingInstanceMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ShardingInstance)(nil)).Elem()
}
func (i ShardingInstanceMap) ToShardingInstanceMapOutput() ShardingInstanceMapOutput {
return i.ToShardingInstanceMapOutputWithContext(context.Background())
}
func (i ShardingInstanceMap) ToShardingInstanceMapOutputWithContext(ctx context.Context) ShardingInstanceMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ShardingInstanceMapOutput)
}
type ShardingInstanceOutput struct{ *pulumi.OutputState }
func (ShardingInstanceOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ShardingInstance)(nil)).Elem()
}
func (o ShardingInstanceOutput) ToShardingInstanceOutput() ShardingInstanceOutput {
return o
}
func (o ShardingInstanceOutput) ToShardingInstanceOutputWithContext(ctx context.Context) ShardingInstanceOutput {
return o
}
// Password of the root account. It is a string of 6 to 32 characters and is composed of letters, numbers, and underlines.
func (o ShardingInstanceOutput) AccountPassword() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringPtrOutput { return v.AccountPassword }).(pulumi.StringPtrOutput)
}
// Auto renew for prepaid. Default value: `false`. Valid values: `true`, `false`.
func (o ShardingInstanceOutput) AutoRenew() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.BoolPtrOutput { return v.AutoRenew }).(pulumi.BoolPtrOutput)
}
// MongoDB Instance backup period. It is required when `backupTime` was existed. Valid values: [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]. Default to [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday]
func (o ShardingInstanceOutput) BackupPeriods() pulumi.StringArrayOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringArrayOutput { return v.BackupPeriods }).(pulumi.StringArrayOutput)
}
// Sharding Instance backup time. It is required when `backupPeriod` was existed. In the format of HH:mmZ- HH:mmZ. Time setting interval is one hour. If not set, the system will return a default, like "23:00Z-24:00Z".
func (o ShardingInstanceOutput) BackupTime() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.BackupTime }).(pulumi.StringOutput)
}
// The ConfigServer nodes of the instance. See `configServerList` below.
func (o ShardingInstanceOutput) ConfigServerLists() ShardingInstanceConfigServerListArrayOutput {
return o.ApplyT(func(v *ShardingInstance) ShardingInstanceConfigServerListArrayOutput { return v.ConfigServerLists }).(ShardingInstanceConfigServerListArrayOutput)
}
// Database version. Value options can refer to the latest docs [CreateDBInstance](https://www.alibabacloud.com/help/en/doc-detail/61884.htm) `EngineVersion`.
func (o ShardingInstanceOutput) EngineVersion() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.EngineVersion }).(pulumi.StringOutput)
}
// The billing method of the instance. Default value: `PostPaid`. Valid values: `PrePaid`, `PostPaid`. **NOTE:** It can be modified from `PostPaid` to `PrePaid` after version v1.141.0.
func (o ShardingInstanceOutput) InstanceChargeType() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.InstanceChargeType }).(pulumi.StringOutput)
}
// An KMS encrypts password used to a instance. If the `accountPassword` is filled in, this field will be ignored.
func (o ShardingInstanceOutput) KmsEncryptedPassword() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringPtrOutput { return v.KmsEncryptedPassword }).(pulumi.StringPtrOutput)
}
// An KMS encryption context used to decrypt `kmsEncryptedPassword` before creating or updating instance with `kmsEncryptedPassword`. See [Encryption Context](https://www.alibabacloud.com/help/doc-detail/42975.htm). It is valid when `kmsEncryptedPassword` is set.
func (o ShardingInstanceOutput) KmsEncryptionContext() pulumi.MapOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.MapOutput { return v.KmsEncryptionContext }).(pulumi.MapOutput)
}
// The Mongo nodes of the instance. The mongo-node count can be purchased is in range of [2, 32]. See `mongoList` below.
func (o ShardingInstanceOutput) MongoLists() ShardingInstanceMongoListArrayOutput {
return o.ApplyT(func(v *ShardingInstance) ShardingInstanceMongoListArrayOutput { return v.MongoLists }).(ShardingInstanceMongoListArrayOutput)
}
// The name of DB instance. It must be 2 to 256 characters in length.
func (o ShardingInstanceOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The network type of the instance. Valid values:`Classic` or `VPC`.
func (o ShardingInstanceOutput) NetworkType() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.NetworkType }).(pulumi.StringOutput)
}
// The type of configuration changes performed. Default value: `DOWNGRADE`. Valid values:
func (o ShardingInstanceOutput) OrderType() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringPtrOutput { return v.OrderType }).(pulumi.StringPtrOutput)
}
// The duration that you will buy DB instance (in month). It is valid when `instanceChargeType` is `PrePaid`. Default value: `1`. Valid values: [1~9], 12, 24, 36.
func (o ShardingInstanceOutput) Period() pulumi.IntOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.IntOutput { return v.Period }).(pulumi.IntOutput)
}
// The type of the access protocol. Valid values: `mongodb` or `dynamodb`.
func (o ShardingInstanceOutput) ProtocolType() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.ProtocolType }).(pulumi.StringOutput)
}
// The ID of the Resource Group.
func (o ShardingInstanceOutput) ResourceGroupId() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.ResourceGroupId }).(pulumi.StringOutput)
}
// (Available since v1.42.0) Instance data backup retention days.
func (o ShardingInstanceOutput) RetentionPeriod() pulumi.IntOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.IntOutput { return v.RetentionPeriod }).(pulumi.IntOutput)
}
// The Security Group ID of ECS.
func (o ShardingInstanceOutput) SecurityGroupId() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.SecurityGroupId }).(pulumi.StringOutput)
}
// List of IP addresses allowed to access all databases of an instance. The list contains up to 1,000 IP addresses, separated by commas. Supported formats include 0.0.0.0/0, 10.23.12.24 (IP), and 10.23.12.24/24 (Classless Inter-Domain Routing (CIDR) mode. /24 represents the length of the prefix in an IP address. The range of the prefix length is [1,32]). System default to `["127.0.0.1"]`.
func (o ShardingInstanceOutput) SecurityIpLists() pulumi.StringArrayOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringArrayOutput { return v.SecurityIpLists }).(pulumi.StringArrayOutput)
}
// The Shard nodes of the instance. The shard-node count can be purchased is in range of [2, 32]. See `shardList` below.
func (o ShardingInstanceOutput) ShardLists() ShardingInstanceShardListArrayOutput {
return o.ApplyT(func(v *ShardingInstance) ShardingInstanceShardListArrayOutput { return v.ShardLists }).(ShardingInstanceShardListArrayOutput)
}
// The storage engine of the instance. Default value: `WiredTiger`. Valid values: `WiredTiger`, `RocksDB`.
func (o ShardingInstanceOutput) StorageEngine() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.StorageEngine }).(pulumi.StringOutput)
}
// A mapping of tags to assign to the resource.
func (o ShardingInstanceOutput) Tags() pulumi.MapOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.MapOutput { return v.Tags }).(pulumi.MapOutput)
}
// The TDE(Transparent Data Encryption) status. It can be updated from version 1.160.0.
func (o ShardingInstanceOutput) TdeStatus() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.TdeStatus }).(pulumi.StringOutput)
}
// The ID of the VPC. > **NOTE:** `vpcId` is valid only when `networkType` is set to `VPC`.
func (o ShardingInstanceOutput) VpcId() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
}
// The virtual switch ID to launch DB instances in one VPC.
func (o ShardingInstanceOutput) VswitchId() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.VswitchId }).(pulumi.StringOutput)
}
// The Zone to launch the DB instance. MongoDB Sharding Instance does not support multiple-zone.
// If it is a multi-zone and `vswitchId` is specified, the vswitch must in one of them.
func (o ShardingInstanceOutput) ZoneId() pulumi.StringOutput {
return o.ApplyT(func(v *ShardingInstance) pulumi.StringOutput { return v.ZoneId }).(pulumi.StringOutput)
}
type ShardingInstanceArrayOutput struct{ *pulumi.OutputState }
func (ShardingInstanceArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ShardingInstance)(nil)).Elem()
}
func (o ShardingInstanceArrayOutput) ToShardingInstanceArrayOutput() ShardingInstanceArrayOutput {
return o
}
func (o ShardingInstanceArrayOutput) ToShardingInstanceArrayOutputWithContext(ctx context.Context) ShardingInstanceArrayOutput {
return o
}
func (o ShardingInstanceArrayOutput) Index(i pulumi.IntInput) ShardingInstanceOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ShardingInstance {
return vs[0].([]*ShardingInstance)[vs[1].(int)]
}).(ShardingInstanceOutput)
}
type ShardingInstanceMapOutput struct{ *pulumi.OutputState }
func (ShardingInstanceMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ShardingInstance)(nil)).Elem()
}
func (o ShardingInstanceMapOutput) ToShardingInstanceMapOutput() ShardingInstanceMapOutput {
return o
}
func (o ShardingInstanceMapOutput) ToShardingInstanceMapOutputWithContext(ctx context.Context) ShardingInstanceMapOutput {
return o
}
func (o ShardingInstanceMapOutput) MapIndex(k pulumi.StringInput) ShardingInstanceOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ShardingInstance {
return vs[0].(map[string]*ShardingInstance)[vs[1].(string)]
}).(ShardingInstanceOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ShardingInstanceInput)(nil)).Elem(), &ShardingInstance{})
pulumi.RegisterInputType(reflect.TypeOf((*ShardingInstanceArrayInput)(nil)).Elem(), ShardingInstanceArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ShardingInstanceMapInput)(nil)).Elem(), ShardingInstanceMap{})
pulumi.RegisterOutputType(ShardingInstanceOutput{})
pulumi.RegisterOutputType(ShardingInstanceArrayOutput{})
pulumi.RegisterOutputType(ShardingInstanceMapOutput{})
}