Skip to content

Resource: awsEfsReplicationConfiguration

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. Deleting this resource will cause the replication from source to destination to stop and the destination file system will no longer be read only.

\~> NOTE: Deleting this resource does not delete the destination file system that was created.

Example Usage

Will create a replica using regional storage in us-west-2 that will be encrypted by the default EFS KMS key /aws/elasticfilesystem.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsEfsFileSystemExample = new aws.efsFileSystem.EfsFileSystem(
  this,
  "example",
  {}
);
const awsEfsReplicationConfigurationExample =
  new aws.efsReplicationConfiguration.EfsReplicationConfiguration(
    this,
    "example_1",
    {
      destination: {
        region: "us-west-2",
      },
      sourceFileSystemId: awsEfsFileSystemExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEfsReplicationConfigurationExample.overrideLogicalId("example");

Replica will be created as One Zone storage in the us-west-2b Availability Zone and encrypted with the specified KMS key.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsEfsFileSystemExample = new aws.efsFileSystem.EfsFileSystem(
  this,
  "example",
  {}
);
const awsEfsReplicationConfigurationExample =
  new aws.efsReplicationConfiguration.EfsReplicationConfiguration(
    this,
    "example_1",
    {
      destination: {
        availabilityZoneName: "us-west-2b",
        kmsKeyId: "1234abcd-12ab-34cd-56ef-1234567890ab",
      },
      sourceFileSystemId: awsEfsFileSystemExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEfsReplicationConfigurationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • sourceFileSystemId - (Required) The ID of the file system that is to be replicated.
  • destination - (Required) A destination configuration block (documented below).

Destination Arguments

For destination the following attributes are supported:

  • availabilityZoneName - (Optional) The availability zone in which the replica should be created. If specified, the replica will be created with One Zone storage. If omitted, regional storage will be used.
  • kmsKeyId - (Optional) The Key ID, ARN, alias, or alias ARN of the KMS key that should be used to encrypt the replica file system. If omitted, the default KMS key for EFS /aws/elasticfilesystem will be used.
  • region - (Optional) The region in which the replica should be created.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • creationTime - When the replication configuration was created.
  • originalSourceFileSystemArn - The Amazon Resource Name (ARN) of the original source Amazon EFS file system in the replication configuration.
  • sourceFileSystemArn - The Amazon Resource Name (ARN) of the current source file system in the replication configuration.
  • sourceFileSystemRegion - The AWS Region in which the source Amazon EFS file system is located.
  • destination[0]FileSystemId - The fs ID of the replica.
  • destination[0]Status - The status of the replication.

Timeouts

Configuration options:

  • create - (Default 10M)
  • delete - (Default 20M)

Import

EFS Replication Configurations can be imported using the file system ID of either the source or destination file system. When importing, the availabilityZoneName and kmsKeyId 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.

$ terraform import aws_efs_replication_configuration.example fs-id