/
table.go
832 lines (760 loc) · 39.6 KB
/
table.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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
// 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 dynamodb
import (
"context"
"reflect"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a DynamoDB table resource.
//
// > **Note:** It is recommended to use [`ignoreChanges`](https://www.pulumi.com/docs/intro/concepts/programming-model/#ignorechanges) for `readCapacity` and/or `writeCapacity` if there's `autoscaling policy` attached to the table.
//
// > **Note:** When using dynamodb.TableReplica with this resource, use `lifecycle` `ignoreChanges` for `replica`, _e.g._, `lifecycle { ignoreChanges = [replica] }`.
//
// ## DynamoDB Table attributes
//
// Only define attributes on the table object that are going to be used as:
//
// * Table hash key or range key
// * LSI or GSI hash key or range key
//
// The DynamoDB API expects attribute structure (name and type) to be passed along when creating or updating GSI/LSIs or creating the initial table. In these cases it expects the Hash / Range keys to be provided. Because these get re-used in numerous places (i.e the table's range key could be a part of one or more GSIs), they are stored on the table object to prevent duplication and increase consistency. If you add attributes here that are not used in these scenarios it can cause an infinite loop in planning.
//
// ## Example Usage
//
// ### Basic Example
//
// The following dynamodb table description models the table and GSI shown in the [AWS SDK example documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html)
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := dynamodb.NewTable(ctx, "basic-dynamodb-table", &dynamodb.TableArgs{
// Name: pulumi.String("GameScores"),
// BillingMode: pulumi.String("PROVISIONED"),
// ReadCapacity: pulumi.Int(20),
// WriteCapacity: pulumi.Int(20),
// HashKey: pulumi.String("UserId"),
// RangeKey: pulumi.String("GameTitle"),
// Attributes: dynamodb.TableAttributeArray{
// &dynamodb.TableAttributeArgs{
// Name: pulumi.String("UserId"),
// Type: pulumi.String("S"),
// },
// &dynamodb.TableAttributeArgs{
// Name: pulumi.String("GameTitle"),
// Type: pulumi.String("S"),
// },
// &dynamodb.TableAttributeArgs{
// Name: pulumi.String("TopScore"),
// Type: pulumi.String("N"),
// },
// },
// Ttl: &dynamodb.TableTtlArgs{
// AttributeName: pulumi.String("TimeToExist"),
// Enabled: pulumi.Bool(false),
// },
// GlobalSecondaryIndexes: dynamodb.TableGlobalSecondaryIndexArray{
// &dynamodb.TableGlobalSecondaryIndexArgs{
// Name: pulumi.String("GameTitleIndex"),
// HashKey: pulumi.String("GameTitle"),
// RangeKey: pulumi.String("TopScore"),
// WriteCapacity: pulumi.Int(10),
// ReadCapacity: pulumi.Int(10),
// ProjectionType: pulumi.String("INCLUDE"),
// NonKeyAttributes: pulumi.StringArray{
// pulumi.String("UserId"),
// },
// },
// },
// Tags: pulumi.StringMap{
// "Name": pulumi.String("dynamodb-table-1"),
// "Environment": pulumi.String("production"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ### Global Tables
//
// This resource implements support for [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) via `replica` configuration blocks. For working with [DynamoDB Global Tables V1 (version 2017.11.29)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V1.html), see the `dynamodb.GlobalTable` resource.
//
// > **Note:** dynamodb.TableReplica is an alternate way of configuring Global Tables. Do not use `replica` configuration blocks of `dynamodb.Table` together with aws_dynamodb_table_replica.
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{
// Name: pulumi.String("example"),
// HashKey: pulumi.String("TestTableHashKey"),
// BillingMode: pulumi.String("PAY_PER_REQUEST"),
// StreamEnabled: pulumi.Bool(true),
// StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"),
// Attributes: dynamodb.TableAttributeArray{
// &dynamodb.TableAttributeArgs{
// Name: pulumi.String("TestTableHashKey"),
// Type: pulumi.String("S"),
// },
// },
// Replicas: dynamodb.TableReplicaTypeArray{
// &dynamodb.TableReplicaTypeArgs{
// RegionName: pulumi.String("us-east-2"),
// },
// &dynamodb.TableReplicaTypeArgs{
// RegionName: pulumi.String("us-west-2"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ### Replica Tagging
//
// You can manage global table replicas' tags in various ways. This example shows using `replica.*.propagate_tags` for the first replica and the `dynamodb.Tag` resource for the other.
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
// "github.com/pulumi/pulumi-std/sdk/go/std"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// current, err := aws.GetRegion(ctx, nil, nil)
// if err != nil {
// return err
// }
// alternate, err := aws.GetRegion(ctx, nil, nil)
// if err != nil {
// return err
// }
// third, err := aws.GetRegion(ctx, nil, nil)
// if err != nil {
// return err
// }
// example, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{
// BillingMode: pulumi.String("PAY_PER_REQUEST"),
// HashKey: pulumi.String("TestTableHashKey"),
// Name: pulumi.String("example-13281"),
// StreamEnabled: pulumi.Bool(true),
// StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"),
// Attributes: dynamodb.TableAttributeArray{
// &dynamodb.TableAttributeArgs{
// Name: pulumi.String("TestTableHashKey"),
// Type: pulumi.String("S"),
// },
// },
// Replicas: dynamodb.TableReplicaTypeArray{
// &dynamodb.TableReplicaTypeArgs{
// RegionName: pulumi.String(alternate.Name),
// },
// &dynamodb.TableReplicaTypeArgs{
// RegionName: pulumi.String(third.Name),
// PropagateTags: pulumi.Bool(true),
// },
// },
// Tags: pulumi.StringMap{
// "Architect": pulumi.String("Eleanor"),
// "Zone": pulumi.String("SW"),
// },
// })
// if err != nil {
// return err
// }
// _, err = dynamodb.NewTag(ctx, "example", &dynamodb.TagArgs{
// ResourceArn: example.Arn.ApplyT(func(arn string) (std.ReplaceResult, error) {
// return std.ReplaceOutput(ctx, std.ReplaceOutputArgs{
// Text: arn,
// Search: current.Name,
// Replace: alternate.Name,
// }, nil), nil
// }).(std.ReplaceResultOutput).ApplyT(func(invoke std.ReplaceResult) (*string, error) {
// return invoke.Result, nil
// }).(pulumi.StringPtrOutput),
// Key: pulumi.String("Architect"),
// Value: pulumi.String("Gigi"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import DynamoDB tables using the `name`. For example:
//
// ```sh
// $ pulumi import aws:dynamodb/table:Table basic-dynamodb-table GameScores
// ```
type Table struct {
pulumi.CustomResourceState
// ARN of the table
Arn pulumi.StringOutput `pulumi:"arn"`
// Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below.
Attributes TableAttributeArrayOutput `pulumi:"attributes"`
// Controls how you are charged for read and write throughput and how you manage capacity. The valid values are `PROVISIONED` and `PAY_PER_REQUEST`. Defaults to `PROVISIONED`.
BillingMode pulumi.StringPtrOutput `pulumi:"billingMode"`
// Enables deletion protection for table. Defaults to `false`.
DeletionProtectionEnabled pulumi.BoolPtrOutput `pulumi:"deletionProtectionEnabled"`
// Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below.
GlobalSecondaryIndexes TableGlobalSecondaryIndexArrayOutput `pulumi:"globalSecondaryIndexes"`
// Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below.
HashKey pulumi.StringOutput `pulumi:"hashKey"`
// Import Amazon S3 data into a new table. See below.
ImportTable TableImportTablePtrOutput `pulumi:"importTable"`
// Describe an LSI on the table; these can only be allocated _at creation_ so you cannot change this definition after you have created the resource. See below.
LocalSecondaryIndexes TableLocalSecondaryIndexArrayOutput `pulumi:"localSecondaryIndexes"`
// Unique within a region name of the table.
//
// Optional arguments:
Name pulumi.StringOutput `pulumi:"name"`
// Enable point-in-time recovery options. See below.
PointInTimeRecovery TablePointInTimeRecoveryOutput `pulumi:"pointInTimeRecovery"`
// Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below.
RangeKey pulumi.StringPtrOutput `pulumi:"rangeKey"`
// Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
ReadCapacity pulumi.IntOutput `pulumi:"readCapacity"`
// Configuration block(s) with [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) replication configurations. See below.
Replicas TableReplicaTypeArrayOutput `pulumi:"replicas"`
// Time of the point-in-time recovery point to restore.
RestoreDateTime pulumi.StringPtrOutput `pulumi:"restoreDateTime"`
// Name of the table to restore. Must match the name of an existing table.
RestoreSourceName pulumi.StringPtrOutput `pulumi:"restoreSourceName"`
// If set, restores table to the most recent point-in-time recovery point.
RestoreToLatestTime pulumi.BoolPtrOutput `pulumi:"restoreToLatestTime"`
// Encryption at rest options. AWS DynamoDB tables are automatically encrypted at rest with an AWS-owned Customer Master Key if this argument isn't specified. See below.
ServerSideEncryption TableServerSideEncryptionOutput `pulumi:"serverSideEncryption"`
// ARN of the Table Stream. Only available when `streamEnabled = true`
StreamArn pulumi.StringOutput `pulumi:"streamArn"`
// Whether Streams are enabled.
StreamEnabled pulumi.BoolPtrOutput `pulumi:"streamEnabled"`
// Timestamp, in ISO 8601 format, for this stream. Note that this timestamp is not a unique identifier for the stream on its own. However, the combination of AWS customer ID, table name and this field is guaranteed to be unique. It can be used for creating CloudWatch Alarms. Only available when `streamEnabled = true`.
StreamLabel pulumi.StringOutput `pulumi:"streamLabel"`
// When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are `KEYS_ONLY`, `NEW_IMAGE`, `OLD_IMAGE`, `NEW_AND_OLD_IMAGES`.
StreamViewType pulumi.StringOutput `pulumi:"streamViewType"`
// Storage class of the table.
// Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`.
// Default value is `STANDARD`.
TableClass pulumi.StringPtrOutput `pulumi:"tableClass"`
// A map of tags to populate on the created table. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
// Configuration block for TTL. See below.
Ttl TableTtlOutput `pulumi:"ttl"`
// Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
WriteCapacity pulumi.IntOutput `pulumi:"writeCapacity"`
}
// NewTable registers a new resource with the given unique name, arguments, and options.
func NewTable(ctx *pulumi.Context,
name string, args *TableArgs, opts ...pulumi.ResourceOption) (*Table, error) {
if args == nil {
args = &TableArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Table
err := ctx.RegisterResource("aws:dynamodb/table:Table", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTable gets an existing Table 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 GetTable(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TableState, opts ...pulumi.ResourceOption) (*Table, error) {
var resource Table
err := ctx.ReadResource("aws:dynamodb/table:Table", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Table resources.
type tableState struct {
// ARN of the table
Arn *string `pulumi:"arn"`
// Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below.
Attributes []TableAttribute `pulumi:"attributes"`
// Controls how you are charged for read and write throughput and how you manage capacity. The valid values are `PROVISIONED` and `PAY_PER_REQUEST`. Defaults to `PROVISIONED`.
BillingMode *string `pulumi:"billingMode"`
// Enables deletion protection for table. Defaults to `false`.
DeletionProtectionEnabled *bool `pulumi:"deletionProtectionEnabled"`
// Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below.
GlobalSecondaryIndexes []TableGlobalSecondaryIndex `pulumi:"globalSecondaryIndexes"`
// Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below.
HashKey *string `pulumi:"hashKey"`
// Import Amazon S3 data into a new table. See below.
ImportTable *TableImportTable `pulumi:"importTable"`
// Describe an LSI on the table; these can only be allocated _at creation_ so you cannot change this definition after you have created the resource. See below.
LocalSecondaryIndexes []TableLocalSecondaryIndex `pulumi:"localSecondaryIndexes"`
// Unique within a region name of the table.
//
// Optional arguments:
Name *string `pulumi:"name"`
// Enable point-in-time recovery options. See below.
PointInTimeRecovery *TablePointInTimeRecovery `pulumi:"pointInTimeRecovery"`
// Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below.
RangeKey *string `pulumi:"rangeKey"`
// Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
ReadCapacity *int `pulumi:"readCapacity"`
// Configuration block(s) with [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) replication configurations. See below.
Replicas []TableReplicaType `pulumi:"replicas"`
// Time of the point-in-time recovery point to restore.
RestoreDateTime *string `pulumi:"restoreDateTime"`
// Name of the table to restore. Must match the name of an existing table.
RestoreSourceName *string `pulumi:"restoreSourceName"`
// If set, restores table to the most recent point-in-time recovery point.
RestoreToLatestTime *bool `pulumi:"restoreToLatestTime"`
// Encryption at rest options. AWS DynamoDB tables are automatically encrypted at rest with an AWS-owned Customer Master Key if this argument isn't specified. See below.
ServerSideEncryption *TableServerSideEncryption `pulumi:"serverSideEncryption"`
// ARN of the Table Stream. Only available when `streamEnabled = true`
StreamArn *string `pulumi:"streamArn"`
// Whether Streams are enabled.
StreamEnabled *bool `pulumi:"streamEnabled"`
// Timestamp, in ISO 8601 format, for this stream. Note that this timestamp is not a unique identifier for the stream on its own. However, the combination of AWS customer ID, table name and this field is guaranteed to be unique. It can be used for creating CloudWatch Alarms. Only available when `streamEnabled = true`.
StreamLabel *string `pulumi:"streamLabel"`
// When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are `KEYS_ONLY`, `NEW_IMAGE`, `OLD_IMAGE`, `NEW_AND_OLD_IMAGES`.
StreamViewType *string `pulumi:"streamViewType"`
// Storage class of the table.
// Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`.
// Default value is `STANDARD`.
TableClass *string `pulumi:"tableClass"`
// A map of tags to populate on the created table. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll map[string]string `pulumi:"tagsAll"`
// Configuration block for TTL. See below.
Ttl *TableTtl `pulumi:"ttl"`
// Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
WriteCapacity *int `pulumi:"writeCapacity"`
}
type TableState struct {
// ARN of the table
Arn pulumi.StringPtrInput
// Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below.
Attributes TableAttributeArrayInput
// Controls how you are charged for read and write throughput and how you manage capacity. The valid values are `PROVISIONED` and `PAY_PER_REQUEST`. Defaults to `PROVISIONED`.
BillingMode pulumi.StringPtrInput
// Enables deletion protection for table. Defaults to `false`.
DeletionProtectionEnabled pulumi.BoolPtrInput
// Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below.
GlobalSecondaryIndexes TableGlobalSecondaryIndexArrayInput
// Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below.
HashKey pulumi.StringPtrInput
// Import Amazon S3 data into a new table. See below.
ImportTable TableImportTablePtrInput
// Describe an LSI on the table; these can only be allocated _at creation_ so you cannot change this definition after you have created the resource. See below.
LocalSecondaryIndexes TableLocalSecondaryIndexArrayInput
// Unique within a region name of the table.
//
// Optional arguments:
Name pulumi.StringPtrInput
// Enable point-in-time recovery options. See below.
PointInTimeRecovery TablePointInTimeRecoveryPtrInput
// Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below.
RangeKey pulumi.StringPtrInput
// Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
ReadCapacity pulumi.IntPtrInput
// Configuration block(s) with [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) replication configurations. See below.
Replicas TableReplicaTypeArrayInput
// Time of the point-in-time recovery point to restore.
RestoreDateTime pulumi.StringPtrInput
// Name of the table to restore. Must match the name of an existing table.
RestoreSourceName pulumi.StringPtrInput
// If set, restores table to the most recent point-in-time recovery point.
RestoreToLatestTime pulumi.BoolPtrInput
// Encryption at rest options. AWS DynamoDB tables are automatically encrypted at rest with an AWS-owned Customer Master Key if this argument isn't specified. See below.
ServerSideEncryption TableServerSideEncryptionPtrInput
// ARN of the Table Stream. Only available when `streamEnabled = true`
StreamArn pulumi.StringPtrInput
// Whether Streams are enabled.
StreamEnabled pulumi.BoolPtrInput
// Timestamp, in ISO 8601 format, for this stream. Note that this timestamp is not a unique identifier for the stream on its own. However, the combination of AWS customer ID, table name and this field is guaranteed to be unique. It can be used for creating CloudWatch Alarms. Only available when `streamEnabled = true`.
StreamLabel pulumi.StringPtrInput
// When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are `KEYS_ONLY`, `NEW_IMAGE`, `OLD_IMAGE`, `NEW_AND_OLD_IMAGES`.
StreamViewType pulumi.StringPtrInput
// Storage class of the table.
// Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`.
// Default value is `STANDARD`.
TableClass pulumi.StringPtrInput
// A map of tags to populate on the created table. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapInput
// Configuration block for TTL. See below.
Ttl TableTtlPtrInput
// Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
WriteCapacity pulumi.IntPtrInput
}
func (TableState) ElementType() reflect.Type {
return reflect.TypeOf((*tableState)(nil)).Elem()
}
type tableArgs struct {
// Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below.
Attributes []TableAttribute `pulumi:"attributes"`
// Controls how you are charged for read and write throughput and how you manage capacity. The valid values are `PROVISIONED` and `PAY_PER_REQUEST`. Defaults to `PROVISIONED`.
BillingMode *string `pulumi:"billingMode"`
// Enables deletion protection for table. Defaults to `false`.
DeletionProtectionEnabled *bool `pulumi:"deletionProtectionEnabled"`
// Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below.
GlobalSecondaryIndexes []TableGlobalSecondaryIndex `pulumi:"globalSecondaryIndexes"`
// Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below.
HashKey *string `pulumi:"hashKey"`
// Import Amazon S3 data into a new table. See below.
ImportTable *TableImportTable `pulumi:"importTable"`
// Describe an LSI on the table; these can only be allocated _at creation_ so you cannot change this definition after you have created the resource. See below.
LocalSecondaryIndexes []TableLocalSecondaryIndex `pulumi:"localSecondaryIndexes"`
// Unique within a region name of the table.
//
// Optional arguments:
Name *string `pulumi:"name"`
// Enable point-in-time recovery options. See below.
PointInTimeRecovery *TablePointInTimeRecovery `pulumi:"pointInTimeRecovery"`
// Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below.
RangeKey *string `pulumi:"rangeKey"`
// Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
ReadCapacity *int `pulumi:"readCapacity"`
// Configuration block(s) with [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) replication configurations. See below.
Replicas []TableReplicaType `pulumi:"replicas"`
// Time of the point-in-time recovery point to restore.
RestoreDateTime *string `pulumi:"restoreDateTime"`
// Name of the table to restore. Must match the name of an existing table.
RestoreSourceName *string `pulumi:"restoreSourceName"`
// If set, restores table to the most recent point-in-time recovery point.
RestoreToLatestTime *bool `pulumi:"restoreToLatestTime"`
// Encryption at rest options. AWS DynamoDB tables are automatically encrypted at rest with an AWS-owned Customer Master Key if this argument isn't specified. See below.
ServerSideEncryption *TableServerSideEncryption `pulumi:"serverSideEncryption"`
// Whether Streams are enabled.
StreamEnabled *bool `pulumi:"streamEnabled"`
// When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are `KEYS_ONLY`, `NEW_IMAGE`, `OLD_IMAGE`, `NEW_AND_OLD_IMAGES`.
StreamViewType *string `pulumi:"streamViewType"`
// Storage class of the table.
// Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`.
// Default value is `STANDARD`.
TableClass *string `pulumi:"tableClass"`
// A map of tags to populate on the created table. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// Configuration block for TTL. See below.
Ttl *TableTtl `pulumi:"ttl"`
// Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
WriteCapacity *int `pulumi:"writeCapacity"`
}
// The set of arguments for constructing a Table resource.
type TableArgs struct {
// Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below.
Attributes TableAttributeArrayInput
// Controls how you are charged for read and write throughput and how you manage capacity. The valid values are `PROVISIONED` and `PAY_PER_REQUEST`. Defaults to `PROVISIONED`.
BillingMode pulumi.StringPtrInput
// Enables deletion protection for table. Defaults to `false`.
DeletionProtectionEnabled pulumi.BoolPtrInput
// Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below.
GlobalSecondaryIndexes TableGlobalSecondaryIndexArrayInput
// Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below.
HashKey pulumi.StringPtrInput
// Import Amazon S3 data into a new table. See below.
ImportTable TableImportTablePtrInput
// Describe an LSI on the table; these can only be allocated _at creation_ so you cannot change this definition after you have created the resource. See below.
LocalSecondaryIndexes TableLocalSecondaryIndexArrayInput
// Unique within a region name of the table.
//
// Optional arguments:
Name pulumi.StringPtrInput
// Enable point-in-time recovery options. See below.
PointInTimeRecovery TablePointInTimeRecoveryPtrInput
// Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below.
RangeKey pulumi.StringPtrInput
// Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
ReadCapacity pulumi.IntPtrInput
// Configuration block(s) with [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) replication configurations. See below.
Replicas TableReplicaTypeArrayInput
// Time of the point-in-time recovery point to restore.
RestoreDateTime pulumi.StringPtrInput
// Name of the table to restore. Must match the name of an existing table.
RestoreSourceName pulumi.StringPtrInput
// If set, restores table to the most recent point-in-time recovery point.
RestoreToLatestTime pulumi.BoolPtrInput
// Encryption at rest options. AWS DynamoDB tables are automatically encrypted at rest with an AWS-owned Customer Master Key if this argument isn't specified. See below.
ServerSideEncryption TableServerSideEncryptionPtrInput
// Whether Streams are enabled.
StreamEnabled pulumi.BoolPtrInput
// When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are `KEYS_ONLY`, `NEW_IMAGE`, `OLD_IMAGE`, `NEW_AND_OLD_IMAGES`.
StreamViewType pulumi.StringPtrInput
// Storage class of the table.
// Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`.
// Default value is `STANDARD`.
TableClass pulumi.StringPtrInput
// A map of tags to populate on the created table. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// Configuration block for TTL. See below.
Ttl TableTtlPtrInput
// Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
WriteCapacity pulumi.IntPtrInput
}
func (TableArgs) ElementType() reflect.Type {
return reflect.TypeOf((*tableArgs)(nil)).Elem()
}
type TableInput interface {
pulumi.Input
ToTableOutput() TableOutput
ToTableOutputWithContext(ctx context.Context) TableOutput
}
func (*Table) ElementType() reflect.Type {
return reflect.TypeOf((**Table)(nil)).Elem()
}
func (i *Table) ToTableOutput() TableOutput {
return i.ToTableOutputWithContext(context.Background())
}
func (i *Table) ToTableOutputWithContext(ctx context.Context) TableOutput {
return pulumi.ToOutputWithContext(ctx, i).(TableOutput)
}
// TableArrayInput is an input type that accepts TableArray and TableArrayOutput values.
// You can construct a concrete instance of `TableArrayInput` via:
//
// TableArray{ TableArgs{...} }
type TableArrayInput interface {
pulumi.Input
ToTableArrayOutput() TableArrayOutput
ToTableArrayOutputWithContext(context.Context) TableArrayOutput
}
type TableArray []TableInput
func (TableArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Table)(nil)).Elem()
}
func (i TableArray) ToTableArrayOutput() TableArrayOutput {
return i.ToTableArrayOutputWithContext(context.Background())
}
func (i TableArray) ToTableArrayOutputWithContext(ctx context.Context) TableArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TableArrayOutput)
}
// TableMapInput is an input type that accepts TableMap and TableMapOutput values.
// You can construct a concrete instance of `TableMapInput` via:
//
// TableMap{ "key": TableArgs{...} }
type TableMapInput interface {
pulumi.Input
ToTableMapOutput() TableMapOutput
ToTableMapOutputWithContext(context.Context) TableMapOutput
}
type TableMap map[string]TableInput
func (TableMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Table)(nil)).Elem()
}
func (i TableMap) ToTableMapOutput() TableMapOutput {
return i.ToTableMapOutputWithContext(context.Background())
}
func (i TableMap) ToTableMapOutputWithContext(ctx context.Context) TableMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TableMapOutput)
}
type TableOutput struct{ *pulumi.OutputState }
func (TableOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Table)(nil)).Elem()
}
func (o TableOutput) ToTableOutput() TableOutput {
return o
}
func (o TableOutput) ToTableOutputWithContext(ctx context.Context) TableOutput {
return o
}
// ARN of the table
func (o TableOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below.
func (o TableOutput) Attributes() TableAttributeArrayOutput {
return o.ApplyT(func(v *Table) TableAttributeArrayOutput { return v.Attributes }).(TableAttributeArrayOutput)
}
// Controls how you are charged for read and write throughput and how you manage capacity. The valid values are `PROVISIONED` and `PAY_PER_REQUEST`. Defaults to `PROVISIONED`.
func (o TableOutput) BillingMode() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.BillingMode }).(pulumi.StringPtrOutput)
}
// Enables deletion protection for table. Defaults to `false`.
func (o TableOutput) DeletionProtectionEnabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Table) pulumi.BoolPtrOutput { return v.DeletionProtectionEnabled }).(pulumi.BoolPtrOutput)
}
// Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below.
func (o TableOutput) GlobalSecondaryIndexes() TableGlobalSecondaryIndexArrayOutput {
return o.ApplyT(func(v *Table) TableGlobalSecondaryIndexArrayOutput { return v.GlobalSecondaryIndexes }).(TableGlobalSecondaryIndexArrayOutput)
}
// Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below.
func (o TableOutput) HashKey() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.HashKey }).(pulumi.StringOutput)
}
// Import Amazon S3 data into a new table. See below.
func (o TableOutput) ImportTable() TableImportTablePtrOutput {
return o.ApplyT(func(v *Table) TableImportTablePtrOutput { return v.ImportTable }).(TableImportTablePtrOutput)
}
// Describe an LSI on the table; these can only be allocated _at creation_ so you cannot change this definition after you have created the resource. See below.
func (o TableOutput) LocalSecondaryIndexes() TableLocalSecondaryIndexArrayOutput {
return o.ApplyT(func(v *Table) TableLocalSecondaryIndexArrayOutput { return v.LocalSecondaryIndexes }).(TableLocalSecondaryIndexArrayOutput)
}
// Unique within a region name of the table.
//
// Optional arguments:
func (o TableOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Enable point-in-time recovery options. See below.
func (o TableOutput) PointInTimeRecovery() TablePointInTimeRecoveryOutput {
return o.ApplyT(func(v *Table) TablePointInTimeRecoveryOutput { return v.PointInTimeRecovery }).(TablePointInTimeRecoveryOutput)
}
// Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below.
func (o TableOutput) RangeKey() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.RangeKey }).(pulumi.StringPtrOutput)
}
// Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
func (o TableOutput) ReadCapacity() pulumi.IntOutput {
return o.ApplyT(func(v *Table) pulumi.IntOutput { return v.ReadCapacity }).(pulumi.IntOutput)
}
// Configuration block(s) with [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) replication configurations. See below.
func (o TableOutput) Replicas() TableReplicaTypeArrayOutput {
return o.ApplyT(func(v *Table) TableReplicaTypeArrayOutput { return v.Replicas }).(TableReplicaTypeArrayOutput)
}
// Time of the point-in-time recovery point to restore.
func (o TableOutput) RestoreDateTime() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.RestoreDateTime }).(pulumi.StringPtrOutput)
}
// Name of the table to restore. Must match the name of an existing table.
func (o TableOutput) RestoreSourceName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.RestoreSourceName }).(pulumi.StringPtrOutput)
}
// If set, restores table to the most recent point-in-time recovery point.
func (o TableOutput) RestoreToLatestTime() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Table) pulumi.BoolPtrOutput { return v.RestoreToLatestTime }).(pulumi.BoolPtrOutput)
}
// Encryption at rest options. AWS DynamoDB tables are automatically encrypted at rest with an AWS-owned Customer Master Key if this argument isn't specified. See below.
func (o TableOutput) ServerSideEncryption() TableServerSideEncryptionOutput {
return o.ApplyT(func(v *Table) TableServerSideEncryptionOutput { return v.ServerSideEncryption }).(TableServerSideEncryptionOutput)
}
// ARN of the Table Stream. Only available when `streamEnabled = true`
func (o TableOutput) StreamArn() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.StreamArn }).(pulumi.StringOutput)
}
// Whether Streams are enabled.
func (o TableOutput) StreamEnabled() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *Table) pulumi.BoolPtrOutput { return v.StreamEnabled }).(pulumi.BoolPtrOutput)
}
// Timestamp, in ISO 8601 format, for this stream. Note that this timestamp is not a unique identifier for the stream on its own. However, the combination of AWS customer ID, table name and this field is guaranteed to be unique. It can be used for creating CloudWatch Alarms. Only available when `streamEnabled = true`.
func (o TableOutput) StreamLabel() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.StreamLabel }).(pulumi.StringOutput)
}
// When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are `KEYS_ONLY`, `NEW_IMAGE`, `OLD_IMAGE`, `NEW_AND_OLD_IMAGES`.
func (o TableOutput) StreamViewType() pulumi.StringOutput {
return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.StreamViewType }).(pulumi.StringOutput)
}
// Storage class of the table.
// Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`.
// Default value is `STANDARD`.
func (o TableOutput) TableClass() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.TableClass }).(pulumi.StringPtrOutput)
}
// A map of tags to populate on the created table. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
func (o TableOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *Table) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
func (o TableOutput) TagsAll() pulumi.StringMapOutput {
return o.ApplyT(func(v *Table) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
}
// Configuration block for TTL. See below.
func (o TableOutput) Ttl() TableTtlOutput {
return o.ApplyT(func(v *Table) TableTtlOutput { return v.Ttl }).(TableTtlOutput)
}
// Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required.
func (o TableOutput) WriteCapacity() pulumi.IntOutput {
return o.ApplyT(func(v *Table) pulumi.IntOutput { return v.WriteCapacity }).(pulumi.IntOutput)
}
type TableArrayOutput struct{ *pulumi.OutputState }
func (TableArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Table)(nil)).Elem()
}
func (o TableArrayOutput) ToTableArrayOutput() TableArrayOutput {
return o
}
func (o TableArrayOutput) ToTableArrayOutputWithContext(ctx context.Context) TableArrayOutput {
return o
}
func (o TableArrayOutput) Index(i pulumi.IntInput) TableOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Table {
return vs[0].([]*Table)[vs[1].(int)]
}).(TableOutput)
}
type TableMapOutput struct{ *pulumi.OutputState }
func (TableMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Table)(nil)).Elem()
}
func (o TableMapOutput) ToTableMapOutput() TableMapOutput {
return o
}
func (o TableMapOutput) ToTableMapOutputWithContext(ctx context.Context) TableMapOutput {
return o
}
func (o TableMapOutput) MapIndex(k pulumi.StringInput) TableOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Table {
return vs[0].(map[string]*Table)[vs[1].(string)]
}).(TableOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TableInput)(nil)).Elem(), &Table{})
pulumi.RegisterInputType(reflect.TypeOf((*TableArrayInput)(nil)).Elem(), TableArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TableMapInput)(nil)).Elem(), TableMap{})
pulumi.RegisterOutputType(TableOutput{})
pulumi.RegisterOutputType(TableArrayOutput{})
pulumi.RegisterOutputType(TableMapOutput{})
}