github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/dynamodb/tableReplica.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a DynamoDB table replica resource for [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html). 16 // 17 // > **Note:** Use `lifecycle` `ignoreChanges` for `replica` in the associated dynamodb.Table configuration. 18 // 19 // > **Note:** Do not use the `replica` configuration block of dynamodb.Table together with this resource as the two configuration options are mutually exclusive. 20 // 21 // ## Example Usage 22 // 23 // ### Basic Example 24 // 25 // <!--Start PulumiCodeChooser --> 26 // ```go 27 // package main 28 // 29 // import ( 30 // 31 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb" 32 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 33 // 34 // ) 35 // 36 // func main() { 37 // pulumi.Run(func(ctx *pulumi.Context) error { 38 // example, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{ 39 // Name: pulumi.String("TestTable"), 40 // HashKey: pulumi.String("BrodoBaggins"), 41 // BillingMode: pulumi.String("PAY_PER_REQUEST"), 42 // StreamEnabled: pulumi.Bool(true), 43 // StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"), 44 // Attributes: dynamodb.TableAttributeArray{ 45 // &dynamodb.TableAttributeArgs{ 46 // Name: pulumi.String("BrodoBaggins"), 47 // Type: pulumi.String("S"), 48 // }, 49 // }, 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // _, err = dynamodb.NewTableReplica(ctx, "example", &dynamodb.TableReplicaArgs{ 55 // GlobalTableArn: example.Arn, 56 // Tags: pulumi.StringMap{ 57 // "Name": pulumi.String("IZPAWS"), 58 // "Pozo": pulumi.String("Amargo"), 59 // }, 60 // }) 61 // if err != nil { 62 // return err 63 // } 64 // return nil 65 // }) 66 // } 67 // 68 // ``` 69 // <!--End PulumiCodeChooser --> 70 // 71 // ## Import 72 // 73 // Using `pulumi import`, import DynamoDB table replicas using the `table-name:main-region`. For example: 74 // 75 // ~> __Note:__ When importing, use the region where the initial or _main_ global table resides, _not_ the region of the replica. 76 // 77 // ```sh 78 // $ pulumi import aws:dynamodb/tableReplica:TableReplica example TestTable:us-west-2 79 // ``` 80 type TableReplica struct { 81 pulumi.CustomResourceState 82 83 // ARN of the table replica. 84 Arn pulumi.StringOutput `pulumi:"arn"` 85 // ARN of the _main_ or global table which this resource will replicate. 86 // 87 // Optional arguments: 88 GlobalTableArn pulumi.StringOutput `pulumi:"globalTableArn"` 89 // ARN of the CMK that should be used for the AWS KMS encryption. This argument should only be used if the key is different from the default KMS-managed DynamoDB key, `alias/aws/dynamodb`. **Note:** This attribute will _not_ be populated with the ARN of _default_ keys. 90 KmsKeyArn pulumi.StringOutput `pulumi:"kmsKeyArn"` 91 // Whether to enable Point In Time Recovery for the replica. Default is `false`. 92 PointInTimeRecovery pulumi.BoolPtrOutput `pulumi:"pointInTimeRecovery"` 93 // Storage class of the table replica. Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. If not used, the table replica will use the same class as the global table. 94 TableClassOverride pulumi.StringPtrOutput `pulumi:"tableClassOverride"` 95 // 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. 96 Tags pulumi.StringMapOutput `pulumi:"tags"` 97 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 98 // 99 // Deprecated: Please use `tags` instead. 100 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 101 } 102 103 // NewTableReplica registers a new resource with the given unique name, arguments, and options. 104 func NewTableReplica(ctx *pulumi.Context, 105 name string, args *TableReplicaArgs, opts ...pulumi.ResourceOption) (*TableReplica, error) { 106 if args == nil { 107 return nil, errors.New("missing one or more required arguments") 108 } 109 110 if args.GlobalTableArn == nil { 111 return nil, errors.New("invalid value for required argument 'GlobalTableArn'") 112 } 113 opts = internal.PkgResourceDefaultOpts(opts) 114 var resource TableReplica 115 err := ctx.RegisterResource("aws:dynamodb/tableReplica:TableReplica", name, args, &resource, opts...) 116 if err != nil { 117 return nil, err 118 } 119 return &resource, nil 120 } 121 122 // GetTableReplica gets an existing TableReplica resource's state with the given name, ID, and optional 123 // state properties that are used to uniquely qualify the lookup (nil if not required). 124 func GetTableReplica(ctx *pulumi.Context, 125 name string, id pulumi.IDInput, state *TableReplicaState, opts ...pulumi.ResourceOption) (*TableReplica, error) { 126 var resource TableReplica 127 err := ctx.ReadResource("aws:dynamodb/tableReplica:TableReplica", name, id, state, &resource, opts...) 128 if err != nil { 129 return nil, err 130 } 131 return &resource, nil 132 } 133 134 // Input properties used for looking up and filtering TableReplica resources. 135 type tableReplicaState struct { 136 // ARN of the table replica. 137 Arn *string `pulumi:"arn"` 138 // ARN of the _main_ or global table which this resource will replicate. 139 // 140 // Optional arguments: 141 GlobalTableArn *string `pulumi:"globalTableArn"` 142 // ARN of the CMK that should be used for the AWS KMS encryption. This argument should only be used if the key is different from the default KMS-managed DynamoDB key, `alias/aws/dynamodb`. **Note:** This attribute will _not_ be populated with the ARN of _default_ keys. 143 KmsKeyArn *string `pulumi:"kmsKeyArn"` 144 // Whether to enable Point In Time Recovery for the replica. Default is `false`. 145 PointInTimeRecovery *bool `pulumi:"pointInTimeRecovery"` 146 // Storage class of the table replica. Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. If not used, the table replica will use the same class as the global table. 147 TableClassOverride *string `pulumi:"tableClassOverride"` 148 // 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. 149 Tags map[string]string `pulumi:"tags"` 150 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 151 // 152 // Deprecated: Please use `tags` instead. 153 TagsAll map[string]string `pulumi:"tagsAll"` 154 } 155 156 type TableReplicaState struct { 157 // ARN of the table replica. 158 Arn pulumi.StringPtrInput 159 // ARN of the _main_ or global table which this resource will replicate. 160 // 161 // Optional arguments: 162 GlobalTableArn pulumi.StringPtrInput 163 // ARN of the CMK that should be used for the AWS KMS encryption. This argument should only be used if the key is different from the default KMS-managed DynamoDB key, `alias/aws/dynamodb`. **Note:** This attribute will _not_ be populated with the ARN of _default_ keys. 164 KmsKeyArn pulumi.StringPtrInput 165 // Whether to enable Point In Time Recovery for the replica. Default is `false`. 166 PointInTimeRecovery pulumi.BoolPtrInput 167 // Storage class of the table replica. Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. If not used, the table replica will use the same class as the global table. 168 TableClassOverride pulumi.StringPtrInput 169 // 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. 170 Tags pulumi.StringMapInput 171 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 172 // 173 // Deprecated: Please use `tags` instead. 174 TagsAll pulumi.StringMapInput 175 } 176 177 func (TableReplicaState) ElementType() reflect.Type { 178 return reflect.TypeOf((*tableReplicaState)(nil)).Elem() 179 } 180 181 type tableReplicaArgs struct { 182 // ARN of the _main_ or global table which this resource will replicate. 183 // 184 // Optional arguments: 185 GlobalTableArn string `pulumi:"globalTableArn"` 186 // ARN of the CMK that should be used for the AWS KMS encryption. This argument should only be used if the key is different from the default KMS-managed DynamoDB key, `alias/aws/dynamodb`. **Note:** This attribute will _not_ be populated with the ARN of _default_ keys. 187 KmsKeyArn *string `pulumi:"kmsKeyArn"` 188 // Whether to enable Point In Time Recovery for the replica. Default is `false`. 189 PointInTimeRecovery *bool `pulumi:"pointInTimeRecovery"` 190 // Storage class of the table replica. Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. If not used, the table replica will use the same class as the global table. 191 TableClassOverride *string `pulumi:"tableClassOverride"` 192 // 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. 193 Tags map[string]string `pulumi:"tags"` 194 } 195 196 // The set of arguments for constructing a TableReplica resource. 197 type TableReplicaArgs struct { 198 // ARN of the _main_ or global table which this resource will replicate. 199 // 200 // Optional arguments: 201 GlobalTableArn pulumi.StringInput 202 // ARN of the CMK that should be used for the AWS KMS encryption. This argument should only be used if the key is different from the default KMS-managed DynamoDB key, `alias/aws/dynamodb`. **Note:** This attribute will _not_ be populated with the ARN of _default_ keys. 203 KmsKeyArn pulumi.StringPtrInput 204 // Whether to enable Point In Time Recovery for the replica. Default is `false`. 205 PointInTimeRecovery pulumi.BoolPtrInput 206 // Storage class of the table replica. Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. If not used, the table replica will use the same class as the global table. 207 TableClassOverride pulumi.StringPtrInput 208 // 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. 209 Tags pulumi.StringMapInput 210 } 211 212 func (TableReplicaArgs) ElementType() reflect.Type { 213 return reflect.TypeOf((*tableReplicaArgs)(nil)).Elem() 214 } 215 216 type TableReplicaInput interface { 217 pulumi.Input 218 219 ToTableReplicaOutput() TableReplicaOutput 220 ToTableReplicaOutputWithContext(ctx context.Context) TableReplicaOutput 221 } 222 223 func (*TableReplica) ElementType() reflect.Type { 224 return reflect.TypeOf((**TableReplica)(nil)).Elem() 225 } 226 227 func (i *TableReplica) ToTableReplicaOutput() TableReplicaOutput { 228 return i.ToTableReplicaOutputWithContext(context.Background()) 229 } 230 231 func (i *TableReplica) ToTableReplicaOutputWithContext(ctx context.Context) TableReplicaOutput { 232 return pulumi.ToOutputWithContext(ctx, i).(TableReplicaOutput) 233 } 234 235 // TableReplicaArrayInput is an input type that accepts TableReplicaArray and TableReplicaArrayOutput values. 236 // You can construct a concrete instance of `TableReplicaArrayInput` via: 237 // 238 // TableReplicaArray{ TableReplicaArgs{...} } 239 type TableReplicaArrayInput interface { 240 pulumi.Input 241 242 ToTableReplicaArrayOutput() TableReplicaArrayOutput 243 ToTableReplicaArrayOutputWithContext(context.Context) TableReplicaArrayOutput 244 } 245 246 type TableReplicaArray []TableReplicaInput 247 248 func (TableReplicaArray) ElementType() reflect.Type { 249 return reflect.TypeOf((*[]*TableReplica)(nil)).Elem() 250 } 251 252 func (i TableReplicaArray) ToTableReplicaArrayOutput() TableReplicaArrayOutput { 253 return i.ToTableReplicaArrayOutputWithContext(context.Background()) 254 } 255 256 func (i TableReplicaArray) ToTableReplicaArrayOutputWithContext(ctx context.Context) TableReplicaArrayOutput { 257 return pulumi.ToOutputWithContext(ctx, i).(TableReplicaArrayOutput) 258 } 259 260 // TableReplicaMapInput is an input type that accepts TableReplicaMap and TableReplicaMapOutput values. 261 // You can construct a concrete instance of `TableReplicaMapInput` via: 262 // 263 // TableReplicaMap{ "key": TableReplicaArgs{...} } 264 type TableReplicaMapInput interface { 265 pulumi.Input 266 267 ToTableReplicaMapOutput() TableReplicaMapOutput 268 ToTableReplicaMapOutputWithContext(context.Context) TableReplicaMapOutput 269 } 270 271 type TableReplicaMap map[string]TableReplicaInput 272 273 func (TableReplicaMap) ElementType() reflect.Type { 274 return reflect.TypeOf((*map[string]*TableReplica)(nil)).Elem() 275 } 276 277 func (i TableReplicaMap) ToTableReplicaMapOutput() TableReplicaMapOutput { 278 return i.ToTableReplicaMapOutputWithContext(context.Background()) 279 } 280 281 func (i TableReplicaMap) ToTableReplicaMapOutputWithContext(ctx context.Context) TableReplicaMapOutput { 282 return pulumi.ToOutputWithContext(ctx, i).(TableReplicaMapOutput) 283 } 284 285 type TableReplicaOutput struct{ *pulumi.OutputState } 286 287 func (TableReplicaOutput) ElementType() reflect.Type { 288 return reflect.TypeOf((**TableReplica)(nil)).Elem() 289 } 290 291 func (o TableReplicaOutput) ToTableReplicaOutput() TableReplicaOutput { 292 return o 293 } 294 295 func (o TableReplicaOutput) ToTableReplicaOutputWithContext(ctx context.Context) TableReplicaOutput { 296 return o 297 } 298 299 // ARN of the table replica. 300 func (o TableReplicaOutput) Arn() pulumi.StringOutput { 301 return o.ApplyT(func(v *TableReplica) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 302 } 303 304 // ARN of the _main_ or global table which this resource will replicate. 305 // 306 // Optional arguments: 307 func (o TableReplicaOutput) GlobalTableArn() pulumi.StringOutput { 308 return o.ApplyT(func(v *TableReplica) pulumi.StringOutput { return v.GlobalTableArn }).(pulumi.StringOutput) 309 } 310 311 // ARN of the CMK that should be used for the AWS KMS encryption. This argument should only be used if the key is different from the default KMS-managed DynamoDB key, `alias/aws/dynamodb`. **Note:** This attribute will _not_ be populated with the ARN of _default_ keys. 312 func (o TableReplicaOutput) KmsKeyArn() pulumi.StringOutput { 313 return o.ApplyT(func(v *TableReplica) pulumi.StringOutput { return v.KmsKeyArn }).(pulumi.StringOutput) 314 } 315 316 // Whether to enable Point In Time Recovery for the replica. Default is `false`. 317 func (o TableReplicaOutput) PointInTimeRecovery() pulumi.BoolPtrOutput { 318 return o.ApplyT(func(v *TableReplica) pulumi.BoolPtrOutput { return v.PointInTimeRecovery }).(pulumi.BoolPtrOutput) 319 } 320 321 // Storage class of the table replica. Valid values are `STANDARD` and `STANDARD_INFREQUENT_ACCESS`. If not used, the table replica will use the same class as the global table. 322 func (o TableReplicaOutput) TableClassOverride() pulumi.StringPtrOutput { 323 return o.ApplyT(func(v *TableReplica) pulumi.StringPtrOutput { return v.TableClassOverride }).(pulumi.StringPtrOutput) 324 } 325 326 // 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. 327 func (o TableReplicaOutput) Tags() pulumi.StringMapOutput { 328 return o.ApplyT(func(v *TableReplica) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 329 } 330 331 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 332 // 333 // Deprecated: Please use `tags` instead. 334 func (o TableReplicaOutput) TagsAll() pulumi.StringMapOutput { 335 return o.ApplyT(func(v *TableReplica) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 336 } 337 338 type TableReplicaArrayOutput struct{ *pulumi.OutputState } 339 340 func (TableReplicaArrayOutput) ElementType() reflect.Type { 341 return reflect.TypeOf((*[]*TableReplica)(nil)).Elem() 342 } 343 344 func (o TableReplicaArrayOutput) ToTableReplicaArrayOutput() TableReplicaArrayOutput { 345 return o 346 } 347 348 func (o TableReplicaArrayOutput) ToTableReplicaArrayOutputWithContext(ctx context.Context) TableReplicaArrayOutput { 349 return o 350 } 351 352 func (o TableReplicaArrayOutput) Index(i pulumi.IntInput) TableReplicaOutput { 353 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TableReplica { 354 return vs[0].([]*TableReplica)[vs[1].(int)] 355 }).(TableReplicaOutput) 356 } 357 358 type TableReplicaMapOutput struct{ *pulumi.OutputState } 359 360 func (TableReplicaMapOutput) ElementType() reflect.Type { 361 return reflect.TypeOf((*map[string]*TableReplica)(nil)).Elem() 362 } 363 364 func (o TableReplicaMapOutput) ToTableReplicaMapOutput() TableReplicaMapOutput { 365 return o 366 } 367 368 func (o TableReplicaMapOutput) ToTableReplicaMapOutputWithContext(ctx context.Context) TableReplicaMapOutput { 369 return o 370 } 371 372 func (o TableReplicaMapOutput) MapIndex(k pulumi.StringInput) TableReplicaOutput { 373 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TableReplica { 374 return vs[0].(map[string]*TableReplica)[vs[1].(string)] 375 }).(TableReplicaOutput) 376 } 377 378 func init() { 379 pulumi.RegisterInputType(reflect.TypeOf((*TableReplicaInput)(nil)).Elem(), &TableReplica{}) 380 pulumi.RegisterInputType(reflect.TypeOf((*TableReplicaArrayInput)(nil)).Elem(), TableReplicaArray{}) 381 pulumi.RegisterInputType(reflect.TypeOf((*TableReplicaMapInput)(nil)).Elem(), TableReplicaMap{}) 382 pulumi.RegisterOutputType(TableReplicaOutput{}) 383 pulumi.RegisterOutputType(TableReplicaArrayOutput{}) 384 pulumi.RegisterOutputType(TableReplicaMapOutput{}) 385 }