github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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 is not yet rolled out
    16  in all regions - available regions are listed
    17  [the AWS Docs](https://docs.aws.amazon.com/general/latest/gr/rande.html#ecr_region).
    18  
    19  ## Example Usage
    20  
    21  ```hcl
    22  resource "aws_ecr_repository" "foo" {
    23    name = "bar"
    24  }
    25  
    26  resource "aws_ecr_repository_policy" "foopolicy" {
    27    repository = "${aws_ecr_repository.foo.name}"
    28  
    29    policy = <<EOF
    30  {
    31      "Version": "2008-10-17",
    32      "Statement": [
    33          {
    34              "Sid": "new policy",
    35              "Effect": "Allow",
    36              "Principal": "*",
    37              "Action": [
    38                  "ecr:GetDownloadUrlForLayer",
    39                  "ecr:BatchGetImage",
    40                  "ecr:BatchCheckLayerAvailability",
    41                  "ecr:PutImage",
    42                  "ecr:InitiateLayerUpload",
    43                  "ecr:UploadLayerPart",
    44                  "ecr:CompleteLayerUpload",
    45                  "ecr:DescribeRepositories",
    46                  "ecr:GetRepositoryPolicy",
    47                  "ecr:ListImages",
    48                  "ecr:DeleteRepository",
    49                  "ecr:BatchDeleteImage",
    50                  "ecr:SetRepositoryPolicy",
    51                  "ecr:DeleteRepositoryPolicy"
    52              ]
    53          }
    54      ]
    55  }
    56  EOF
    57  }
    58  ```
    59  
    60  ## Argument Reference
    61  
    62  The following arguments are supported:
    63  
    64  * `repository` - (Required) Name of the repository to apply the policy.
    65  * `policy` - (Required) The policy document. This is a JSON formatted string.
    66  
    67  ## Attributes Reference
    68  
    69  The following attributes are exported:
    70  
    71  * `repository` - The name of the repository.
    72  * `registry_id` - The registry ID where the repository was created.