Show / Hide Table of Contents

Namespace Pulumi.Aws.Ecr

Classes

GetCredentials

GetCredentialsArgs

GetCredentialsResult

GetImage

GetImageArgs

GetImageResult

GetRepository

GetRepositoryArgs

GetRepositoryResult

LifecyclePolicy

Manages an ECR repository lifecycle policy.

NOTE: Only one aws.ecr.LifecyclePolicy resource can be used with the same ECR repository. To apply multiple rules, they must be combined in the policy JSON.

NOTE: The AWS ECR API seems to reorder rules based on rulePriority. If you define multiple rules that are not sorted in ascending rulePriority order in the this provider code, the resource will be flagged for recreation every deployment.

Example Usage

Policy on untagged image

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var foo = new Aws.Ecr.Repository("foo", new Aws.Ecr.RepositoryArgs
    {
    });
    var foopolicy = new Aws.Ecr.LifecyclePolicy("foopolicy", new Aws.Ecr.LifecyclePolicyArgs
    {
        Policy = @"{
""rules"": [
    {
        ""rulePriority"": 1,
        ""description"": ""Expire images older than 14 days"",
        ""selection"": {
            ""tagStatus"": ""untagged"",
            ""countType"": ""sinceImagePushed"",
            ""countUnit"": ""days"",
            ""countNumber"": 14
        },
        ""action"": {
            ""type"": ""expire""
        }
    }
]
}

",
        Repository = foo.Name,
    });
}

}

Policy on tagged image

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var foo = new Aws.Ecr.Repository("foo", new Aws.Ecr.RepositoryArgs
    {
    });
    var foopolicy = new Aws.Ecr.LifecyclePolicy("foopolicy", new Aws.Ecr.LifecyclePolicyArgs
    {
        Policy = @"{
""rules"": [
    {
        ""rulePriority"": 1,
        ""description"": ""Keep last 30 images"",
        ""selection"": {
            ""tagStatus"": ""tagged"",
            ""tagPrefixList"": [""v""],
            ""countType"": ""imageCountMoreThan"",
            ""countNumber"": 30
        },
        ""action"": {
            ""type"": ""expire""
        }
    }
]
}

",
        Repository = foo.Name,
    });
}

}

LifecyclePolicyArgs

LifecyclePolicyState

Repository

Provides an Elastic Container Registry Repository.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var foo = new Aws.Ecr.Repository("foo", new Aws.Ecr.RepositoryArgs
    {
        ImageScanningConfiguration = new Aws.Ecr.Inputs.RepositoryImageScanningConfigurationArgs
        {
            ScanOnPush = true,
        },
        ImageTagMutability = "MUTABLE",
    });
}

}

RepositoryArgs

RepositoryPolicy

Provides an Elastic Container Registry Repository Policy.

Note that currently only one policy may be applied to a repository.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var foo = new Aws.Ecr.Repository("foo", new Aws.Ecr.RepositoryArgs
    {
    });
    var foopolicy = new Aws.Ecr.RepositoryPolicy("foopolicy", new Aws.Ecr.RepositoryPolicyArgs
    {
        Policy = @"{
""Version"": ""2008-10-17"",
""Statement"": [
    {
        ""Sid"": ""new policy"",
        ""Effect"": ""Allow"",
        ""Principal"": ""*"",
        ""Action"": [
            ""ecr:GetDownloadUrlForLayer"",
            ""ecr:BatchGetImage"",
            ""ecr:BatchCheckLayerAvailability"",
            ""ecr:PutImage"",
            ""ecr:InitiateLayerUpload"",
            ""ecr:UploadLayerPart"",
            ""ecr:CompleteLayerUpload"",
            ""ecr:DescribeRepositories"",
            ""ecr:GetRepositoryPolicy"",
            ""ecr:ListImages"",
            ""ecr:DeleteRepository"",
            ""ecr:BatchDeleteImage"",
            ""ecr:SetRepositoryPolicy"",
            ""ecr:DeleteRepositoryPolicy""
        ]
    }
]
}

",
        Repository = foo.Name,
    });
}

}

RepositoryPolicyArgs

RepositoryPolicyState

RepositoryState

Back to top Copyright 2016-2020, Pulumi Corporation.