repository_policies
Creates, updates, deletes, gets or lists a repository_policies resource.
Overview
| Name | repository_policies |
| Type | Resource |
| Id | aws.ecr_public.repository_policies |
Fields
The following fields are returned by SELECT queries:
- get_repository_policy
| Name | Datatype | Description |
|---|---|---|
policy_text | string | The repository policy text that's associated with the repository. The policy text will be in JSON format. |
registry_id | string | The registry ID that's associated with the request. (pattern: <code>[0-9]{12}</code>) |
repository_name | string | The repository name that's associated with the request. (pattern: <code>(?:[a-z0-9]+(?:[.-][a-z0-9]+)/)[a-z0-9]+(?:[.-][a-z0-9]+)*</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_repository_policy | select | region | Retrieves the repository policy for the specified repository. | |
set_repository_policy | update | region, repositoryName, policyText | Applies a repository policy to the specified public repository to control access permissions. For more information, see Amazon ECR Repository Policies in the Amazon Elastic Container Registry User Guide. | |
delete_repository_policy | delete | region | Deletes the repository policy that's associated with the specified repository. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_repository_policy
Retrieves the repository policy for the specified repository.
SELECT
policy_text,
registry_id,
repository_name
FROM aws.ecr_public.repository_policies
WHERE region = '{{ region }}' -- required
;
UPDATE examples
- set_repository_policy
Applies a repository policy to the specified public repository to control access permissions. For more information, see Amazon ECR Repository Policies in the Amazon Elastic Container Registry User Guide.
UPDATE aws.ecr_public.repository_policies
SET
registryId = '{{ registryId }}',
repositoryName = '{{ repositoryName }}',
policyText = '{{ policyText }}',
force = {{ force }}
WHERE
region = '{{ region }}' --required
AND repositoryName = '{{ repositoryName }}' --required
AND policyText = '{{ policyText }}' --required
RETURNING
policy_text,
registry_id,
repository_name;
DELETE examples
- delete_repository_policy
Deletes the repository policy that's associated with the specified repository.
DELETE FROM aws.ecr_public.repository_policies
WHERE region = '{{ region }}' --required
;