resource_remote: add mirrorlist attribute (rpm/deb/apk remotes) #18

Merged
benvin merged 2 commits from benvin/mirrorlist into main 2026-08-13 17:24:59 +10:00
Member

Why

The artifactapi remotes API now accepts a mirrorlist (extra upstream mirror base URLs) on remote rpm/deb/apk repos, load-balancing base_url + mirrorlist with failover. This provider exposes it so users can set it from Terraform. PR (c) of the mirrorlist feature.

How

  • Add an optional mirrorlist list attribute to the remote resource schema and the artifactapi_remote data source (read-only).
  • Wire end-to-end: TF model field, wire model (json:"mirrorlist,omitempty"), modelToAPI/apiToModel, and preserveListNullEmptySemantics (via reconcileOptionalLists) so null/empty distinction is kept and there is no perpetual diff.
  • Scope to rpm/deb/alpine: the remote is a single shared factory (one struct + one schema + one model), so schema-level scoping would break the framework's strict struct↔schema matching for other types. Instead a ValidateConfig implementation raises a plan-time error if mirrorlist is set on any non-rpm/deb/alpine remote; the API's 400 is the backstop.
  • Docs (README + rpm example) and unit tests (round-trip, null handling, and the type-scoping validation for allowed/rejected/null cases).

Optional and back-compat: omitting mirrorlist is unchanged. Version bump/release intentionally deferred.

## Why The artifactapi remotes API now accepts a `mirrorlist` (extra upstream mirror base URLs) on remote rpm/deb/apk repos, load-balancing `base_url` + `mirrorlist` with failover. This provider exposes it so users can set it from Terraform. PR (c) of the mirrorlist feature. ## How - Add an optional `mirrorlist` list attribute to the remote resource schema and the `artifactapi_remote` data source (read-only). - Wire end-to-end: TF model field, wire model (`json:"mirrorlist,omitempty"`), `modelToAPI`/`apiToModel`, and `preserveListNullEmptySemantics` (via `reconcileOptionalLists`) so null/empty distinction is kept and there is no perpetual diff. - Scope to rpm/deb/alpine: the remote is a single shared factory (one struct + one schema + one model), so schema-level scoping would break the framework's strict struct↔schema matching for other types. Instead a `ValidateConfig` implementation raises a plan-time error if `mirrorlist` is set on any non-rpm/deb/alpine remote; the API's 400 is the backstop. - Docs (README + rpm example) and unit tests (round-trip, null handling, and the type-scoping validation for allowed/rejected/null cases). Optional and back-compat: omitting `mirrorlist` is unchanged. Version bump/release intentionally deferred.
unkin-agent added 1 commit 2026-08-13 16:17:14 +10:00
resource_remote: add mirrorlist attribute (rpm/deb/apk remotes)
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline failed
9ed7f07463
Expose the artifactapi remotes API's new mirrorlist field so users can
configure extra upstream mirror base URLs. The API load-balances
base_url + mirrorlist with failover.

- Add optional mirrorlist list attribute to the remote resource schema
  and the remote data source (read-only).
- Wire it end-to-end: TF model, wire model (json mirrorlist,omitempty),
  modelToAPI/apiToModel, and preserve null/empty list semantics to avoid
  plan churn.
- Scope to rpm/deb/alpine via ValidateConfig (plan-time error on other
  remote types); API 400 is the backstop.
- Docs + rpm example; unit tests for round-trip, null handling, and the
  type-scoping validation.
unkin-agent added 1 commit 2026-08-13 16:22:31 +10:00
go.mod: promote terraform-plugin-go to a direct dependency
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
cd49af0f94
The mirrorlist ValidateConfig test imports terraform-plugin-go/tftypes
directly to build a tfsdk.Config, so `go mod tidy` moves it from an
indirect to a direct require. Commit the tidied go.mod so the CI
go-mod-tidy pre-commit hook is green.
benvin merged commit bc13e7372d into main 2026-08-13 17:24:59 +10:00
benvin deleted branch benvin/mirrorlist 2026-08-13 17:24:59 +10:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/terraform-provider-artifactapi#18