Skip to content

entrepot_routing_rule

A routing rule limits which requests a proxy repository forwards upstream (set it with proxy.routing_rule on an entrepot_repository). Use it to stop internal package names from ever being fetched from a public registry (dependency confusion), or to allow only an approved set.

A rule cannot be deleted while proxy repositories use it; when repositories reference the rule resource, Terraform updates them first.

# Never fetch internal package names from the public registry
# (dependency-confusion protection).
resource "entrepot_routing_rule" "no_internal_upstream" {
name = "no-internal-upstream"
description = "Internal scopes are only served from hosted repositories"
mode = "block"
matchers = ["^@acme/", "^acme-"]
}
resource "entrepot_repository" "npmjs" {
name = "npmjs"
format = "npm"
kind = "proxy"
blob_store = "default"
proxy = {
remote_url = "https://registry.npmjs.org"
routing_rule = entrepot_routing_rule.no_internal_upstream.name
}
}
  • matchers (List of String) Go regular expressions over the package / image name or request path, e.g. ^@acme/ or ^acme-. The first matching expression decides.
  • mode (String) allow: only requests matching a matcher go upstream; block: matching requests never go upstream.
  • name (String) Rule name. Changing it forces a new rule.
  • description (String) Free-form description.
  • id (String) Same as name.
  • repositories (List of String) Proxy repositories that currently use the rule (informational). It changes when repositories are configured and is refreshed on every read; it never causes a diff.

The terraform import command can be used, for example:

Terminal window
# Routing rules are imported by name.
terraform import entrepot_routing_rule.no_internal_upstream no-internal-upstream

Resource documentation generated from the provider’s schema (docs/resources/routing_rule.md in terraform-provider-entrepot).