Files
terraform-provider-artifactapi/examples/resources/artifactapi_remote_rpm/main.tf
T
unkin-agent c69c3d9f74
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
resource_remote: add mirror_strategy attribute
The provider exposed mirrorlist but not mirror_strategy, so the API's
mirror load-balancing strategy (round_robin/least_conn) was unreachable
via Terraform. Add mirror_strategy the same way mirrorlist was added,
scoped to rpm/deb/alpine remotes.

- schema: optional string mirror_strategy on the remote resource
- ValidateConfig: reject on non-rpm/deb/alpine types and validate the
  round_robin/least_conn enum at plan time
- wire model + modelToAPI/apiToModel (empty->null to avoid perpetual diff)
- datasource (computed) + README + rpm example
- unit tests: modelToAPI/apiToModel round-trip and ValidateConfig matrix
2026-08-13 17:50:52 +10:00

35 lines
946 B
Terraform

terraform {
required_providers {
artifactapi = {
source = "git.unkin.net/unkin/artifactapi"
version = "0.0.1"
}
}
}
provider "artifactapi" {
endpoint = "https://artifactapi.example.com"
}
# RPM remote proxies an RPM package repository.
# The provider knows repodata/* is mutable; RPM packages are immutable.
resource "artifactapi_remote_rpm" "almalinux" {
name = "almalinux"
base_url = "https://gsl-syd.mm.fcix.net/almalinux"
description = "AlmaLinux RPM package repository"
# Extra mirrors; requests are load-balanced with failover across
# base_url + mirrorlist (rpm/deb/alpine remotes only).
mirrorlist = [
"https://mirror.aarnet.edu.au/pub/almalinux",
"https://mirror.realcompute.io/almalinux",
]
# Load-balancing strategy across base_url + mirrorlist:
# "round_robin" (default) or "least_conn".
mirror_strategy = "least_conn"
immutable_ttl = 0
mutable_ttl = 7200
}