github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/efs/replicationConfiguration.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 efs 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 // Creates a replica of an existing EFS file system in the same or another region. Creating this resource causes the source EFS file system to be replicated to a new read-only destination EFS file system (unless using the `destination.file_system_id` attribute). Deleting this resource will cause the replication from source to destination to stop and the destination file system will no longer be read only. 16 // 17 // > **NOTE:** Deleting this resource does **not** delete the destination file system that was created. 18 // 19 // ## Example Usage 20 // 21 // Will create a replica using regional storage in us-west-2 that will be encrypted by the default EFS KMS key `/aws/elasticfilesystem`. 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/efs" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // example, err := efs.NewFileSystem(ctx, "example", nil) 37 // if err != nil { 38 // return err 39 // } 40 // _, err = efs.NewReplicationConfiguration(ctx, "example", &efs.ReplicationConfigurationArgs{ 41 // SourceFileSystemId: example.ID(), 42 // Destination: &efs.ReplicationConfigurationDestinationArgs{ 43 // Region: pulumi.String("us-west-2"), 44 // }, 45 // }) 46 // if err != nil { 47 // return err 48 // } 49 // return nil 50 // }) 51 // } 52 // 53 // ``` 54 // <!--End PulumiCodeChooser --> 55 // 56 // Replica will be created as One Zone storage in the us-west-2b Availability Zone and encrypted with the specified KMS key. 57 // 58 // <!--Start PulumiCodeChooser --> 59 // ```go 60 // package main 61 // 62 // import ( 63 // 64 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/efs" 65 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 66 // 67 // ) 68 // 69 // func main() { 70 // pulumi.Run(func(ctx *pulumi.Context) error { 71 // example, err := efs.NewFileSystem(ctx, "example", nil) 72 // if err != nil { 73 // return err 74 // } 75 // _, err = efs.NewReplicationConfiguration(ctx, "example", &efs.ReplicationConfigurationArgs{ 76 // SourceFileSystemId: example.ID(), 77 // Destination: &efs.ReplicationConfigurationDestinationArgs{ 78 // AvailabilityZoneName: pulumi.String("us-west-2b"), 79 // KmsKeyId: pulumi.String("1234abcd-12ab-34cd-56ef-1234567890ab"), 80 // }, 81 // }) 82 // if err != nil { 83 // return err 84 // } 85 // return nil 86 // }) 87 // } 88 // 89 // ``` 90 // <!--End PulumiCodeChooser --> 91 // 92 // Will create a replica and set the existing file system with id `fs-1234567890` in us-west-2 as destination. 93 // 94 // <!--Start PulumiCodeChooser --> 95 // ```go 96 // package main 97 // 98 // import ( 99 // 100 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/efs" 101 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 102 // 103 // ) 104 // 105 // func main() { 106 // pulumi.Run(func(ctx *pulumi.Context) error { 107 // example, err := efs.NewFileSystem(ctx, "example", nil) 108 // if err != nil { 109 // return err 110 // } 111 // _, err = efs.NewReplicationConfiguration(ctx, "example", &efs.ReplicationConfigurationArgs{ 112 // SourceFileSystemId: example.ID(), 113 // Destination: &efs.ReplicationConfigurationDestinationArgs{ 114 // FileSystemId: pulumi.String("fs-1234567890"), 115 // Region: pulumi.String("us-west-2"), 116 // }, 117 // }) 118 // if err != nil { 119 // return err 120 // } 121 // return nil 122 // }) 123 // } 124 // 125 // ``` 126 // <!--End PulumiCodeChooser --> 127 // 128 // ## Import 129 // 130 // Using `pulumi import`, import EFS Replication Configurations using the file system ID of either the source or destination file system. When importing, the `availability_zone_name` and `kms_key_id` attributes must __not__ be set in the configuration. The AWS API does not return these values when querying the replication configuration and their presence will therefore show as a diff in a subsequent plan. For example: 131 // 132 // ```sh 133 // $ pulumi import aws:efs/replicationConfiguration:ReplicationConfiguration example fs-id 134 // ``` 135 type ReplicationConfiguration struct { 136 pulumi.CustomResourceState 137 138 // When the replication configuration was created. 139 CreationTime pulumi.StringOutput `pulumi:"creationTime"` 140 // A destination configuration block (documented below). 141 Destination ReplicationConfigurationDestinationOutput `pulumi:"destination"` 142 // The Amazon Resource Name (ARN) of the original source Amazon EFS file system in the replication configuration. 143 OriginalSourceFileSystemArn pulumi.StringOutput `pulumi:"originalSourceFileSystemArn"` 144 // The Amazon Resource Name (ARN) of the current source file system in the replication configuration. 145 SourceFileSystemArn pulumi.StringOutput `pulumi:"sourceFileSystemArn"` 146 // The ID of the file system that is to be replicated. 147 SourceFileSystemId pulumi.StringOutput `pulumi:"sourceFileSystemId"` 148 // The AWS Region in which the source Amazon EFS file system is located. 149 SourceFileSystemRegion pulumi.StringOutput `pulumi:"sourceFileSystemRegion"` 150 } 151 152 // NewReplicationConfiguration registers a new resource with the given unique name, arguments, and options. 153 func NewReplicationConfiguration(ctx *pulumi.Context, 154 name string, args *ReplicationConfigurationArgs, opts ...pulumi.ResourceOption) (*ReplicationConfiguration, error) { 155 if args == nil { 156 return nil, errors.New("missing one or more required arguments") 157 } 158 159 if args.Destination == nil { 160 return nil, errors.New("invalid value for required argument 'Destination'") 161 } 162 if args.SourceFileSystemId == nil { 163 return nil, errors.New("invalid value for required argument 'SourceFileSystemId'") 164 } 165 opts = internal.PkgResourceDefaultOpts(opts) 166 var resource ReplicationConfiguration 167 err := ctx.RegisterResource("aws:efs/replicationConfiguration:ReplicationConfiguration", name, args, &resource, opts...) 168 if err != nil { 169 return nil, err 170 } 171 return &resource, nil 172 } 173 174 // GetReplicationConfiguration gets an existing ReplicationConfiguration resource's state with the given name, ID, and optional 175 // state properties that are used to uniquely qualify the lookup (nil if not required). 176 func GetReplicationConfiguration(ctx *pulumi.Context, 177 name string, id pulumi.IDInput, state *ReplicationConfigurationState, opts ...pulumi.ResourceOption) (*ReplicationConfiguration, error) { 178 var resource ReplicationConfiguration 179 err := ctx.ReadResource("aws:efs/replicationConfiguration:ReplicationConfiguration", name, id, state, &resource, opts...) 180 if err != nil { 181 return nil, err 182 } 183 return &resource, nil 184 } 185 186 // Input properties used for looking up and filtering ReplicationConfiguration resources. 187 type replicationConfigurationState struct { 188 // When the replication configuration was created. 189 CreationTime *string `pulumi:"creationTime"` 190 // A destination configuration block (documented below). 191 Destination *ReplicationConfigurationDestination `pulumi:"destination"` 192 // The Amazon Resource Name (ARN) of the original source Amazon EFS file system in the replication configuration. 193 OriginalSourceFileSystemArn *string `pulumi:"originalSourceFileSystemArn"` 194 // The Amazon Resource Name (ARN) of the current source file system in the replication configuration. 195 SourceFileSystemArn *string `pulumi:"sourceFileSystemArn"` 196 // The ID of the file system that is to be replicated. 197 SourceFileSystemId *string `pulumi:"sourceFileSystemId"` 198 // The AWS Region in which the source Amazon EFS file system is located. 199 SourceFileSystemRegion *string `pulumi:"sourceFileSystemRegion"` 200 } 201 202 type ReplicationConfigurationState struct { 203 // When the replication configuration was created. 204 CreationTime pulumi.StringPtrInput 205 // A destination configuration block (documented below). 206 Destination ReplicationConfigurationDestinationPtrInput 207 // The Amazon Resource Name (ARN) of the original source Amazon EFS file system in the replication configuration. 208 OriginalSourceFileSystemArn pulumi.StringPtrInput 209 // The Amazon Resource Name (ARN) of the current source file system in the replication configuration. 210 SourceFileSystemArn pulumi.StringPtrInput 211 // The ID of the file system that is to be replicated. 212 SourceFileSystemId pulumi.StringPtrInput 213 // The AWS Region in which the source Amazon EFS file system is located. 214 SourceFileSystemRegion pulumi.StringPtrInput 215 } 216 217 func (ReplicationConfigurationState) ElementType() reflect.Type { 218 return reflect.TypeOf((*replicationConfigurationState)(nil)).Elem() 219 } 220 221 type replicationConfigurationArgs struct { 222 // A destination configuration block (documented below). 223 Destination ReplicationConfigurationDestination `pulumi:"destination"` 224 // The ID of the file system that is to be replicated. 225 SourceFileSystemId string `pulumi:"sourceFileSystemId"` 226 } 227 228 // The set of arguments for constructing a ReplicationConfiguration resource. 229 type ReplicationConfigurationArgs struct { 230 // A destination configuration block (documented below). 231 Destination ReplicationConfigurationDestinationInput 232 // The ID of the file system that is to be replicated. 233 SourceFileSystemId pulumi.StringInput 234 } 235 236 func (ReplicationConfigurationArgs) ElementType() reflect.Type { 237 return reflect.TypeOf((*replicationConfigurationArgs)(nil)).Elem() 238 } 239 240 type ReplicationConfigurationInput interface { 241 pulumi.Input 242 243 ToReplicationConfigurationOutput() ReplicationConfigurationOutput 244 ToReplicationConfigurationOutputWithContext(ctx context.Context) ReplicationConfigurationOutput 245 } 246 247 func (*ReplicationConfiguration) ElementType() reflect.Type { 248 return reflect.TypeOf((**ReplicationConfiguration)(nil)).Elem() 249 } 250 251 func (i *ReplicationConfiguration) ToReplicationConfigurationOutput() ReplicationConfigurationOutput { 252 return i.ToReplicationConfigurationOutputWithContext(context.Background()) 253 } 254 255 func (i *ReplicationConfiguration) ToReplicationConfigurationOutputWithContext(ctx context.Context) ReplicationConfigurationOutput { 256 return pulumi.ToOutputWithContext(ctx, i).(ReplicationConfigurationOutput) 257 } 258 259 // ReplicationConfigurationArrayInput is an input type that accepts ReplicationConfigurationArray and ReplicationConfigurationArrayOutput values. 260 // You can construct a concrete instance of `ReplicationConfigurationArrayInput` via: 261 // 262 // ReplicationConfigurationArray{ ReplicationConfigurationArgs{...} } 263 type ReplicationConfigurationArrayInput interface { 264 pulumi.Input 265 266 ToReplicationConfigurationArrayOutput() ReplicationConfigurationArrayOutput 267 ToReplicationConfigurationArrayOutputWithContext(context.Context) ReplicationConfigurationArrayOutput 268 } 269 270 type ReplicationConfigurationArray []ReplicationConfigurationInput 271 272 func (ReplicationConfigurationArray) ElementType() reflect.Type { 273 return reflect.TypeOf((*[]*ReplicationConfiguration)(nil)).Elem() 274 } 275 276 func (i ReplicationConfigurationArray) ToReplicationConfigurationArrayOutput() ReplicationConfigurationArrayOutput { 277 return i.ToReplicationConfigurationArrayOutputWithContext(context.Background()) 278 } 279 280 func (i ReplicationConfigurationArray) ToReplicationConfigurationArrayOutputWithContext(ctx context.Context) ReplicationConfigurationArrayOutput { 281 return pulumi.ToOutputWithContext(ctx, i).(ReplicationConfigurationArrayOutput) 282 } 283 284 // ReplicationConfigurationMapInput is an input type that accepts ReplicationConfigurationMap and ReplicationConfigurationMapOutput values. 285 // You can construct a concrete instance of `ReplicationConfigurationMapInput` via: 286 // 287 // ReplicationConfigurationMap{ "key": ReplicationConfigurationArgs{...} } 288 type ReplicationConfigurationMapInput interface { 289 pulumi.Input 290 291 ToReplicationConfigurationMapOutput() ReplicationConfigurationMapOutput 292 ToReplicationConfigurationMapOutputWithContext(context.Context) ReplicationConfigurationMapOutput 293 } 294 295 type ReplicationConfigurationMap map[string]ReplicationConfigurationInput 296 297 func (ReplicationConfigurationMap) ElementType() reflect.Type { 298 return reflect.TypeOf((*map[string]*ReplicationConfiguration)(nil)).Elem() 299 } 300 301 func (i ReplicationConfigurationMap) ToReplicationConfigurationMapOutput() ReplicationConfigurationMapOutput { 302 return i.ToReplicationConfigurationMapOutputWithContext(context.Background()) 303 } 304 305 func (i ReplicationConfigurationMap) ToReplicationConfigurationMapOutputWithContext(ctx context.Context) ReplicationConfigurationMapOutput { 306 return pulumi.ToOutputWithContext(ctx, i).(ReplicationConfigurationMapOutput) 307 } 308 309 type ReplicationConfigurationOutput struct{ *pulumi.OutputState } 310 311 func (ReplicationConfigurationOutput) ElementType() reflect.Type { 312 return reflect.TypeOf((**ReplicationConfiguration)(nil)).Elem() 313 } 314 315 func (o ReplicationConfigurationOutput) ToReplicationConfigurationOutput() ReplicationConfigurationOutput { 316 return o 317 } 318 319 func (o ReplicationConfigurationOutput) ToReplicationConfigurationOutputWithContext(ctx context.Context) ReplicationConfigurationOutput { 320 return o 321 } 322 323 // When the replication configuration was created. 324 func (o ReplicationConfigurationOutput) CreationTime() pulumi.StringOutput { 325 return o.ApplyT(func(v *ReplicationConfiguration) pulumi.StringOutput { return v.CreationTime }).(pulumi.StringOutput) 326 } 327 328 // A destination configuration block (documented below). 329 func (o ReplicationConfigurationOutput) Destination() ReplicationConfigurationDestinationOutput { 330 return o.ApplyT(func(v *ReplicationConfiguration) ReplicationConfigurationDestinationOutput { return v.Destination }).(ReplicationConfigurationDestinationOutput) 331 } 332 333 // The Amazon Resource Name (ARN) of the original source Amazon EFS file system in the replication configuration. 334 func (o ReplicationConfigurationOutput) OriginalSourceFileSystemArn() pulumi.StringOutput { 335 return o.ApplyT(func(v *ReplicationConfiguration) pulumi.StringOutput { return v.OriginalSourceFileSystemArn }).(pulumi.StringOutput) 336 } 337 338 // The Amazon Resource Name (ARN) of the current source file system in the replication configuration. 339 func (o ReplicationConfigurationOutput) SourceFileSystemArn() pulumi.StringOutput { 340 return o.ApplyT(func(v *ReplicationConfiguration) pulumi.StringOutput { return v.SourceFileSystemArn }).(pulumi.StringOutput) 341 } 342 343 // The ID of the file system that is to be replicated. 344 func (o ReplicationConfigurationOutput) SourceFileSystemId() pulumi.StringOutput { 345 return o.ApplyT(func(v *ReplicationConfiguration) pulumi.StringOutput { return v.SourceFileSystemId }).(pulumi.StringOutput) 346 } 347 348 // The AWS Region in which the source Amazon EFS file system is located. 349 func (o ReplicationConfigurationOutput) SourceFileSystemRegion() pulumi.StringOutput { 350 return o.ApplyT(func(v *ReplicationConfiguration) pulumi.StringOutput { return v.SourceFileSystemRegion }).(pulumi.StringOutput) 351 } 352 353 type ReplicationConfigurationArrayOutput struct{ *pulumi.OutputState } 354 355 func (ReplicationConfigurationArrayOutput) ElementType() reflect.Type { 356 return reflect.TypeOf((*[]*ReplicationConfiguration)(nil)).Elem() 357 } 358 359 func (o ReplicationConfigurationArrayOutput) ToReplicationConfigurationArrayOutput() ReplicationConfigurationArrayOutput { 360 return o 361 } 362 363 func (o ReplicationConfigurationArrayOutput) ToReplicationConfigurationArrayOutputWithContext(ctx context.Context) ReplicationConfigurationArrayOutput { 364 return o 365 } 366 367 func (o ReplicationConfigurationArrayOutput) Index(i pulumi.IntInput) ReplicationConfigurationOutput { 368 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ReplicationConfiguration { 369 return vs[0].([]*ReplicationConfiguration)[vs[1].(int)] 370 }).(ReplicationConfigurationOutput) 371 } 372 373 type ReplicationConfigurationMapOutput struct{ *pulumi.OutputState } 374 375 func (ReplicationConfigurationMapOutput) ElementType() reflect.Type { 376 return reflect.TypeOf((*map[string]*ReplicationConfiguration)(nil)).Elem() 377 } 378 379 func (o ReplicationConfigurationMapOutput) ToReplicationConfigurationMapOutput() ReplicationConfigurationMapOutput { 380 return o 381 } 382 383 func (o ReplicationConfigurationMapOutput) ToReplicationConfigurationMapOutputWithContext(ctx context.Context) ReplicationConfigurationMapOutput { 384 return o 385 } 386 387 func (o ReplicationConfigurationMapOutput) MapIndex(k pulumi.StringInput) ReplicationConfigurationOutput { 388 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ReplicationConfiguration { 389 return vs[0].(map[string]*ReplicationConfiguration)[vs[1].(string)] 390 }).(ReplicationConfigurationOutput) 391 } 392 393 func init() { 394 pulumi.RegisterInputType(reflect.TypeOf((*ReplicationConfigurationInput)(nil)).Elem(), &ReplicationConfiguration{}) 395 pulumi.RegisterInputType(reflect.TypeOf((*ReplicationConfigurationArrayInput)(nil)).Elem(), ReplicationConfigurationArray{}) 396 pulumi.RegisterInputType(reflect.TypeOf((*ReplicationConfigurationMapInput)(nil)).Elem(), ReplicationConfigurationMap{}) 397 pulumi.RegisterOutputType(ReplicationConfigurationOutput{}) 398 pulumi.RegisterOutputType(ReplicationConfigurationArrayOutput{}) 399 pulumi.RegisterOutputType(ReplicationConfigurationMapOutput{}) 400 }