Resource: aws_efs_replication_configuration

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.

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.

resource "aws_efs_file_system" "example" {}

resource "aws_efs_replication_configuration" "example" {
  source_file_system_id = aws_efs_file_system.example.id

  destination {
    region = "us-west-2"
  }
}

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

resource "aws_efs_file_system" "example" {}

resource "aws_efs_replication_configuration" "example" {
  source_file_system_id = aws_efs_file_system.example.id

  destination {
    availability_zone_name = "us-west-2b"
    kms_key_id             = "1234abcd-12ab-34cd-56ef-1234567890ab"
  }
}

Will create a replica and set the existing file system with id fs-1234567890 in us-west-2 as destination.

resource "aws_efs_file_system" "example" {}

resource "aws_efs_replication_configuration" "example" {
  source_file_system_id = aws_efs_file_system.example.id

  destination {
    file_system_id = "fs-1234567890"
    region         = "us-west-2"
  }
}

Argument Reference

This resource supports the following arguments:

Destination Arguments

destination supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to 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:

import {
  to = aws_efs_replication_configuration.example
  id = "fs-id"
}

Using terraform 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:

% terraform import aws_efs_replication_configuration.example fs-id