github.com/erriapo/terraform@v0.6.12-0.20160203182612-0340ea72354f/website/source/docs/providers/aws/r/ecr_repository_policy.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_ecr_repository_policy"
     4  sidebar_current: "docs-aws-resource-ecr-repository-policy"
     5  description: |-
     6    Provides an ECR Repository Policy.
     7  ---
     8  
     9  # aws\_ecr\_repository\_policy
    10  
    11  Provides an ECR repository policy.
    12  
    13  Note that currently only one policy may be applied to a repository.
    14  
    15  ~> **NOTE on ECR Availability**: The EC2 Container Registry has an [initial
    16  launch region of
    17  `us-east-1`](https://aws.amazon.com/blogs/aws/ec2-container-registry-now-generally-available/).
    18  As more regions become available, they will be listed [in the AWS
    19  Docs](https://docs.aws.amazon.com/general/latest/gr/rande.html#ecr_region)
    20  
    21  ## Example Usage
    22  
    23  ```
    24  resource "aws_ecr_repository" "foo" {
    25    name = "bar"
    26  }
    27  
    28  resource "aws_ecr_repository_policy" "foopolicy" {
    29    repository = "${aws_ecr_repository.foo.name}"
    30    policy = <<EOF
    31  {
    32      "Version": "2008-10-17",
    33      "Statement": [
    34          {
    35              "Sid": "new policy",
    36              "Effect": "Allow",
    37              "Principal": "*",
    38              "Action": [
    39                  "ecr:GetDownloadUrlForLayer",
    40                  "ecr:BatchGetImage",
    41                  "ecr:BatchCheckLayerAvailability",
    42                  "ecr:PutImage",
    43                  "ecr:InitiateLayerUpload",
    44                  "ecr:UploadLayerPart",
    45                  "ecr:CompleteLayerUpload",
    46                  "ecr:DescribeRepositories",
    47                  "ecr:GetRepositoryPolicy",
    48                  "ecr:ListImages",
    49                  "ecr:DeleteRepository",
    50                  "ecr:BatchDeleteImage",
    51                  "ecr:SetRepositoryPolicy",
    52                  "ecr:DeleteRepositoryPolicy"
    53              ]
    54          }
    55      ]
    56  }
    57  EOF
    58  }
    59  ```
    60  
    61  ## Argument Reference
    62  
    63  The following arguments are supported:
    64  
    65  * `repository` - (Required) Name of the repository to apply the policy.
    66  * `policy` - (Required) The policy document. This is a JSON formatted string.
    67  
    68  ## Attributes Reference
    69  
    70  The following attributes are exported:
    71  
    72  * `repository` - The name of the repository.
    73  * `registry_id` - The registry ID where the repository was created.