AWS Classic

v4.30.0 published on Tuesday, Nov 30, 2021 by Pulumi

ReplicationConfiguration

Provides an Elastic Container Registry Replication Configuration.

Multiple Region Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getCallerIdentity({});
const exampleRegions = aws.getRegions({});
const exampleReplicationConfiguration = new aws.ecr.ReplicationConfiguration("exampleReplicationConfiguration", {replicationConfiguration: {
    rule: {
        destinations: [
            {
                region: exampleRegions.then(exampleRegions => exampleRegions.names?[0]),
                registryId: current.then(current => current.accountId),
            },
            {
                region: exampleRegions.then(exampleRegions => exampleRegions.names?[1]),
                registryId: current.then(current => current.accountId),
            },
        ],
    },
}});
import pulumi
import pulumi_aws as aws

current = aws.get_caller_identity()
example_regions = aws.get_regions()
example_replication_configuration = aws.ecr.ReplicationConfiguration("exampleReplicationConfiguration", replication_configuration=aws.ecr.ReplicationConfigurationReplicationConfigurationArgs(
    rule=aws.ecr.ReplicationConfigurationReplicationConfigurationRuleArgs(
        destinations=[
            aws.ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs(
                region=example_regions.names[0],
                registry_id=current.account_id,
            ),
            aws.ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs(
                region=example_regions.names[1],
                registry_id=current.account_id,
            ),
        ],
    ),
))
using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var current = Output.Create(Aws.GetCallerIdentity.InvokeAsync());
        var exampleRegions = Output.Create(Aws.GetRegions.InvokeAsync());
        var exampleReplicationConfiguration = new Aws.Ecr.ReplicationConfiguration("exampleReplicationConfiguration", new Aws.Ecr.ReplicationConfigurationArgs
        {
            ReplicationConfiguration = new Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationArgs
            {
                Rule = new Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationRuleArgs
                {
                    Destinations = 
                    {
                        new Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs
                        {
                            Region = exampleRegions.Apply(exampleRegions => exampleRegions.Names?[0]),
                            RegistryId = current.Apply(current => current.AccountId),
                        },
                        new Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs
                        {
                            Region = exampleRegions.Apply(exampleRegions => exampleRegions.Names?[1]),
                            RegistryId = current.Apply(current => current.AccountId),
                        },
                    },
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ecr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetCallerIdentity(ctx, nil, nil)
		if err != nil {
			return err
		}
		exampleRegions, err := aws.GetRegions(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = ecr.NewReplicationConfiguration(ctx, "exampleReplicationConfiguration", &ecr.ReplicationConfigurationArgs{
			ReplicationConfiguration: &ecr.ReplicationConfigurationReplicationConfigurationArgs{
				Rule: &ecr.ReplicationConfigurationReplicationConfigurationRuleArgs{
					Destinations: ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArray{
						&ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs{
							Region:     pulumi.String(exampleRegions.Names[0]),
							RegistryId: pulumi.String(current.AccountId),
						},
						&ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs{
							Region:     pulumi.String(exampleRegions.Names[1]),
							RegistryId: pulumi.String(current.AccountId),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var current = Output.Create(Aws.GetCallerIdentity.InvokeAsync());
        var exampleRegions = Output.Create(Aws.GetRegions.InvokeAsync());
        var exampleReplicationConfiguration = new Aws.Ecr.ReplicationConfiguration("exampleReplicationConfiguration", new Aws.Ecr.ReplicationConfigurationArgs
        {
            ReplicationConfiguration = new Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationArgs
            {
                Rule = new Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationRuleArgs
                {
                    Destinations = 
                    {
                        new Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs
                        {
                            Region = exampleRegions.Apply(exampleRegions => exampleRegions.Names?[0]),
                            RegistryId = current.Apply(current => current.AccountId),
                        },
                    },
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ecr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetCallerIdentity(ctx, nil, nil)
		if err != nil {
			return err
		}
		exampleRegions, err := aws.GetRegions(ctx, nil, nil)
		if err != nil {
			return err
		}
		_, err = ecr.NewReplicationConfiguration(ctx, "exampleReplicationConfiguration", &ecr.ReplicationConfigurationArgs{
			ReplicationConfiguration: &ecr.ReplicationConfigurationReplicationConfigurationArgs{
				Rule: &ecr.ReplicationConfigurationReplicationConfigurationRuleArgs{
					Destinations: ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArray{
						&ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs{
							Region:     pulumi.String(exampleRegions.Names[0]),
							RegistryId: pulumi.String(current.AccountId),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

current = aws.get_caller_identity()
example_regions = aws.get_regions()
example_replication_configuration = aws.ecr.ReplicationConfiguration("exampleReplicationConfiguration", replication_configuration=aws.ecr.ReplicationConfigurationReplicationConfigurationArgs(
    rule=aws.ecr.ReplicationConfigurationReplicationConfigurationRuleArgs(
        destinations=[aws.ecr.ReplicationConfigurationReplicationConfigurationRuleDestinationArgs(
            region=example_regions.names[0],
            registry_id=current.account_id,
        )],
    ),
))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getCallerIdentity({});
const exampleRegions = aws.getRegions({});
const exampleReplicationConfiguration = new aws.ecr.ReplicationConfiguration("exampleReplicationConfiguration", {replicationConfiguration: {
    rule: {
        destinations: [{
            region: exampleRegions.then(exampleRegions => exampleRegions.names?[0]),
            registryId: current.then(current => current.accountId),
        }],
    },
}});

Create a ReplicationConfiguration Resource

new ReplicationConfiguration(name: string, args?: ReplicationConfigurationArgs, opts?: CustomResourceOptions);
@overload
def ReplicationConfiguration(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             replication_configuration: Optional[ReplicationConfigurationReplicationConfigurationArgs] = None)
@overload
def ReplicationConfiguration(resource_name: str,
                             args: Optional[ReplicationConfigurationArgs] = None,
                             opts: Optional[ResourceOptions] = None)
func NewReplicationConfiguration(ctx *Context, name string, args *ReplicationConfigurationArgs, opts ...ResourceOption) (*ReplicationConfiguration, error)
public ReplicationConfiguration(string name, ReplicationConfigurationArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ReplicationConfigurationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ReplicationConfigurationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ReplicationConfigurationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ReplicationConfigurationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ReplicationConfiguration Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ReplicationConfiguration resource accepts the following input properties:

ReplicationConfigurationDetails Pulumi.Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.
ReplicationConfiguration ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.
replicationConfiguration ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.
replication_configuration ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.

Outputs

All input properties are implicitly available as output properties. Additionally, the ReplicationConfiguration resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
RegistryId string
The account ID of the destination registry to replicate to.
Id string
The provider-assigned unique ID for this managed resource.
RegistryId string
The account ID of the destination registry to replicate to.
id string
The provider-assigned unique ID for this managed resource.
registryId string
The account ID of the destination registry to replicate to.
id str
The provider-assigned unique ID for this managed resource.
registry_id str
The account ID of the destination registry to replicate to.

Look up an Existing ReplicationConfiguration Resource

Get an existing ReplicationConfiguration resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ReplicationConfigurationState, opts?: CustomResourceOptions): ReplicationConfiguration
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        registry_id: Optional[str] = None,
        replication_configuration: Optional[ReplicationConfigurationReplicationConfigurationArgs] = None) -> ReplicationConfiguration
func GetReplicationConfiguration(ctx *Context, name string, id IDInput, state *ReplicationConfigurationState, opts ...ResourceOption) (*ReplicationConfiguration, error)
public static ReplicationConfiguration Get(string name, Input<string> id, ReplicationConfigurationState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

RegistryId string
The account ID of the destination registry to replicate to.
ReplicationConfigurationDetails Pulumi.Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.
RegistryId string
The account ID of the destination registry to replicate to.
ReplicationConfiguration ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.
registryId string
The account ID of the destination registry to replicate to.
replicationConfiguration ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.
registry_id str
The account ID of the destination registry to replicate to.
replication_configuration ReplicationConfigurationReplicationConfigurationArgs
Replication configuration for a registry. See Replication Configuration.

Supporting Types

ReplicationConfigurationReplicationConfiguration

Rule Pulumi.Aws.Ecr.Inputs.ReplicationConfigurationReplicationConfigurationRule
The replication rules for a replication configuration. See Rule.
Rule ReplicationConfigurationReplicationConfigurationRule
The replication rules for a replication configuration. See Rule.
rule ReplicationConfigurationReplicationConfigurationRule
The replication rules for a replication configuration. See Rule.
rule ReplicationConfigurationReplicationConfigurationRule
The replication rules for a replication configuration. See Rule.

ReplicationConfigurationReplicationConfigurationRule

Destinations []ReplicationConfigurationReplicationConfigurationRuleDestination
the details of a replication destination. See Destination.
destinations ReplicationConfigurationReplicationConfigurationRuleDestination[]
the details of a replication destination. See Destination.
destinations Sequence[ReplicationConfigurationReplicationConfigurationRuleDestination]
the details of a replication destination. See Destination.

ReplicationConfigurationReplicationConfigurationRuleDestination

Region string
A Region to replicate to.
RegistryId string
The account ID of the destination registry to replicate to.
Region string
A Region to replicate to.
RegistryId string
The account ID of the destination registry to replicate to.
region string
A Region to replicate to.
registryId string
The account ID of the destination registry to replicate to.
region str
A Region to replicate to.
registry_id str
The account ID of the destination registry to replicate to.

Import

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

 $ pulumi import aws:ecr/replicationConfiguration:ReplicationConfiguration service 012345678912

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.