github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/dynamodb/table.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 dynamodb 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // Provides a DynamoDB table resource. 15 // 16 // > **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. 17 // 18 // > **Note:** When using dynamodb.TableReplica with this resource, use `lifecycle` `ignoreChanges` for `replica`, _e.g._, `lifecycle { ignoreChanges = [replica] }`. 19 // 20 // ## DynamoDB Table attributes 21 // 22 // Only define attributes on the table object that are going to be used as: 23 // 24 // * Table hash key or range key 25 // * LSI or GSI hash key or range key 26 // 27 // 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. 28 // 29 // ## Example Usage 30 // 31 // ### Basic Example 32 // 33 // 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) 34 // 35 // <!--Start PulumiCodeChooser --> 36 // ```go 37 // package main 38 // 39 // import ( 40 // 41 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb" 42 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 43 // 44 // ) 45 // 46 // func main() { 47 // pulumi.Run(func(ctx *pulumi.Context) error { 48 // _, err := dynamodb.NewTable(ctx, "basic-dynamodb-table", &dynamodb.TableArgs{ 49 // Name: pulumi.String("GameScores"), 50 // BillingMode: pulumi.String("PROVISIONED"), 51 // ReadCapacity: pulumi.Int(20), 52 // WriteCapacity: pulumi.Int(20), 53 // HashKey: pulumi.String("UserId"), 54 // RangeKey: pulumi.String("GameTitle"), 55 // Attributes: dynamodb.TableAttributeArray{ 56 // &dynamodb.TableAttributeArgs{ 57 // Name: pulumi.String("UserId"), 58 // Type: pulumi.String("S"), 59 // }, 60 // &dynamodb.TableAttributeArgs{ 61 // Name: pulumi.String("GameTitle"), 62 // Type: pulumi.String("S"), 63 // }, 64 // &dynamodb.TableAttributeArgs{ 65 // Name: pulumi.String("TopScore"), 66 // Type: pulumi.String("N"), 67 // }, 68 // }, 69 // Ttl: &dynamodb.TableTtlArgs{ 70 // AttributeName: pulumi.String("TimeToExist"), 71 // Enabled: pulumi.Bool(false), 72 // }, 73 // GlobalSecondaryIndexes: dynamodb.TableGlobalSecondaryIndexArray{ 74 // &dynamodb.TableGlobalSecondaryIndexArgs{ 75 // Name: pulumi.String("GameTitleIndex"), 76 // HashKey: pulumi.String("GameTitle"), 77 // RangeKey: pulumi.String("TopScore"), 78 // WriteCapacity: pulumi.Int(10), 79 // ReadCapacity: pulumi.Int(10), 80 // ProjectionType: pulumi.String("INCLUDE"), 81 // NonKeyAttributes: pulumi.StringArray{ 82 // pulumi.String("UserId"), 83 // }, 84 // }, 85 // }, 86 // Tags: pulumi.StringMap{ 87 // "Name": pulumi.String("dynamodb-table-1"), 88 // "Environment": pulumi.String("production"), 89 // }, 90 // }) 91 // if err != nil { 92 // return err 93 // } 94 // return nil 95 // }) 96 // } 97 // 98 // ``` 99 // <!--End PulumiCodeChooser --> 100 // 101 // ### Global Tables 102 // 103 // 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. 104 // 105 // > **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. 106 // 107 // <!--Start PulumiCodeChooser --> 108 // ```go 109 // package main 110 // 111 // import ( 112 // 113 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb" 114 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 115 // 116 // ) 117 // 118 // func main() { 119 // pulumi.Run(func(ctx *pulumi.Context) error { 120 // _, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{ 121 // Name: pulumi.String("example"), 122 // HashKey: pulumi.String("TestTableHashKey"), 123 // BillingMode: pulumi.String("PAY_PER_REQUEST"), 124 // StreamEnabled: pulumi.Bool(true), 125 // StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"), 126 // Attributes: dynamodb.TableAttributeArray{ 127 // &dynamodb.TableAttributeArgs{ 128 // Name: pulumi.String("TestTableHashKey"), 129 // Type: pulumi.String("S"), 130 // }, 131 // }, 132 // Replicas: dynamodb.TableReplicaTypeArray{ 133 // &dynamodb.TableReplicaTypeArgs{ 134 // RegionName: pulumi.String("us-east-2"), 135 // }, 136 // &dynamodb.TableReplicaTypeArgs{ 137 // RegionName: pulumi.String("us-west-2"), 138 // }, 139 // }, 140 // }) 141 // if err != nil { 142 // return err 143 // } 144 // return nil 145 // }) 146 // } 147 // 148 // ``` 149 // <!--End PulumiCodeChooser --> 150 // 151 // ### Replica Tagging 152 // 153 // 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. 154 // 155 // <!--Start PulumiCodeChooser --> 156 // ```go 157 // package main 158 // 159 // import ( 160 // 161 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 162 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb" 163 // "github.com/pulumi/pulumi-std/sdk/go/std" 164 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 165 // 166 // ) 167 // 168 // func main() { 169 // pulumi.Run(func(ctx *pulumi.Context) error { 170 // current, err := aws.GetRegion(ctx, nil, nil) 171 // if err != nil { 172 // return err 173 // } 174 // alternate, err := aws.GetRegion(ctx, nil, nil) 175 // if err != nil { 176 // return err 177 // } 178 // third, err := aws.GetRegion(ctx, nil, nil) 179 // if err != nil { 180 // return err 181 // } 182 // example, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{ 183 // BillingMode: pulumi.String("PAY_PER_REQUEST"), 184 // HashKey: pulumi.String("TestTableHashKey"), 185 // Name: pulumi.String("example-13281"), 186 // StreamEnabled: pulumi.Bool(true), 187 // StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"), 188 // Attributes: dynamodb.TableAttributeArray{ 189 // &dynamodb.TableAttributeArgs{ 190 // Name: pulumi.String("TestTableHashKey"), 191 // Type: pulumi.String("S"), 192 // }, 193 // }, 194 // Replicas: dynamodb.TableReplicaTypeArray{ 195 // &dynamodb.TableReplicaTypeArgs{ 196 // RegionName: pulumi.String(alternate.Name), 197 // }, 198 // &dynamodb.TableReplicaTypeArgs{ 199 // RegionName: pulumi.String(third.Name), 200 // PropagateTags: pulumi.Bool(true), 201 // }, 202 // }, 203 // Tags: pulumi.StringMap{ 204 // "Architect": pulumi.String("Eleanor"), 205 // "Zone": pulumi.String("SW"), 206 // }, 207 // }) 208 // if err != nil { 209 // return err 210 // } 211 // _, err = dynamodb.NewTag(ctx, "example", &dynamodb.TagArgs{ 212 // ResourceArn: example.Arn.ApplyT(func(arn string) (std.ReplaceResult, error) { 213 // return std.ReplaceOutput(ctx, std.ReplaceOutputArgs{ 214 // Text: arn, 215 // Search: current.Name, 216 // Replace: alternate.Name, 217 // }, nil), nil 218 // }).(std.ReplaceResultOutput).ApplyT(func(invoke std.ReplaceResult) (*string, error) { 219 // return invoke.Result, nil 220 // }).(pulumi.StringPtrOutput), 221 // Key: pulumi.String("Architect"), 222 // Value: pulumi.String("Gigi"), 223 // }) 224 // if err != nil { 225 // return err 226 // } 227 // return nil 228 // }) 229 // } 230 // 231 // ``` 232 // <!--End PulumiCodeChooser --> 233 // 234 // ## Import 235 // 236 // Using `pulumi import`, import DynamoDB tables using the `name`. For example: 237 // 238 // ```sh 239 // $ pulumi import aws:dynamodb/table:Table basic-dynamodb-table GameScores 240 // ``` 241 type Table struct { 242 pulumi.CustomResourceState 243 244 // ARN of the table 245 Arn pulumi.StringOutput `pulumi:"arn"` 246 // Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below. 247 Attributes TableAttributeArrayOutput `pulumi:"attributes"` 248 // 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`. 249 BillingMode pulumi.StringPtrOutput `pulumi:"billingMode"` 250 // Enables deletion protection for table. Defaults to `false`. 251 DeletionProtectionEnabled pulumi.BoolPtrOutput `pulumi:"deletionProtectionEnabled"` 252 // Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below. 253 GlobalSecondaryIndexes TableGlobalSecondaryIndexArrayOutput `pulumi:"globalSecondaryIndexes"` 254 // Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below. 255 HashKey pulumi.StringOutput `pulumi:"hashKey"` 256 // Import Amazon S3 data into a new table. See below. 257 ImportTable TableImportTablePtrOutput `pulumi:"importTable"` 258 // 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. 259 LocalSecondaryIndexes TableLocalSecondaryIndexArrayOutput `pulumi:"localSecondaryIndexes"` 260 // Unique within a region name of the table. 261 // 262 // Optional arguments: 263 Name pulumi.StringOutput `pulumi:"name"` 264 // Enable point-in-time recovery options. See below. 265 PointInTimeRecovery TablePointInTimeRecoveryOutput `pulumi:"pointInTimeRecovery"` 266 // Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below. 267 RangeKey pulumi.StringPtrOutput `pulumi:"rangeKey"` 268 // Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 269 ReadCapacity pulumi.IntOutput `pulumi:"readCapacity"` 270 // 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. 271 Replicas TableReplicaTypeArrayOutput `pulumi:"replicas"` 272 // Time of the point-in-time recovery point to restore. 273 RestoreDateTime pulumi.StringPtrOutput `pulumi:"restoreDateTime"` 274 // Name of the table to restore. Must match the name of an existing table. 275 RestoreSourceName pulumi.StringPtrOutput `pulumi:"restoreSourceName"` 276 // If set, restores table to the most recent point-in-time recovery point. 277 RestoreToLatestTime pulumi.BoolPtrOutput `pulumi:"restoreToLatestTime"` 278 // 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. 279 ServerSideEncryption TableServerSideEncryptionOutput `pulumi:"serverSideEncryption"` 280 // ARN of the Table Stream. Only available when `streamEnabled = true` 281 StreamArn pulumi.StringOutput `pulumi:"streamArn"` 282 // Whether Streams are enabled. 283 StreamEnabled pulumi.BoolPtrOutput `pulumi:"streamEnabled"` 284 // 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`. 285 StreamLabel pulumi.StringOutput `pulumi:"streamLabel"` 286 // 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`. 287 StreamViewType pulumi.StringOutput `pulumi:"streamViewType"` 288 // Storage class of the table. 289 // Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. 290 // Default value is `STANDARD`. 291 TableClass pulumi.StringPtrOutput `pulumi:"tableClass"` 292 // 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. 293 Tags pulumi.StringMapOutput `pulumi:"tags"` 294 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 295 // 296 // Deprecated: Please use `tags` instead. 297 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 298 // Configuration block for TTL. See below. 299 Ttl TableTtlOutput `pulumi:"ttl"` 300 // Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 301 WriteCapacity pulumi.IntOutput `pulumi:"writeCapacity"` 302 } 303 304 // NewTable registers a new resource with the given unique name, arguments, and options. 305 func NewTable(ctx *pulumi.Context, 306 name string, args *TableArgs, opts ...pulumi.ResourceOption) (*Table, error) { 307 if args == nil { 308 args = &TableArgs{} 309 } 310 311 opts = internal.PkgResourceDefaultOpts(opts) 312 var resource Table 313 err := ctx.RegisterResource("aws:dynamodb/table:Table", name, args, &resource, opts...) 314 if err != nil { 315 return nil, err 316 } 317 return &resource, nil 318 } 319 320 // GetTable gets an existing Table resource's state with the given name, ID, and optional 321 // state properties that are used to uniquely qualify the lookup (nil if not required). 322 func GetTable(ctx *pulumi.Context, 323 name string, id pulumi.IDInput, state *TableState, opts ...pulumi.ResourceOption) (*Table, error) { 324 var resource Table 325 err := ctx.ReadResource("aws:dynamodb/table:Table", name, id, state, &resource, opts...) 326 if err != nil { 327 return nil, err 328 } 329 return &resource, nil 330 } 331 332 // Input properties used for looking up and filtering Table resources. 333 type tableState struct { 334 // ARN of the table 335 Arn *string `pulumi:"arn"` 336 // Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below. 337 Attributes []TableAttribute `pulumi:"attributes"` 338 // 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`. 339 BillingMode *string `pulumi:"billingMode"` 340 // Enables deletion protection for table. Defaults to `false`. 341 DeletionProtectionEnabled *bool `pulumi:"deletionProtectionEnabled"` 342 // Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below. 343 GlobalSecondaryIndexes []TableGlobalSecondaryIndex `pulumi:"globalSecondaryIndexes"` 344 // Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below. 345 HashKey *string `pulumi:"hashKey"` 346 // Import Amazon S3 data into a new table. See below. 347 ImportTable *TableImportTable `pulumi:"importTable"` 348 // 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. 349 LocalSecondaryIndexes []TableLocalSecondaryIndex `pulumi:"localSecondaryIndexes"` 350 // Unique within a region name of the table. 351 // 352 // Optional arguments: 353 Name *string `pulumi:"name"` 354 // Enable point-in-time recovery options. See below. 355 PointInTimeRecovery *TablePointInTimeRecovery `pulumi:"pointInTimeRecovery"` 356 // Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below. 357 RangeKey *string `pulumi:"rangeKey"` 358 // Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 359 ReadCapacity *int `pulumi:"readCapacity"` 360 // 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. 361 Replicas []TableReplicaType `pulumi:"replicas"` 362 // Time of the point-in-time recovery point to restore. 363 RestoreDateTime *string `pulumi:"restoreDateTime"` 364 // Name of the table to restore. Must match the name of an existing table. 365 RestoreSourceName *string `pulumi:"restoreSourceName"` 366 // If set, restores table to the most recent point-in-time recovery point. 367 RestoreToLatestTime *bool `pulumi:"restoreToLatestTime"` 368 // 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. 369 ServerSideEncryption *TableServerSideEncryption `pulumi:"serverSideEncryption"` 370 // ARN of the Table Stream. Only available when `streamEnabled = true` 371 StreamArn *string `pulumi:"streamArn"` 372 // Whether Streams are enabled. 373 StreamEnabled *bool `pulumi:"streamEnabled"` 374 // 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`. 375 StreamLabel *string `pulumi:"streamLabel"` 376 // 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`. 377 StreamViewType *string `pulumi:"streamViewType"` 378 // Storage class of the table. 379 // Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. 380 // Default value is `STANDARD`. 381 TableClass *string `pulumi:"tableClass"` 382 // 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. 383 Tags map[string]string `pulumi:"tags"` 384 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 385 // 386 // Deprecated: Please use `tags` instead. 387 TagsAll map[string]string `pulumi:"tagsAll"` 388 // Configuration block for TTL. See below. 389 Ttl *TableTtl `pulumi:"ttl"` 390 // Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 391 WriteCapacity *int `pulumi:"writeCapacity"` 392 } 393 394 type TableState struct { 395 // ARN of the table 396 Arn pulumi.StringPtrInput 397 // Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below. 398 Attributes TableAttributeArrayInput 399 // 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`. 400 BillingMode pulumi.StringPtrInput 401 // Enables deletion protection for table. Defaults to `false`. 402 DeletionProtectionEnabled pulumi.BoolPtrInput 403 // Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below. 404 GlobalSecondaryIndexes TableGlobalSecondaryIndexArrayInput 405 // Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below. 406 HashKey pulumi.StringPtrInput 407 // Import Amazon S3 data into a new table. See below. 408 ImportTable TableImportTablePtrInput 409 // 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. 410 LocalSecondaryIndexes TableLocalSecondaryIndexArrayInput 411 // Unique within a region name of the table. 412 // 413 // Optional arguments: 414 Name pulumi.StringPtrInput 415 // Enable point-in-time recovery options. See below. 416 PointInTimeRecovery TablePointInTimeRecoveryPtrInput 417 // Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below. 418 RangeKey pulumi.StringPtrInput 419 // Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 420 ReadCapacity pulumi.IntPtrInput 421 // 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. 422 Replicas TableReplicaTypeArrayInput 423 // Time of the point-in-time recovery point to restore. 424 RestoreDateTime pulumi.StringPtrInput 425 // Name of the table to restore. Must match the name of an existing table. 426 RestoreSourceName pulumi.StringPtrInput 427 // If set, restores table to the most recent point-in-time recovery point. 428 RestoreToLatestTime pulumi.BoolPtrInput 429 // 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. 430 ServerSideEncryption TableServerSideEncryptionPtrInput 431 // ARN of the Table Stream. Only available when `streamEnabled = true` 432 StreamArn pulumi.StringPtrInput 433 // Whether Streams are enabled. 434 StreamEnabled pulumi.BoolPtrInput 435 // 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`. 436 StreamLabel pulumi.StringPtrInput 437 // 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`. 438 StreamViewType pulumi.StringPtrInput 439 // Storage class of the table. 440 // Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. 441 // Default value is `STANDARD`. 442 TableClass pulumi.StringPtrInput 443 // 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. 444 Tags pulumi.StringMapInput 445 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 446 // 447 // Deprecated: Please use `tags` instead. 448 TagsAll pulumi.StringMapInput 449 // Configuration block for TTL. See below. 450 Ttl TableTtlPtrInput 451 // Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 452 WriteCapacity pulumi.IntPtrInput 453 } 454 455 func (TableState) ElementType() reflect.Type { 456 return reflect.TypeOf((*tableState)(nil)).Elem() 457 } 458 459 type tableArgs struct { 460 // Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below. 461 Attributes []TableAttribute `pulumi:"attributes"` 462 // 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`. 463 BillingMode *string `pulumi:"billingMode"` 464 // Enables deletion protection for table. Defaults to `false`. 465 DeletionProtectionEnabled *bool `pulumi:"deletionProtectionEnabled"` 466 // Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below. 467 GlobalSecondaryIndexes []TableGlobalSecondaryIndex `pulumi:"globalSecondaryIndexes"` 468 // Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below. 469 HashKey *string `pulumi:"hashKey"` 470 // Import Amazon S3 data into a new table. See below. 471 ImportTable *TableImportTable `pulumi:"importTable"` 472 // 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. 473 LocalSecondaryIndexes []TableLocalSecondaryIndex `pulumi:"localSecondaryIndexes"` 474 // Unique within a region name of the table. 475 // 476 // Optional arguments: 477 Name *string `pulumi:"name"` 478 // Enable point-in-time recovery options. See below. 479 PointInTimeRecovery *TablePointInTimeRecovery `pulumi:"pointInTimeRecovery"` 480 // Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below. 481 RangeKey *string `pulumi:"rangeKey"` 482 // Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 483 ReadCapacity *int `pulumi:"readCapacity"` 484 // 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. 485 Replicas []TableReplicaType `pulumi:"replicas"` 486 // Time of the point-in-time recovery point to restore. 487 RestoreDateTime *string `pulumi:"restoreDateTime"` 488 // Name of the table to restore. Must match the name of an existing table. 489 RestoreSourceName *string `pulumi:"restoreSourceName"` 490 // If set, restores table to the most recent point-in-time recovery point. 491 RestoreToLatestTime *bool `pulumi:"restoreToLatestTime"` 492 // 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. 493 ServerSideEncryption *TableServerSideEncryption `pulumi:"serverSideEncryption"` 494 // Whether Streams are enabled. 495 StreamEnabled *bool `pulumi:"streamEnabled"` 496 // 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`. 497 StreamViewType *string `pulumi:"streamViewType"` 498 // Storage class of the table. 499 // Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. 500 // Default value is `STANDARD`. 501 TableClass *string `pulumi:"tableClass"` 502 // 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. 503 Tags map[string]string `pulumi:"tags"` 504 // Configuration block for TTL. See below. 505 Ttl *TableTtl `pulumi:"ttl"` 506 // Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 507 WriteCapacity *int `pulumi:"writeCapacity"` 508 } 509 510 // The set of arguments for constructing a Table resource. 511 type TableArgs struct { 512 // Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below. 513 Attributes TableAttributeArrayInput 514 // 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`. 515 BillingMode pulumi.StringPtrInput 516 // Enables deletion protection for table. Defaults to `false`. 517 DeletionProtectionEnabled pulumi.BoolPtrInput 518 // Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below. 519 GlobalSecondaryIndexes TableGlobalSecondaryIndexArrayInput 520 // Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below. 521 HashKey pulumi.StringPtrInput 522 // Import Amazon S3 data into a new table. See below. 523 ImportTable TableImportTablePtrInput 524 // 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. 525 LocalSecondaryIndexes TableLocalSecondaryIndexArrayInput 526 // Unique within a region name of the table. 527 // 528 // Optional arguments: 529 Name pulumi.StringPtrInput 530 // Enable point-in-time recovery options. See below. 531 PointInTimeRecovery TablePointInTimeRecoveryPtrInput 532 // Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below. 533 RangeKey pulumi.StringPtrInput 534 // Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 535 ReadCapacity pulumi.IntPtrInput 536 // 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. 537 Replicas TableReplicaTypeArrayInput 538 // Time of the point-in-time recovery point to restore. 539 RestoreDateTime pulumi.StringPtrInput 540 // Name of the table to restore. Must match the name of an existing table. 541 RestoreSourceName pulumi.StringPtrInput 542 // If set, restores table to the most recent point-in-time recovery point. 543 RestoreToLatestTime pulumi.BoolPtrInput 544 // 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. 545 ServerSideEncryption TableServerSideEncryptionPtrInput 546 // Whether Streams are enabled. 547 StreamEnabled pulumi.BoolPtrInput 548 // 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`. 549 StreamViewType pulumi.StringPtrInput 550 // Storage class of the table. 551 // Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. 552 // Default value is `STANDARD`. 553 TableClass pulumi.StringPtrInput 554 // 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. 555 Tags pulumi.StringMapInput 556 // Configuration block for TTL. See below. 557 Ttl TableTtlPtrInput 558 // Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 559 WriteCapacity pulumi.IntPtrInput 560 } 561 562 func (TableArgs) ElementType() reflect.Type { 563 return reflect.TypeOf((*tableArgs)(nil)).Elem() 564 } 565 566 type TableInput interface { 567 pulumi.Input 568 569 ToTableOutput() TableOutput 570 ToTableOutputWithContext(ctx context.Context) TableOutput 571 } 572 573 func (*Table) ElementType() reflect.Type { 574 return reflect.TypeOf((**Table)(nil)).Elem() 575 } 576 577 func (i *Table) ToTableOutput() TableOutput { 578 return i.ToTableOutputWithContext(context.Background()) 579 } 580 581 func (i *Table) ToTableOutputWithContext(ctx context.Context) TableOutput { 582 return pulumi.ToOutputWithContext(ctx, i).(TableOutput) 583 } 584 585 // TableArrayInput is an input type that accepts TableArray and TableArrayOutput values. 586 // You can construct a concrete instance of `TableArrayInput` via: 587 // 588 // TableArray{ TableArgs{...} } 589 type TableArrayInput interface { 590 pulumi.Input 591 592 ToTableArrayOutput() TableArrayOutput 593 ToTableArrayOutputWithContext(context.Context) TableArrayOutput 594 } 595 596 type TableArray []TableInput 597 598 func (TableArray) ElementType() reflect.Type { 599 return reflect.TypeOf((*[]*Table)(nil)).Elem() 600 } 601 602 func (i TableArray) ToTableArrayOutput() TableArrayOutput { 603 return i.ToTableArrayOutputWithContext(context.Background()) 604 } 605 606 func (i TableArray) ToTableArrayOutputWithContext(ctx context.Context) TableArrayOutput { 607 return pulumi.ToOutputWithContext(ctx, i).(TableArrayOutput) 608 } 609 610 // TableMapInput is an input type that accepts TableMap and TableMapOutput values. 611 // You can construct a concrete instance of `TableMapInput` via: 612 // 613 // TableMap{ "key": TableArgs{...} } 614 type TableMapInput interface { 615 pulumi.Input 616 617 ToTableMapOutput() TableMapOutput 618 ToTableMapOutputWithContext(context.Context) TableMapOutput 619 } 620 621 type TableMap map[string]TableInput 622 623 func (TableMap) ElementType() reflect.Type { 624 return reflect.TypeOf((*map[string]*Table)(nil)).Elem() 625 } 626 627 func (i TableMap) ToTableMapOutput() TableMapOutput { 628 return i.ToTableMapOutputWithContext(context.Background()) 629 } 630 631 func (i TableMap) ToTableMapOutputWithContext(ctx context.Context) TableMapOutput { 632 return pulumi.ToOutputWithContext(ctx, i).(TableMapOutput) 633 } 634 635 type TableOutput struct{ *pulumi.OutputState } 636 637 func (TableOutput) ElementType() reflect.Type { 638 return reflect.TypeOf((**Table)(nil)).Elem() 639 } 640 641 func (o TableOutput) ToTableOutput() TableOutput { 642 return o 643 } 644 645 func (o TableOutput) ToTableOutputWithContext(ctx context.Context) TableOutput { 646 return o 647 } 648 649 // ARN of the table 650 func (o TableOutput) Arn() pulumi.StringOutput { 651 return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 652 } 653 654 // Set of nested attribute definitions. Only required for `hashKey` and `rangeKey` attributes. See below. 655 func (o TableOutput) Attributes() TableAttributeArrayOutput { 656 return o.ApplyT(func(v *Table) TableAttributeArrayOutput { return v.Attributes }).(TableAttributeArrayOutput) 657 } 658 659 // 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`. 660 func (o TableOutput) BillingMode() pulumi.StringPtrOutput { 661 return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.BillingMode }).(pulumi.StringPtrOutput) 662 } 663 664 // Enables deletion protection for table. Defaults to `false`. 665 func (o TableOutput) DeletionProtectionEnabled() pulumi.BoolPtrOutput { 666 return o.ApplyT(func(v *Table) pulumi.BoolPtrOutput { return v.DeletionProtectionEnabled }).(pulumi.BoolPtrOutput) 667 } 668 669 // Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. See below. 670 func (o TableOutput) GlobalSecondaryIndexes() TableGlobalSecondaryIndexArrayOutput { 671 return o.ApplyT(func(v *Table) TableGlobalSecondaryIndexArrayOutput { return v.GlobalSecondaryIndexes }).(TableGlobalSecondaryIndexArrayOutput) 672 } 673 674 // Attribute to use as the hash (partition) key. Must also be defined as an `attribute`. See below. 675 func (o TableOutput) HashKey() pulumi.StringOutput { 676 return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.HashKey }).(pulumi.StringOutput) 677 } 678 679 // Import Amazon S3 data into a new table. See below. 680 func (o TableOutput) ImportTable() TableImportTablePtrOutput { 681 return o.ApplyT(func(v *Table) TableImportTablePtrOutput { return v.ImportTable }).(TableImportTablePtrOutput) 682 } 683 684 // 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. 685 func (o TableOutput) LocalSecondaryIndexes() TableLocalSecondaryIndexArrayOutput { 686 return o.ApplyT(func(v *Table) TableLocalSecondaryIndexArrayOutput { return v.LocalSecondaryIndexes }).(TableLocalSecondaryIndexArrayOutput) 687 } 688 689 // Unique within a region name of the table. 690 // 691 // Optional arguments: 692 func (o TableOutput) Name() pulumi.StringOutput { 693 return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 694 } 695 696 // Enable point-in-time recovery options. See below. 697 func (o TableOutput) PointInTimeRecovery() TablePointInTimeRecoveryOutput { 698 return o.ApplyT(func(v *Table) TablePointInTimeRecoveryOutput { return v.PointInTimeRecovery }).(TablePointInTimeRecoveryOutput) 699 } 700 701 // Attribute to use as the range (sort) key. Must also be defined as an `attribute`, see below. 702 func (o TableOutput) RangeKey() pulumi.StringPtrOutput { 703 return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.RangeKey }).(pulumi.StringPtrOutput) 704 } 705 706 // Number of read units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 707 func (o TableOutput) ReadCapacity() pulumi.IntOutput { 708 return o.ApplyT(func(v *Table) pulumi.IntOutput { return v.ReadCapacity }).(pulumi.IntOutput) 709 } 710 711 // 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. 712 func (o TableOutput) Replicas() TableReplicaTypeArrayOutput { 713 return o.ApplyT(func(v *Table) TableReplicaTypeArrayOutput { return v.Replicas }).(TableReplicaTypeArrayOutput) 714 } 715 716 // Time of the point-in-time recovery point to restore. 717 func (o TableOutput) RestoreDateTime() pulumi.StringPtrOutput { 718 return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.RestoreDateTime }).(pulumi.StringPtrOutput) 719 } 720 721 // Name of the table to restore. Must match the name of an existing table. 722 func (o TableOutput) RestoreSourceName() pulumi.StringPtrOutput { 723 return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.RestoreSourceName }).(pulumi.StringPtrOutput) 724 } 725 726 // If set, restores table to the most recent point-in-time recovery point. 727 func (o TableOutput) RestoreToLatestTime() pulumi.BoolPtrOutput { 728 return o.ApplyT(func(v *Table) pulumi.BoolPtrOutput { return v.RestoreToLatestTime }).(pulumi.BoolPtrOutput) 729 } 730 731 // 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. 732 func (o TableOutput) ServerSideEncryption() TableServerSideEncryptionOutput { 733 return o.ApplyT(func(v *Table) TableServerSideEncryptionOutput { return v.ServerSideEncryption }).(TableServerSideEncryptionOutput) 734 } 735 736 // ARN of the Table Stream. Only available when `streamEnabled = true` 737 func (o TableOutput) StreamArn() pulumi.StringOutput { 738 return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.StreamArn }).(pulumi.StringOutput) 739 } 740 741 // Whether Streams are enabled. 742 func (o TableOutput) StreamEnabled() pulumi.BoolPtrOutput { 743 return o.ApplyT(func(v *Table) pulumi.BoolPtrOutput { return v.StreamEnabled }).(pulumi.BoolPtrOutput) 744 } 745 746 // 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`. 747 func (o TableOutput) StreamLabel() pulumi.StringOutput { 748 return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.StreamLabel }).(pulumi.StringOutput) 749 } 750 751 // 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`. 752 func (o TableOutput) StreamViewType() pulumi.StringOutput { 753 return o.ApplyT(func(v *Table) pulumi.StringOutput { return v.StreamViewType }).(pulumi.StringOutput) 754 } 755 756 // Storage class of the table. 757 // Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. 758 // Default value is `STANDARD`. 759 func (o TableOutput) TableClass() pulumi.StringPtrOutput { 760 return o.ApplyT(func(v *Table) pulumi.StringPtrOutput { return v.TableClass }).(pulumi.StringPtrOutput) 761 } 762 763 // 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. 764 func (o TableOutput) Tags() pulumi.StringMapOutput { 765 return o.ApplyT(func(v *Table) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 766 } 767 768 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 769 // 770 // Deprecated: Please use `tags` instead. 771 func (o TableOutput) TagsAll() pulumi.StringMapOutput { 772 return o.ApplyT(func(v *Table) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 773 } 774 775 // Configuration block for TTL. See below. 776 func (o TableOutput) Ttl() TableTtlOutput { 777 return o.ApplyT(func(v *Table) TableTtlOutput { return v.Ttl }).(TableTtlOutput) 778 } 779 780 // Number of write units for this table. If the `billingMode` is `PROVISIONED`, this field is required. 781 func (o TableOutput) WriteCapacity() pulumi.IntOutput { 782 return o.ApplyT(func(v *Table) pulumi.IntOutput { return v.WriteCapacity }).(pulumi.IntOutput) 783 } 784 785 type TableArrayOutput struct{ *pulumi.OutputState } 786 787 func (TableArrayOutput) ElementType() reflect.Type { 788 return reflect.TypeOf((*[]*Table)(nil)).Elem() 789 } 790 791 func (o TableArrayOutput) ToTableArrayOutput() TableArrayOutput { 792 return o 793 } 794 795 func (o TableArrayOutput) ToTableArrayOutputWithContext(ctx context.Context) TableArrayOutput { 796 return o 797 } 798 799 func (o TableArrayOutput) Index(i pulumi.IntInput) TableOutput { 800 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Table { 801 return vs[0].([]*Table)[vs[1].(int)] 802 }).(TableOutput) 803 } 804 805 type TableMapOutput struct{ *pulumi.OutputState } 806 807 func (TableMapOutput) ElementType() reflect.Type { 808 return reflect.TypeOf((*map[string]*Table)(nil)).Elem() 809 } 810 811 func (o TableMapOutput) ToTableMapOutput() TableMapOutput { 812 return o 813 } 814 815 func (o TableMapOutput) ToTableMapOutputWithContext(ctx context.Context) TableMapOutput { 816 return o 817 } 818 819 func (o TableMapOutput) MapIndex(k pulumi.StringInput) TableOutput { 820 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Table { 821 return vs[0].(map[string]*Table)[vs[1].(string)] 822 }).(TableOutput) 823 } 824 825 func init() { 826 pulumi.RegisterInputType(reflect.TypeOf((*TableInput)(nil)).Elem(), &Table{}) 827 pulumi.RegisterInputType(reflect.TypeOf((*TableArrayInput)(nil)).Elem(), TableArray{}) 828 pulumi.RegisterInputType(reflect.TypeOf((*TableMapInput)(nil)).Elem(), TableMap{}) 829 pulumi.RegisterOutputType(TableOutput{}) 830 pulumi.RegisterOutputType(TableArrayOutput{}) 831 pulumi.RegisterOutputType(TableMapOutput{}) 832 }