Tips & behaviour
Immutable fields force replacement
Section titled “Immutable fields force replacement”A repository’s name, format, kind and blob_store, and a blob store’s
name and type, can’t be changed through the API. Changing them in
Terraform replaces the object — and replacing a repository deletes its
content. Protect important repositories:
resource "entrepot_repository" "npm_internal" { name = "npm-internal" format = "npm" kind = "hosted" blob_store = "default"
lifecycle { prevent_destroy = true }}Role bindings are immutable as a whole: changing any attribute creates a new binding and deletes the old one.
Write-only secrets don’t drift
Section titled “Write-only secrets don’t drift”Proxy passwords, S3 secret keys, scanner tokens and secrets, and imported signing keys are never returned by the API. The provider keeps the value from your configuration in state, so:
- a change you make in Terraform is applied;
- a change made outside Terraform (in the UI, with curl) is not detected. To force a re-send, change the value or taint the resource;
- after
terraform import, these attributes are empty until the next apply sets them.
Signing keys are the exception that helps: entrepot_repository_signing_key
detects out-of-band rotation through the key’s fingerprint.
Tokens live in state
Section titled “Tokens live in state”entrepot_service_account_token.secret is only known when the token is
created and is stored (sensitive) in the state. Use an encrypted remote
backend, mark outputs sensitive = true, and prefer passing the secret
straight to another provider (a CI secret, a Kubernetes Secret, a vault)
over printing it. Rotating a token means replacing the resource
(terraform apply -replace=…).
Import
Section titled “Import”Every resource can be imported. Most use the object’s name; role bindings, waivers and service-account tokens use server-assigned IDs:
terraform import entrepot_repository.npm_internal npm-internalterraform import entrepot_role_binding.ci_npm 3f2b8f1e-6a0c-4f43-9f57-2d7f4b1c9e10Each reference page shows the exact import syntax. Find IDs with the API
(GET /api/v1/role-bindings, GET /api/v1/waivers) or the UI. With
Terraform ≥ 1.5 you can also use import blocks.
Out-of-band changes and deletions
Section titled “Out-of-band changes and deletions”Mutable settings changed outside Terraform show up as drift on the next plan and are put back. Objects deleted outside Terraform are recreated.
Ordering
Section titled “Ordering”Reference other resources by attribute (entrepot_routing_rule.x.name,
entrepot_scanner.trivy.name, entrepot_service_account.ci.username) rather
than by literal name, so Terraform creates rules, scanners and policies
before the repositories that use them, and deletes them after. The server
refuses to delete a blob store, scanner, cleanup policy or routing rule that
is still in use (409).
Server-side defaults
Section titled “Server-side defaults”Optional settings left unset use the server defaults (for example
hosted.allow_redeploy is false, or true for Docker; scan.mode is
warn; group.prefer_hosted is true). Attributes marked computed in the
reference show the server’s value after apply.