Resource

dcloud_ecr_pull_through_cache_rule

Mirror a public registry under a prefix: docker pull <org>.ecr.<domain>/<prefix>/<name>:<tag> fetches the image from the upstream on first pull and serves it from your registry after that. Destroying the rule keeps what was cached.

Example Usage

# docker pull <org>.ecr.<domain>/dockerhub/node:22 — from Docker Hub once, from your registry after.
resource "dcloud_ecr_pull_through_cache_rule" "dockerhub" {
  prefix            = "dockerhub"
  upstream_registry = "docker.io"

  # Optional: a Docker Hub login raises the anonymous pull limit.
  username           = "my-dockerhub-user"
  password_secret_id = dcloud_secret.dockerhub_token.id
}

resource "dcloud_ecr_pull_through_cache_rule" "ghcr" {
  prefix            = "ghcr"
  upstream_registry = "ghcr.io"
}

Schema

Required

  • prefix (String) First path component(s) of the cached repositories, e.g. dockerhub. Changing it replaces the resource.
  • upstream_registry (String) docker.io, ghcr.io, quay.io, registry.k8s.io, public.ecr.aws or mcr.microsoft.com. One of: docker.io, ghcr.io, quay.io, registry.k8s.io, public.ecr.aws, mcr.microsoft.com. Changing it replaces the resource.

Optional

  • password_secret_id (String) An dcloud_secret (granted to the registry consumer) holding the upstream password or token.
  • username (String) Upstream login user, with password_secret_id.

Read-Only

  • id (String) The resource's id.
  • repositories (Number) Repositories this rule has filled.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dcloud_ecr_pull_through_cache_rule.dockerhub <rule-id>

Generated from the provider's schema.