Skip to content

Resource: awsEcrReplicationConfiguration

Provides an Elastic Container Registry Replication Configuration.

Example Usage

/*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 dataAwsCallerIdentityCurrent =
  new aws.dataAwsCallerIdentity.DataAwsCallerIdentity(this, "current", {});
const dataAwsRegionsExample = new aws.dataAwsRegions.DataAwsRegions(
  this,
  "example",
  {}
);
const awsEcrReplicationConfigurationExample =
  new aws.ecrReplicationConfiguration.EcrReplicationConfiguration(
    this,
    "example_2",
    {
      replicationConfiguration: {
        rule: [
          {
            destination: [
              {
                region: `\${${dataAwsRegionsExample.names.fqn}[0]}`,
                registryId: dataAwsCallerIdentityCurrent.accountId,
              },
            ],
          },
        ],
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEcrReplicationConfigurationExample.overrideLogicalId("example");

Multiple Region Usage

/*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 dataAwsCallerIdentityCurrent =
  new aws.dataAwsCallerIdentity.DataAwsCallerIdentity(this, "current", {});
const dataAwsRegionsExample = new aws.dataAwsRegions.DataAwsRegions(
  this,
  "example",
  {}
);
const awsEcrReplicationConfigurationExample =
  new aws.ecrReplicationConfiguration.EcrReplicationConfiguration(
    this,
    "example_2",
    {
      replicationConfiguration: {
        rule: [
          {
            destination: [
              {
                region: `\${${dataAwsRegionsExample.names.fqn}[0]}`,
                registryId: dataAwsCallerIdentityCurrent.accountId,
              },
              {
                region: `\${${dataAwsRegionsExample.names.fqn}[1]}`,
                registryId: dataAwsCallerIdentityCurrent.accountId,
              },
            ],
          },
        ],
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEcrReplicationConfigurationExample.overrideLogicalId("example");

Repository Filter Usage

/*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 dataAwsCallerIdentityCurrent =
  new aws.dataAwsCallerIdentity.DataAwsCallerIdentity(this, "current", {});
const dataAwsRegionsExample = new aws.dataAwsRegions.DataAwsRegions(
  this,
  "example",
  {}
);
const awsEcrReplicationConfigurationExample =
  new aws.ecrReplicationConfiguration.EcrReplicationConfiguration(
    this,
    "example_2",
    {
      replicationConfiguration: {
        rule: [
          {
            destination: [
              {
                region: `\${${dataAwsRegionsExample.names.fqn}[0]}`,
                registryId: dataAwsCallerIdentityCurrent.accountId,
              },
            ],
            repositoryFilter: [
              {
                filter: "prod-microservice",
                filterType: "PREFIX_MATCH",
              },
            ],
          },
        ],
      },
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEcrReplicationConfigurationExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

Replication Configuration

  • rule - (Required) The replication rules for a replication configuration. A maximum of 10 are allowed per replicationConfiguration. See Rule

Rule

  • destination - (Required) the details of a replication destination. A maximum of 25 are allowed per rule. See Destination.
  • repositoryFilter - (Optional) filters for a replication rule. See Repository Filter.

Destination

  • region - (Required) A Region to replicate to.
  • registryId - (Required) The account ID of the destination registry to replicate to.

Repository Filter

  • filter - (Required) The repository filter details.
  • filterType - (Required) The repository filter type. The only supported value is PREFIX_MATCH, which is a repository name prefix specified with the filter parameter.

Attributes Reference

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

  • registryId - The registry ID where the replication configuration was created.

Import

ECR Replication Configuration can be imported using the registryId, e.g.,

$ terraform import aws_ecr_replication_configuration.service 012345678912