From 0890ef3f0833261046b8c7ede94a64857ac6d6ef Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Tue, 17 Nov 2026 06:30:40 +1100 Subject: [PATCH 1/3] Move module to github.com/IUCLabs --- Makefile | 7 +++++-- go.mod | 2 +- main.go | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ee30653..9b118f3 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -.PHONY: build install test lint fmt clean tidy patch minor major package +.PHONY: build install test lint fmt clean tidy patch minor major package docs BINARY := terraform-provider-artifactapi VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "0.0.0-dev") OS_ARCH := linux_amd64 INSTALL_VERSION := $(shell echo $(VERSION) | sed 's/^v//') -INSTALL_DIR := ~/.terraform.d/plugins/git.unkin.net/unkin/artifactapi/$(INSTALL_VERSION)/$(OS_ARCH) +INSTALL_DIR := ~/.terraform.d/plugins/registry.terraform.io/iuclabs/artifactapi/$(INSTALL_VERSION)/$(OS_ARCH) ZIP := $(BINARY)_$(INSTALL_VERSION)_$(OS_ARCH).zip GO_VERSION_REQUIRED := 1.23 @@ -39,6 +39,9 @@ package: build clean: rm -f $(BINARY) *.zip +docs: + go generate ./... + tidy: go mod tidy diff --git a/go.mod b/go.mod index 87837c0..557cd28 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module git.unkin.net/unkin/terraform-provider-artifactapi +module github.com/IUCLabs/terraform-provider-artifactapi go 1.25.9 diff --git a/main.go b/main.go index eec89e3..d53028e 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,7 @@ package main +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.24.0 generate --provider-name artifactapi + import ( "context" "flag" @@ -7,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/providerserver" - "git.unkin.net/unkin/terraform-provider-artifactapi/internal/provider" + "github.com/IUCLabs/terraform-provider-artifactapi/internal/provider" ) var version = "0.0.1" @@ -18,7 +20,7 @@ func main() { flag.Parse() opts := providerserver.ServeOpts{ - Address: "git.unkin.net/unkin/artifactapi", + Address: "registry.terraform.io/iuclabs/artifactapi", Debug: debug, } -- 2.47.3 From 27a50b0106225ec27649caa11a5ea62a0eddaf75 Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Tue, 17 Nov 2026 06:30:40 +1100 Subject: [PATCH 2/3] Generate Registry docs with tfplugindocs --- docs/data-sources/remote.md | 62 +++++- docs/data-sources/virtual.md | 41 +++- docs/index.md | 38 ++++ docs/resources/local_alpine.md | 45 +++- docs/resources/local_ansible.md | 45 +++- docs/resources/local_deb.md | 45 +++- docs/resources/local_docker.md | 43 +++- docs/resources/local_gems.md | 45 +++- docs/resources/local_generic.md | 45 +++- docs/resources/local_goproxy.md | 45 +++- docs/resources/local_helm.md | 45 +++- docs/resources/local_npm.md | 45 +++- docs/resources/local_puppet.md | 45 +++- docs/resources/local_pypi.md | 45 +++- docs/resources/local_rpm.md | 45 +++- docs/resources/local_terraform.md | 45 +++- docs/resources/remote_alpine.md | 108 +++++---- docs/resources/remote_ansible.md | 93 +++++--- docs/resources/remote_cargo.md | 93 +++++--- docs/resources/remote_deb.md | 108 +++++---- docs/resources/remote_docker.md | 100 ++++++--- docs/resources/remote_gems.md | 93 +++++--- docs/resources/remote_generic.md | 104 ++++++--- docs/resources/remote_github_alpine.md | 126 +++++++---- docs/resources/remote_github_deb.md | 126 +++++++---- docs/resources/remote_github_rpm.md | 130 +++++++---- docs/resources/remote_goproxy.md | 93 +++++--- docs/resources/remote_helm.md | 93 +++++--- docs/resources/remote_npm.md | 93 +++++--- docs/resources/remote_puppet.md | 93 +++++--- docs/resources/remote_pypi.md | 93 +++++--- docs/resources/remote_rpm.md | 113 ++++++---- docs/resources/remote_terraform.md | 113 +++++++--- docs/resources/remote_vcs.md | 96 +++++--- docs/resources/virtual.md | 71 +++++- .../{main.tf => data-source.tf} | 13 -- .../{main.tf => data-source.tf} | 13 -- examples/main.tf | 205 ------------------ examples/provider/provider.tf | 12 + .../artifactapi_local_alpine/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_ansible/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../resources/artifactapi_local_deb/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_docker/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_gems/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_generic/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_goproxy/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_helm/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../resources/artifactapi_local_npm/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_puppet/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_pypi/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../resources/artifactapi_local_rpm/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_local_terraform/import.sh | 2 + .../{main.tf => resource.tf} | 0 .../artifactapi_remote_alpine/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_ansible/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_cargo/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_deb/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_docker/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_gems/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_generic/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../import.sh | 2 + .../{main.tf => resource.tf} | 25 +-- .../artifactapi_remote_github_deb/import.sh | 2 + .../{main.tf => resource.tf} | 25 +-- .../artifactapi_remote_github_rpm/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_goproxy/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_helm/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_npm/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_puppet/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_pypi/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_rpm/import.sh | 2 + .../{main.tf => resource.tf} | 19 +- .../artifactapi_remote_terraform/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../artifactapi_remote_vcs/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- .../resources/artifactapi_virtual/import.sh | 2 + .../{main.tf => resource.tf} | 13 -- internal/provider/datasource_remote.go | 52 ++--- internal/provider/datasource_virtual.go | 10 +- internal/provider/provider.go | 2 +- internal/provider/provider_test.go | 4 +- internal/provider/resource_remote.go | 33 ++- 108 files changed, 2116 insertions(+), 1232 deletions(-) create mode 100644 docs/index.md rename examples/data-sources/artifactapi_remote/{main.tf => data-source.tf} (62%) rename examples/data-sources/artifactapi_virtual/{main.tf => data-source.tf} (59%) delete mode 100644 examples/main.tf create mode 100644 examples/provider/provider.tf create mode 100644 examples/resources/artifactapi_local_alpine/import.sh rename examples/resources/artifactapi_local_alpine/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_ansible/import.sh rename examples/resources/artifactapi_local_ansible/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_deb/import.sh rename examples/resources/artifactapi_local_deb/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_docker/import.sh rename examples/resources/artifactapi_local_docker/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_gems/import.sh rename examples/resources/artifactapi_local_gems/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_generic/import.sh rename examples/resources/artifactapi_local_generic/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_goproxy/import.sh rename examples/resources/artifactapi_local_goproxy/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_helm/import.sh rename examples/resources/artifactapi_local_helm/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_npm/import.sh rename examples/resources/artifactapi_local_npm/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_puppet/import.sh rename examples/resources/artifactapi_local_puppet/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_pypi/import.sh rename examples/resources/artifactapi_local_pypi/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_rpm/import.sh rename examples/resources/artifactapi_local_rpm/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_local_terraform/import.sh rename examples/resources/artifactapi_local_terraform/{main.tf => resource.tf} (100%) create mode 100644 examples/resources/artifactapi_remote_alpine/import.sh rename examples/resources/artifactapi_remote_alpine/{main.tf => resource.tf} (60%) create mode 100644 examples/resources/artifactapi_remote_ansible/import.sh rename examples/resources/artifactapi_remote_ansible/{main.tf => resource.tf} (58%) create mode 100644 examples/resources/artifactapi_remote_cargo/import.sh rename examples/resources/artifactapi_remote_cargo/{main.tf => resource.tf} (58%) create mode 100644 examples/resources/artifactapi_remote_deb/import.sh rename examples/resources/artifactapi_remote_deb/{main.tf => resource.tf} (60%) create mode 100644 examples/resources/artifactapi_remote_docker/import.sh rename examples/resources/artifactapi_remote_docker/{main.tf => resource.tf} (68%) create mode 100644 examples/resources/artifactapi_remote_gems/import.sh rename examples/resources/artifactapi_remote_gems/{main.tf => resource.tf} (56%) create mode 100644 examples/resources/artifactapi_remote_generic/import.sh rename examples/resources/artifactapi_remote_generic/{main.tf => resource.tf} (72%) create mode 100644 examples/resources/artifactapi_remote_github_alpine/import.sh rename examples/resources/artifactapi_remote_github_alpine/{main.tf => resource.tf} (54%) create mode 100644 examples/resources/artifactapi_remote_github_deb/import.sh rename examples/resources/artifactapi_remote_github_deb/{main.tf => resource.tf} (54%) create mode 100644 examples/resources/artifactapi_remote_github_rpm/import.sh rename examples/resources/artifactapi_remote_github_rpm/{main.tf => resource.tf} (84%) create mode 100644 examples/resources/artifactapi_remote_goproxy/import.sh rename examples/resources/artifactapi_remote_goproxy/{main.tf => resource.tf} (58%) create mode 100644 examples/resources/artifactapi_remote_helm/import.sh rename examples/resources/artifactapi_remote_helm/{main.tf => resource.tf} (58%) create mode 100644 examples/resources/artifactapi_remote_npm/import.sh rename examples/resources/artifactapi_remote_npm/{main.tf => resource.tf} (56%) create mode 100644 examples/resources/artifactapi_remote_puppet/import.sh rename examples/resources/artifactapi_remote_puppet/{main.tf => resource.tf} (60%) create mode 100644 examples/resources/artifactapi_remote_pypi/import.sh rename examples/resources/artifactapi_remote_pypi/{main.tf => resource.tf} (57%) create mode 100644 examples/resources/artifactapi_remote_rpm/import.sh rename examples/resources/artifactapi_remote_rpm/{main.tf => resource.tf} (59%) create mode 100644 examples/resources/artifactapi_remote_terraform/import.sh rename examples/resources/artifactapi_remote_terraform/{main.tf => resource.tf} (80%) create mode 100644 examples/resources/artifactapi_remote_vcs/import.sh rename examples/resources/artifactapi_remote_vcs/{main.tf => resource.tf} (67%) create mode 100644 examples/resources/artifactapi_virtual/import.sh rename examples/resources/artifactapi_virtual/{main.tf => resource.tf} (79%) diff --git a/docs/data-sources/remote.md b/docs/data-sources/remote.md index 86890c9..0954f2d 100644 --- a/docs/data-sources/remote.md +++ b/docs/data-sources/remote.md @@ -1,9 +1,65 @@ -# `artifactapi_remote` (Data Source) +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote Data Source - artifactapi" +subcategory: "" +description: |- + Read an existing ArtifactAPI remote. +--- -Read an existing remote's configuration. +# artifactapi_remote (Data Source) -```hcl +Read an existing ArtifactAPI remote. + +## Example Usage + +```terraform +# Read the configuration of an existing remote by name. +# All fields (base_url, package_type, TTLs, patterns, etc.) are available +# as computed attributes. data "artifactapi_remote" "dockerhub" { name = "dockerhub" } + +output "dockerhub_base_url" { + value = data.artifactapi_remote.dockerhub.base_url +} + +output "dockerhub_package_type" { + value = data.artifactapi_remote.dockerhub.package_type +} ``` + + +## Schema + +### Required + +- `name` (String) Name of the remote to read. + +### Read-Only + +- `ban_tags` (List of String) Banned tags (docker only). +- `ban_tags_enabled` (Boolean) Whether tag banning is enabled (docker only). +- `base_url` (String) Upstream repository base URL. +- `blocklist` (List of String) Paths that are always denied. +- `cache_repodata` (Boolean) Whether generated repodata is cached (github_rpm only). +- `check_mutable` (Boolean) Whether mutable artifacts are conditionally revalidated. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Paths forced to be treated as immutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `managed_by` (String) What manages the repository (e.g. terraform). +- `mirror_strategy` (String) Mirror load-balancing strategy: round_robin or least_conn. +- `mirrorlist` (List of String) Extra upstream mirror base URLs (rpm/deb/alpine only). +- `mutable_patterns` (List of String) Paths forced to be treated as mutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `package_type` (String) Package type of the repository (e.g. docker, helm, rpm). +- `patterns` (List of String) Allowlist of paths to proxy (empty = all). +- `quarantine_days` (Number) Days new artifacts are quarantined. +- `quarantine_enabled` (Boolean) Whether newly published upstream artifacts are quarantined. +- `releases_remote` (String) Name of the backend remote that serves download bytes. +- `serve_stale` (Boolean) Whether rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Whether stale cached content is served when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds (github_rpm/github_deb/github_alpine only). +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). diff --git a/docs/data-sources/virtual.md b/docs/data-sources/virtual.md index 8465708..a5296ab 100644 --- a/docs/data-sources/virtual.md +++ b/docs/data-sources/virtual.md @@ -1,9 +1,44 @@ -# `artifactapi_virtual` (Data Source) +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_virtual Data Source - artifactapi" +subcategory: "" +description: |- + Read an existing ArtifactAPI virtual repository. +--- -Read an existing virtual repository's configuration. +# artifactapi_virtual (Data Source) -```hcl +Read an existing ArtifactAPI virtual repository. + +## Example Usage + +```terraform +# Read the configuration of an existing virtual repository by name. +# Returns the package type, description, and ordered member list. data "artifactapi_virtual" "helm" { name = "helm" } + +output "helm_members" { + value = data.artifactapi_virtual.helm.members +} + +output "helm_package_type" { + value = data.artifactapi_virtual.helm.package_type +} ``` + + +## Schema + +### Required + +- `name` (String) Virtual repository name. + +### Read-Only + +- `description` (String) Human-readable description. +- `managed_by` (String) What manages the repository (e.g. terraform). +- `members` (List of String) Ordered list of member remote names. +- `package_type` (String) Package type of the virtual repository. +- `parallel_fetch` (Boolean) Whether member index files are fetched concurrently. diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..8a3ac6a --- /dev/null +++ b/docs/index.md @@ -0,0 +1,38 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi Provider" +description: |- + Manage ArtifactAPI local, remote and virtual repositories. +--- + +# artifactapi Provider + +Manage ArtifactAPI local, remote and virtual repositories. + +## Example Usage + +```terraform +terraform { + required_providers { + artifactapi = { + source = "IUCLabs/artifactapi" + } + } +} + +provider "artifactapi" { + endpoint = "https://artifactapi.example.com" + # token defaults to the ARTIFACTAPI_TOKEN environment variable +} +``` + + +## Schema + +### Required + +- `endpoint` (String) The ArtifactAPI server endpoint URL (e.g. https://artifactapi.example.com). + +### Optional + +- `token` (String, Sensitive) Bearer token sent as the Authorization header. Falls back to the ARTIFACTAPI_TOKEN environment variable. diff --git a/docs/resources/local_alpine.md b/docs/resources/local_alpine.md index ace4bcd..c05eeff 100644 --- a/docs/resources/local_alpine.md +++ b/docs/resources/local_alpine.md @@ -1,11 +1,42 @@ -# `artifactapi_local_alpine` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_alpine Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI Alpine repository for hosting Alpine/apk packages directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_alpine (Resource) -Each takes just `name` (required, forces replacement) and an optional -`description`. +Manages a local ArtifactAPI Alpine repository for hosting Alpine/apk packages directly. -## Example +## Example Usage -See `examples/resources/artifactapi_local_alpine/main.tf`. +```terraform +resource "artifactapi_local_alpine" "internal" { + name = "alpine-internal" + description = "Internal Alpine package repository" +} +``` + + +## Schema + +### Required + +- `name` (String) Unique name of the local Alpine repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_alpine.internal alpine-internal +``` diff --git a/docs/resources/local_ansible.md b/docs/resources/local_ansible.md index 7eecd8e..2829d09 100644 --- a/docs/resources/local_ansible.md +++ b/docs/resources/local_ansible.md @@ -1,13 +1,42 @@ -# `artifactapi_local_ansible` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_ansible Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI Ansible Galaxy repository for hosting collections directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_ansible (Resource) -A Galaxy v3 server for collections (`ansible-galaxy collection publish` and `install`). +Manages a local ArtifactAPI Ansible Galaxy repository for hosting collections directly. -Each takes just `name` (required, forces replacement) and an optional -`description`. +## Example Usage -## Example +```terraform +resource "artifactapi_local_ansible" "internal" { + name = "ansible-internal" + description = "Internal Ansible Galaxy collections" +} +``` -See `examples/resources/artifactapi_local_ansible/main.tf`. + +## Schema + +### Required + +- `name` (String) Unique name of the local ansible repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_ansible.internal ansible-internal +``` diff --git a/docs/resources/local_deb.md b/docs/resources/local_deb.md index 0db1aed..73b13cf 100644 --- a/docs/resources/local_deb.md +++ b/docs/resources/local_deb.md @@ -1,11 +1,42 @@ -# `artifactapi_local_deb` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_deb Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI Deb repository for hosting Debian/apt packages directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_deb (Resource) -Each takes just `name` (required, forces replacement) and an optional -`description`. +Manages a local ArtifactAPI Deb repository for hosting Debian/apt packages directly. -## Example +## Example Usage -See `examples/resources/artifactapi_local_deb/main.tf`. +```terraform +resource "artifactapi_local_deb" "internal" { + name = "deb-internal" + description = "Internal Deb package repository" +} +``` + + +## Schema + +### Required + +- `name` (String) Unique name of the local Deb repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_deb.internal deb-internal +``` diff --git a/docs/resources/local_docker.md b/docs/resources/local_docker.md index 48984c3..20856a5 100644 --- a/docs/resources/local_docker.md +++ b/docs/resources/local_docker.md @@ -1,21 +1,42 @@ -# `artifactapi_local_docker` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_docker Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI Docker repository — a real container registry serving the Docker Registry HTTP API V2 for push and pull. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_docker (Resource) -A container registry (Docker Registry HTTP API V2, push and pull). +Manages a local ArtifactAPI Docker repository — a real container registry serving the Docker Registry HTTP API V2 for push and pull. -Each takes just `name` (required, forces replacement) and an optional -`description`. +## Example Usage -## Example - -```hcl +```terraform resource "artifactapi_local_docker" "internal" { name = "docker-internal" description = "Internal container image registry" } ``` -Images push and pull against `//:`, e.g. -`docker push artifactapi.example.com/docker-internal/myapp:latest`. + +## Schema + +### Required + +- `name` (String) Unique name of the local Docker repository. Becomes the first path segment of pushed image references (e.g. //:). + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_docker.internal docker-internal +``` diff --git a/docs/resources/local_gems.md b/docs/resources/local_gems.md index d9702d6..1026aca 100644 --- a/docs/resources/local_gems.md +++ b/docs/resources/local_gems.md @@ -1,13 +1,42 @@ -# `artifactapi_local_gems` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_gems Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI RubyGems repository for hosting gems directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_gems (Resource) -A RubyGems source (`gem push`, `gem yank`, `gem install` and `bundle install`). +Manages a local ArtifactAPI RubyGems repository for hosting gems directly. -Each takes just `name` (required, forces replacement) and an optional -`description`. +## Example Usage -## Example +```terraform +resource "artifactapi_local_gems" "internal" { + name = "gems-internal" + description = "Internal RubyGems repository" +} +``` -See `examples/resources/artifactapi_local_gems/main.tf`. + +## Schema + +### Required + +- `name` (String) Unique name of the local gems repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_gems.internal gems-internal +``` diff --git a/docs/resources/local_generic.md b/docs/resources/local_generic.md index 212a45f..2803a2c 100644 --- a/docs/resources/local_generic.md +++ b/docs/resources/local_generic.md @@ -1,11 +1,42 @@ -# `artifactapi_local_generic` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_generic Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI generic repository for hosting arbitrary files (e.g. rootfs tarballs). +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_generic (Resource) -Each takes just `name` (required, forces replacement) and an optional -`description`. +Manages a local ArtifactAPI generic repository for hosting arbitrary files (e.g. rootfs tarballs). -## Example +## Example Usage -See `examples/resources/artifactapi_local_generic/main.tf`. +```terraform +resource "artifactapi_local_generic" "rootfs_images" { + name = "rootfs-images" + description = "Prebuilt node rootfs tarballs (bootapi image provisioning)" +} +``` + + +## Schema + +### Required + +- `name` (String) Unique name of the local Generic repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_generic.rootfs_images rootfs-images +``` diff --git a/docs/resources/local_goproxy.md b/docs/resources/local_goproxy.md index 12d38d7..8117699 100644 --- a/docs/resources/local_goproxy.md +++ b/docs/resources/local_goproxy.md @@ -1,13 +1,42 @@ -# `artifactapi_local_goproxy` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_goproxy Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI Go module proxy for hosting private Go modules directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_goproxy (Resource) -A Go module proxy for private modules (GOPROXY protocol: `go get`, `go mod download`). +Manages a local ArtifactAPI Go module proxy for hosting private Go modules directly. -Each takes just `name` (required, forces replacement) and an optional -`description`. +## Example Usage -## Example +```terraform +resource "artifactapi_local_goproxy" "internal" { + name = "go-internal" + description = "Internal Go module proxy" +} +``` -See `examples/resources/artifactapi_local_goproxy/main.tf`. + +## Schema + +### Required + +- `name` (String) Unique name of the local Go module proxy. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_goproxy.internal go-internal +``` diff --git a/docs/resources/local_helm.md b/docs/resources/local_helm.md index 5fa2f1a..c0b5952 100644 --- a/docs/resources/local_helm.md +++ b/docs/resources/local_helm.md @@ -1,13 +1,42 @@ -# `artifactapi_local_helm` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_helm Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI Helm repository for hosting Helm charts directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_helm (Resource) -A chart repository (index.yaml generated from uploaded charts). +Manages a local ArtifactAPI Helm repository for hosting Helm charts directly. -Each takes just `name` (required, forces replacement) and an optional -`description`. +## Example Usage -## Example +```terraform +resource "artifactapi_local_helm" "internal" { + name = "helm-internal" + description = "Internal Helm chart repository" +} +``` -See `examples/resources/artifactapi_local_helm/main.tf`. + +## Schema + +### Required + +- `name` (String) Unique name of the local Helm repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_helm.internal helm-internal +``` diff --git a/docs/resources/local_npm.md b/docs/resources/local_npm.md index 0373b00..ba651af 100644 --- a/docs/resources/local_npm.md +++ b/docs/resources/local_npm.md @@ -1,13 +1,42 @@ -# `artifactapi_local_npm` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_npm Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI NPM repository for hosting npm packages directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_npm (Resource) -An npm registry (`npm publish` and `npm install`). +Manages a local ArtifactAPI NPM repository for hosting npm packages directly. -Each takes just `name` (required, forces replacement) and an optional -`description`. +## Example Usage -## Example +```terraform +resource "artifactapi_local_npm" "internal" { + name = "npm-internal" + description = "Internal npm package registry" +} +``` -See `examples/resources/artifactapi_local_npm/main.tf`. + +## Schema + +### Required + +- `name` (String) Unique name of the local NPM repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_npm.internal npm-internal +``` diff --git a/docs/resources/local_puppet.md b/docs/resources/local_puppet.md index 087db00..3619eb2 100644 --- a/docs/resources/local_puppet.md +++ b/docs/resources/local_puppet.md @@ -1,13 +1,42 @@ -# `artifactapi_local_puppet` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_puppet Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI Puppet Forge for hosting Puppet modules directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_puppet (Resource) -A Puppet Forge (v3 API) serving uploaded modules to `puppet module install` and r10k. +Manages a local ArtifactAPI Puppet Forge for hosting Puppet modules directly. -Each takes just `name` (required, forces replacement) and an optional -`description`. +## Example Usage -## Example +```terraform +resource "artifactapi_local_puppet" "internal" { + name = "puppet-internal" + description = "Internal Puppet Forge" +} +``` -See `examples/resources/artifactapi_local_puppet/main.tf`. + +## Schema + +### Required + +- `name` (String) Unique name of the local Puppet Forge. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_puppet.internal puppet-internal +``` diff --git a/docs/resources/local_pypi.md b/docs/resources/local_pypi.md index 1a8952f..eb5f09b 100644 --- a/docs/resources/local_pypi.md +++ b/docs/resources/local_pypi.md @@ -1,11 +1,42 @@ -# `artifactapi_local_pypi` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_pypi Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI PyPI repository for hosting Python packages directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_pypi (Resource) -Each takes just `name` (required, forces replacement) and an optional -`description`. +Manages a local ArtifactAPI PyPI repository for hosting Python packages directly. -## Example +## Example Usage -See `examples/resources/artifactapi_local_pypi/main.tf`. +```terraform +resource "artifactapi_local_pypi" "internal" { + name = "pypi-internal" + description = "Internal PyPI package registry" +} +``` + + +## Schema + +### Required + +- `name` (String) Unique name of the local PyPI repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_pypi.internal pypi-internal +``` diff --git a/docs/resources/local_rpm.md b/docs/resources/local_rpm.md index f0a2a79..e15c224 100644 --- a/docs/resources/local_rpm.md +++ b/docs/resources/local_rpm.md @@ -1,11 +1,42 @@ -# `artifactapi_local_rpm` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_rpm Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI RPM repository for hosting RPM packages directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_rpm (Resource) -Each takes just `name` (required, forces replacement) and an optional -`description`. +Manages a local ArtifactAPI RPM repository for hosting RPM packages directly. -## Example +## Example Usage -See `examples/resources/artifactapi_local_rpm/main.tf`. +```terraform +resource "artifactapi_local_rpm" "internal" { + name = "rpm-internal" + description = "Internal RPM package repository" +} +``` + + +## Schema + +### Required + +- `name` (String) Unique name of the local RPM repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_rpm.internal rpm-internal +``` diff --git a/docs/resources/local_terraform.md b/docs/resources/local_terraform.md index d3986bf..f177c09 100644 --- a/docs/resources/local_terraform.md +++ b/docs/resources/local_terraform.md @@ -1,11 +1,42 @@ -# `artifactapi_local_terraform` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_local_terraform Resource - artifactapi" +subcategory: "" +description: |- + Manages a local ArtifactAPI terraform registry for hosting providers directly. +--- -Local resources manage repositories that ArtifactAPI hosts directly (rather than -proxying an upstream) — each is a real registry for its package type. +# artifactapi_local_terraform (Resource) -Each takes just `name` (required, forces replacement) and an optional -`description`. +Manages a local ArtifactAPI terraform registry for hosting providers directly. -## Example +## Example Usage -See `examples/resources/artifactapi_local_terraform/main.tf`. +```terraform +resource "artifactapi_local_terraform" "internal" { + name = "tf-internal" + description = "Internal terraform provider registry" +} +``` + + +## Schema + +### Required + +- `name` (String) Unique name of the local terraform repository. + +### Optional + +- `description` (String) Human-readable description. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_local_terraform.internal tf-internal +``` diff --git a/docs/resources/remote_alpine.md b/docs/resources/remote_alpine.md index 5eb4c3d..7ef1db9 100644 --- a/docs/resources/remote_alpine.md +++ b/docs/resources/remote_alpine.md @@ -1,54 +1,72 @@ -# `artifactapi_remote_alpine` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_alpine Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI alpine remote, a caching proxy for an upstream repository. Supports mirrorlist and mirror_strategy. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_alpine (Resource) -## Common Attributes +Manages an ArtifactAPI alpine remote, a caching proxy for an upstream repository. Supports `mirrorlist` and `mirror_strategy`. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## rpm / deb / alpine-specific Attributes +```terraform +# Alpine remote proxies an Alpine Linux APK repository. +# The provider knows APKINDEX.tar.gz is mutable; .apk packages are immutable. +resource "artifactapi_remote_alpine" "alpine" { + name = "alpine" + base_url = "https://dl-cdn.alpinelinux.org" + description = "Alpine Linux APK package repository" -| Attribute | Default | Description | -|-------------------|---------------|-------------------------------------------------------------------------------------------------| -| `mirrorlist` | | Extra upstream mirror base URLs. Requests are load-balanced with failover across `base_url` + `mirrorlist`. | -| `mirror_strategy` | `round_robin` | Mirror load-balancing strategy across `base_url` + `mirrorlist`. One of `round_robin` or `least_conn`. | - -Only valid on the `artifactapi_remote_rpm`, `artifactapi_remote_deb`, and -`artifactapi_remote_alpine` resources. Setting either on any other remote type is -rejected at plan time. - -```hcl -resource "artifactapi_remote_rpm" "epel" { - name = "epel-9" - base_url = "https://download.example.com/pub/epel/9/Everything/x86_64" - mirrorlist = [ - "https://mirror-a.example.net/epel/9/Everything/x86_64", - "https://mirror-b.example.org/epel/9/Everything/x86_64", - ] - mirror_strategy = "least_conn" + immutable_ttl = 0 + mutable_ttl = 7200 } ``` -## Example + +## Schema -See `examples/resources/artifactapi_remote_alpine/main.tf`. +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_alpine.alpine alpine +``` diff --git a/docs/resources/remote_ansible.md b/docs/resources/remote_ansible.md index b59ae9a..d094a1c 100644 --- a/docs/resources/remote_ansible.md +++ b/docs/resources/remote_ansible.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_ansible` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_ansible Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI ansible remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_ansible (Resource) -## Common Attributes +Manages an ArtifactAPI ansible remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# Ansible remote proxies the Galaxy v3 collections API. +# The provider knows JSON metadata is mutable; collection tarballs are immutable. +resource "artifactapi_remote_ansible" "galaxy" { + name = "galaxy" + base_url = "https://galaxy.ansible.com" + description = "Ansible Galaxy" -See `examples/resources/artifactapi_remote_ansible/main.tf`. + immutable_ttl = 0 + mutable_ttl = 300 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_ansible.galaxy galaxy +``` diff --git a/docs/resources/remote_cargo.md b/docs/resources/remote_cargo.md index e5a5a2d..4619034 100644 --- a/docs/resources/remote_cargo.md +++ b/docs/resources/remote_cargo.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_cargo` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_cargo Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI cargo remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_cargo (Resource) -## Common Attributes +Manages an ArtifactAPI cargo remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# Cargo remote proxies a crates.io sparse registry. +# The provider knows index files are mutable; .crate downloads are immutable. +resource "artifactapi_remote_cargo" "crates_io" { + name = "crates-io" + base_url = "https://index.crates.io" + description = "crates.io sparse registry" -See `examples/resources/artifactapi_remote_cargo/main.tf`. + immutable_ttl = 0 + mutable_ttl = 300 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_cargo.crates_io crates-io +``` diff --git a/docs/resources/remote_deb.md b/docs/resources/remote_deb.md index 8908eda..1637412 100644 --- a/docs/resources/remote_deb.md +++ b/docs/resources/remote_deb.md @@ -1,54 +1,72 @@ -# `artifactapi_remote_deb` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_deb Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI deb remote, a caching proxy for an upstream repository. Supports mirrorlist and mirror_strategy. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_deb (Resource) -## Common Attributes +Manages an ArtifactAPI deb remote, a caching proxy for an upstream repository. Supports `mirrorlist` and `mirror_strategy`. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## rpm / deb / alpine-specific Attributes +```terraform +# Deb remote proxies a Debian/apt package repository. +# The provider knows the index files (Release, Packages) are mutable; .deb packages are immutable. +resource "artifactapi_remote_deb" "debian" { + name = "debian" + base_url = "http://deb.debian.org/debian" + description = "Debian apt package repository" -| Attribute | Default | Description | -|-------------------|---------------|-------------------------------------------------------------------------------------------------| -| `mirrorlist` | | Extra upstream mirror base URLs. Requests are load-balanced with failover across `base_url` + `mirrorlist`. | -| `mirror_strategy` | `round_robin` | Mirror load-balancing strategy across `base_url` + `mirrorlist`. One of `round_robin` or `least_conn`. | - -Only valid on the `artifactapi_remote_rpm`, `artifactapi_remote_deb`, and -`artifactapi_remote_alpine` resources. Setting either on any other remote type is -rejected at plan time. - -```hcl -resource "artifactapi_remote_rpm" "epel" { - name = "epel-9" - base_url = "https://download.example.com/pub/epel/9/Everything/x86_64" - mirrorlist = [ - "https://mirror-a.example.net/epel/9/Everything/x86_64", - "https://mirror-b.example.org/epel/9/Everything/x86_64", - ] - mirror_strategy = "least_conn" + immutable_ttl = 0 + mutable_ttl = 7200 } ``` -## Example + +## Schema -See `examples/resources/artifactapi_remote_deb/main.tf`. +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_deb.debian debian +``` diff --git a/docs/resources/remote_docker.md b/docs/resources/remote_docker.md index c8f12b7..5e8a519 100644 --- a/docs/resources/remote_docker.md +++ b/docs/resources/remote_docker.md @@ -1,44 +1,24 @@ -# `artifactapi_remote_docker` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_docker Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI docker remote, a caching proxy for an upstream repository. Tag manifests are mutable and blobs are immutable; ban_tags blocks specific tags. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_docker (Resource) -## Common Attributes +Manages an ArtifactAPI docker remote, a caching proxy for an upstream repository. Tag manifests are mutable and blobs are immutable; `ban_tags` blocks specific tags. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Docker-specific Attributes - -| Attribute | Default | Description | -|--------------------|---------|----------------------------| -| `ban_tags_enabled` | `false` | Enable tag banning | -| `ban_tags` | | List of tags to ban | - -## Example - -```hcl +```terraform +# Docker remote proxies a container registry. +# The provider auto-classifies: tag manifests are mutable, blobs are immutable. resource "artifactapi_remote_docker" "dockerhub" { - name = "dockerhub" - base_url = "https://registry-1.docker.io" + name = "dockerhub" + base_url = "https://registry-1.docker.io" + description = "Docker Hub registry" immutable_ttl = 0 mutable_ttl = 300 @@ -46,8 +26,56 @@ resource "artifactapi_remote_docker" "dockerhub" { ban_tags = ["latest"] patterns = [ + "^library/almalinux", "^library/postgres", "^library/redis", + "^bitnami/", ] } ``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_docker.dockerhub dockerhub +``` diff --git a/docs/resources/remote_gems.md b/docs/resources/remote_gems.md index 211f4cc..3ad02b3 100644 --- a/docs/resources/remote_gems.md +++ b/docs/resources/remote_gems.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_gems` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_gems Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI gems remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_gems (Resource) -## Common Attributes +Manages an ArtifactAPI gems remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# Gems remote proxies a RubyGems source. +# The provider knows the compact index is mutable; .gem downloads are immutable. +resource "artifactapi_remote_gems" "rubygems" { + name = "rubygems" + base_url = "https://rubygems.org" + description = "rubygems.org" -See `examples/resources/artifactapi_remote_gems/main.tf`. + immutable_ttl = 0 + mutable_ttl = 300 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_gems.rubygems rubygems +``` diff --git a/docs/resources/remote_generic.md b/docs/resources/remote_generic.md index b170e76..46addc7 100644 --- a/docs/resources/remote_generic.md +++ b/docs/resources/remote_generic.md @@ -1,31 +1,83 @@ -# `artifactapi_remote_generic` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_generic Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI generic remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_generic (Resource) -## Common Attributes +Manages an ArtifactAPI generic remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# A generic remote proxies arbitrary HTTP endpoints. +# Patterns act as an allowlist; everything matching is immutable by default. +resource "artifactapi_remote_generic" "github" { + name = "github" + base_url = "https://github.com" + description = "GitHub releases" -See `examples/resources/artifactapi_remote_generic/main.tf`. + immutable_ttl = 0 + mutable_ttl = 7200 + + patterns = [ + "ducaale/xh/.*/xh-.*-x86_64-unknown-linux-musl.tar.gz$", + "mikefarah/yq/.*/yq_linux_amd64$", + "neovim/neovim-releases/.*/nvim-linux-x86_64.tar.gz$", + ] + + # Override: branch archives are mutable + mutable_patterns = [ + ".*/archive/refs/heads/.*\\.tar\\.gz$", + ] +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_generic.github github +``` diff --git a/docs/resources/remote_github_alpine.md b/docs/resources/remote_github_alpine.md index 66d096b..fb02113 100644 --- a/docs/resources/remote_github_alpine.md +++ b/docs/resources/remote_github_alpine.md @@ -1,51 +1,93 @@ -# `artifactapi_remote_github_alpine` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_github_alpine Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI github_alpine remote, a caching proxy for an upstream repository. Exposes a GitHub repository's release .apk assets as an apk repository, synthesising APKINDEX.tar.gz from release metadata. Set base_url to the releases API root (https://api.github.com/repos/{owner}/{repo}) and releases_remote to a generic github.com remote that streams the package bytes; package downloads 302-redirect there. patterns filters which release assets become packages (regex on asset filename). password may hold a token for private repos or higher API rate limits. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_github_alpine (Resource) -## Common Attributes +Manages an ArtifactAPI github_alpine remote, a caching proxy for an upstream repository. Exposes a GitHub repository's release `.apk` assets as an apk repository, synthesising `APKINDEX.tar.gz` from release metadata. Set `base_url` to the releases API root (`https://api.github.com/repos/{owner}/{repo}`) and `releases_remote` to a generic `github.com` remote that streams the package bytes; package downloads 302-redirect there. `patterns` filters which release assets become packages (regex on asset filename). `password` may hold a token for private repos or higher API rate limits. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Terraform / github_rpm / github_deb / github_alpine-specific Attributes +```terraform +# Backend generic remote that serves the actual .apk bytes from github.com. +# Its patterns must allowlist the target repo's release-download assets. +resource "artifactapi_remote_generic" "github" { + name = "github" + base_url = "https://github.com" -| Attribute | Default | Description | -|-------------------|---------|----------------------------------------------------------| -| `releases_remote` | `""` | Name of a backend remote that serves the download bytes. Terraform uses it for download URL rewriting; `github_rpm`/`github_deb`/`github_alpine` 302-redirect `.rpm`/`.deb`/`.apk` downloads to it. | -| `sync_interval` | `0` | Release re-scan interval in seconds, `0`..`2592000` (`0` = `mutable_ttl`). `github_rpm`/`github_deb`/`github_alpine` only; rejected at plan time elsewhere. | + patterns = [ + "acme/tools/releases/download/.*\\.apk$", + ] +} -## Notes +# Metadata-only remote: scans acme/tools releases for .apk assets and serves a +# synthesized apk repo (APKINDEX). Packages are never precached; downloads +# 302-redirect to the "github" remote above. +resource "artifactapi_remote_github_alpine" "acme_tools" { + name = "acme-tools" + base_url = "https://api.github.com/repos/acme/tools" + description = "acme/tools GitHub releases as an apk repo" + releases_remote = artifactapi_remote_generic.github.name -`artifactapi_remote_github_alpine` is the Alpine/apk analog of `github_rpm`: it -exposes a GitHub repo's release `.apk` assets as an `apk` repository, synthesizing -the apk index (`APKINDEX.tar.gz`) from release metadata without precaching -packages. Set `base_url` to the releases API root -(`https://api.github.com/repos/{owner}/{repo}`) and `releases_remote` to a -generic `github.com` remote that streams the `.apk` bytes; `.apk` downloads -302-redirect there. `patterns` filters which release assets become packages -(regex on asset filename). `password` may hold a token for private repos or -higher API rate limits. See -`examples/resources/artifactapi_remote_github_alpine/main.tf`. + mutable_ttl = 3600 -## Example + # Optional: restrict which release assets become packages. + patterns = [ + ".*_x86_64\\.apk$", + ".*_noarch\\.apk$", + ] -See `examples/resources/artifactapi_remote_github_alpine/main.tf`. + # Optional: token for private repos / higher GitHub API rate limits. + # password = var.github_token +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_github_alpine.acme_tools acme-tools +``` diff --git a/docs/resources/remote_github_deb.md b/docs/resources/remote_github_deb.md index 42008ee..58ca058 100644 --- a/docs/resources/remote_github_deb.md +++ b/docs/resources/remote_github_deb.md @@ -1,51 +1,93 @@ -# `artifactapi_remote_github_deb` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_github_deb Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI github_deb remote, a caching proxy for an upstream repository. Exposes a GitHub repository's release .deb assets as an apt repository, synthesising Packages/Release from release metadata. Set base_url to the releases API root (https://api.github.com/repos/{owner}/{repo}) and releases_remote to a generic github.com remote that streams the package bytes; package downloads 302-redirect there. patterns filters which release assets become packages (regex on asset filename). password may hold a token for private repos or higher API rate limits. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_github_deb (Resource) -## Common Attributes +Manages an ArtifactAPI github_deb remote, a caching proxy for an upstream repository. Exposes a GitHub repository's release `.deb` assets as an apt repository, synthesising `Packages`/`Release` from release metadata. Set `base_url` to the releases API root (`https://api.github.com/repos/{owner}/{repo}`) and `releases_remote` to a generic `github.com` remote that streams the package bytes; package downloads 302-redirect there. `patterns` filters which release assets become packages (regex on asset filename). `password` may hold a token for private repos or higher API rate limits. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Terraform / github_rpm / github_deb / github_alpine-specific Attributes +```terraform +# Backend generic remote that serves the actual .deb bytes from github.com. +# Its patterns must allowlist the target repo's release-download assets. +resource "artifactapi_remote_generic" "github" { + name = "github" + base_url = "https://github.com" -| Attribute | Default | Description | -|-------------------|---------|----------------------------------------------------------| -| `releases_remote` | `""` | Name of a backend remote that serves the download bytes. Terraform uses it for download URL rewriting; `github_rpm`/`github_deb`/`github_alpine` 302-redirect `.rpm`/`.deb`/`.apk` downloads to it. | -| `sync_interval` | `0` | Release re-scan interval in seconds, `0`..`2592000` (`0` = `mutable_ttl`). `github_rpm`/`github_deb`/`github_alpine` only; rejected at plan time elsewhere. | + patterns = [ + "acme/tools/releases/download/.*\\.deb$", + ] +} -## Notes +# Metadata-only remote: scans acme/tools releases for .deb assets and serves a +# synthesized apt repo. Packages are never precached; downloads 302-redirect to +# the "github" remote above. +resource "artifactapi_remote_github_deb" "acme_tools" { + name = "acme-tools" + base_url = "https://api.github.com/repos/acme/tools" + description = "acme/tools GitHub releases as an apt repo" + releases_remote = artifactapi_remote_generic.github.name -`artifactapi_remote_github_deb` is the Debian/apt analog of `github_rpm`: it -exposes a GitHub repo's release `.deb` assets as an `apt` repository, synthesizing -the apt index (`Packages`/`Release`) from release metadata without precaching -packages. Set `base_url` to the releases API root -(`https://api.github.com/repos/{owner}/{repo}`) and `releases_remote` to a -generic `github.com` remote that streams the `.deb` bytes; `.deb` downloads -302-redirect there. `patterns` filters which release assets become packages -(regex on asset filename). `password` may hold a token for private repos or -higher API rate limits. See -`examples/resources/artifactapi_remote_github_deb/main.tf`. + mutable_ttl = 3600 -## Example + # Optional: restrict which release assets become packages. + patterns = [ + ".*_amd64\\.deb$", + ".*_all\\.deb$", + ] -See `examples/resources/artifactapi_remote_github_deb/main.tf`. + # Optional: token for private repos / higher GitHub API rate limits. + # password = var.github_token +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_github_deb.acme_tools acme-tools +``` diff --git a/docs/resources/remote_github_rpm.md b/docs/resources/remote_github_rpm.md index 462e7a1..b79e01d 100644 --- a/docs/resources/remote_github_rpm.md +++ b/docs/resources/remote_github_rpm.md @@ -1,49 +1,99 @@ -# `artifactapi_remote_github_rpm` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_github_rpm Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI github_rpm remote, a caching proxy for an upstream repository. Exposes a GitHub repository's release .rpm assets as a dnf/yum repository without precaching packages. Set base_url to the releases API root (https://api.github.com/repos/{owner}/{repo}) and releases_remote to a generic github.com remote that streams the package bytes; package downloads 302-redirect there. patterns filters which release assets become packages (regex on asset filename). password may hold a token for private repos or higher API rate limits. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_github_rpm (Resource) -## Common Attributes +Manages an ArtifactAPI github_rpm remote, a caching proxy for an upstream repository. Exposes a GitHub repository's release `.rpm` assets as a dnf/yum repository without precaching packages. Set `base_url` to the releases API root (`https://api.github.com/repos/{owner}/{repo}`) and `releases_remote` to a generic `github.com` remote that streams the package bytes; package downloads 302-redirect there. `patterns` filters which release assets become packages (regex on asset filename). `password` may hold a token for private repos or higher API rate limits. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Terraform / github_rpm / github_deb / github_alpine-specific Attributes +```terraform +# Backend generic remote that serves the actual .rpm bytes from github.com. +# Its patterns must allowlist the target repo's release-download assets. +resource "artifactapi_remote_generic" "github" { + name = "github" + base_url = "https://github.com" -| Attribute | Default | Description | -|-------------------|---------|----------------------------------------------------------| -| `releases_remote` | `""` | Name of a backend remote that serves the download bytes. Terraform uses it for download URL rewriting; `github_rpm`/`github_deb`/`github_alpine` 302-redirect `.rpm`/`.deb`/`.apk` downloads to it. | -| `cache_repodata` | `false` | Cache generated repodata (`github_rpm` only). | -| `sync_interval` | `0` | Release re-scan interval in seconds, `0`..`2592000` (`0` = `mutable_ttl`). `github_rpm`/`github_deb`/`github_alpine` only; rejected at plan time elsewhere. | + patterns = [ + "acme/tools/releases/download/.*\\.rpm$", + ] +} -## Notes +# Metadata-only remote: scans acme/tools releases for .rpm assets and serves a +# synthesized yum repo. Packages are never precached; downloads 302-redirect to +# the "github" remote above. +resource "artifactapi_remote_github_rpm" "acme_tools" { + name = "acme-tools" + base_url = "https://api.github.com/repos/acme/tools" + description = "acme/tools GitHub releases as a yum repo" + releases_remote = artifactapi_remote_generic.github.name -`artifactapi_remote_github_rpm` exposes a GitHub repo's releases as a `dnf`/`yum` -repository without precaching packages. Set `base_url` to the releases API root -(`https://api.github.com/repos/{owner}/{repo}`) and `releases_remote` to a -generic `github.com` remote that streams the `.rpm` bytes. `patterns` filters -which release assets become packages (regex on asset filename). `password` may -hold a token for private repos or higher API rate limits. See -`examples/resources/artifactapi_remote_github_rpm/main.tf`. + mutable_ttl = 3600 -## Example + # Optional: re-scan releases every 15 minutes, cache the generated repodata, + # and let virtuals serve the last good index while this remote refreshes. + sync_interval = 900 + cache_repodata = true + serve_stale = true -See `examples/resources/artifactapi_remote_github_rpm/main.tf`. + # Optional: restrict which release assets become packages. + patterns = [ + ".*\\.x86_64\\.rpm$", + ".*\\.noarch\\.rpm$", + ] + + # Optional: token for private repos / higher GitHub API rate limits. + # password = var.github_token +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_github_rpm.acme_tools acme-tools +``` diff --git a/docs/resources/remote_goproxy.md b/docs/resources/remote_goproxy.md index 0818100..5a8c589 100644 --- a/docs/resources/remote_goproxy.md +++ b/docs/resources/remote_goproxy.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_goproxy` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_goproxy Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI goproxy remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_goproxy (Resource) -## Common Attributes +Manages an ArtifactAPI goproxy remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# Go module proxy remote proxies a Go module proxy. +# The provider knows @v/list is mutable; .zip, .mod, and .info files are immutable. +resource "artifactapi_remote_goproxy" "goproxy" { + name = "goproxy" + base_url = "https://proxy.golang.org" + description = "Go module proxy" -See `examples/resources/artifactapi_remote_goproxy/main.tf`. + immutable_ttl = 0 + mutable_ttl = 300 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_goproxy.goproxy goproxy +``` diff --git a/docs/resources/remote_helm.md b/docs/resources/remote_helm.md index 0972603..6c81eb5 100644 --- a/docs/resources/remote_helm.md +++ b/docs/resources/remote_helm.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_helm` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_helm Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI helm remote, a caching proxy for an upstream repository. index.yaml is mutable; chart archives are immutable. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_helm (Resource) -## Common Attributes +Manages an ArtifactAPI helm remote, a caching proxy for an upstream repository. `index.yaml` is mutable; chart archives are immutable. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# Helm remote proxies a Helm chart repository. +# The provider knows index.yaml is mutable; chart tarballs are immutable. +resource "artifactapi_remote_helm" "jetstack" { + name = "jetstack" + base_url = "https://charts.jetstack.io" + description = "Jetstack Helm charts (cert-manager)" -See `examples/resources/artifactapi_remote_helm/main.tf`. + immutable_ttl = 0 + mutable_ttl = 3600 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_helm.jetstack jetstack +``` diff --git a/docs/resources/remote_npm.md b/docs/resources/remote_npm.md index fb6bd27..1fa68e1 100644 --- a/docs/resources/remote_npm.md +++ b/docs/resources/remote_npm.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_npm` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_npm Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI npm remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_npm (Resource) -## Common Attributes +Manages an ArtifactAPI npm remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# NPM remote proxies an npm registry. +# The provider knows package metadata is mutable; tarballs are immutable. +resource "artifactapi_remote_npm" "npmjs" { + name = "npmjs" + base_url = "https://registry.npmjs.org" + description = "npm public registry" -See `examples/resources/artifactapi_remote_npm/main.tf`. + immutable_ttl = 0 + mutable_ttl = 900 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_npm.npmjs npmjs +``` diff --git a/docs/resources/remote_puppet.md b/docs/resources/remote_puppet.md index 972fcab..22719e7 100644 --- a/docs/resources/remote_puppet.md +++ b/docs/resources/remote_puppet.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_puppet` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_puppet Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI puppet remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_puppet (Resource) -## Common Attributes +Manages an ArtifactAPI puppet remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# Puppet remote proxies a Puppet Forge repository. +# The provider knows module metadata is mutable; release tarballs are immutable. +resource "artifactapi_remote_puppet" "puppet_forge" { + name = "puppet-forge" + base_url = "https://forgeapi.puppet.com" + description = "Puppet Forge module repository" -See `examples/resources/artifactapi_remote_puppet/main.tf`. + immutable_ttl = 0 + mutable_ttl = 3600 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_puppet.puppet_forge puppet-forge +``` diff --git a/docs/resources/remote_pypi.md b/docs/resources/remote_pypi.md index 17d025f..392ebb6 100644 --- a/docs/resources/remote_pypi.md +++ b/docs/resources/remote_pypi.md @@ -1,31 +1,72 @@ -# `artifactapi_remote_pypi` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_pypi Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI pypi remote, a caching proxy for an upstream repository. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_pypi (Resource) -## Common Attributes +Manages an ArtifactAPI pypi remote, a caching proxy for an upstream repository. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# PyPI remote proxies a Python package index. +# The provider knows /simple/ index pages are mutable; sdists and wheels are immutable. +resource "artifactapi_remote_pypi" "pypi" { + name = "pypi" + base_url = "https://pypi.org" + description = "Python Package Index" -See `examples/resources/artifactapi_remote_pypi/main.tf`. + immutable_ttl = 0 + mutable_ttl = 900 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_pypi.pypi pypi +``` diff --git a/docs/resources/remote_rpm.md b/docs/resources/remote_rpm.md index fcdcc46..6690efc 100644 --- a/docs/resources/remote_rpm.md +++ b/docs/resources/remote_rpm.md @@ -1,54 +1,83 @@ -# `artifactapi_remote_rpm` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_rpm Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI rpm remote, a caching proxy for an upstream repository. repodata/* is mutable and packages are immutable. Supports mirrorlist and mirror_strategy. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_rpm (Resource) -## Common Attributes +Manages an ArtifactAPI rpm remote, a caching proxy for an upstream repository. `repodata/*` is mutable and packages are immutable. Supports `mirrorlist` and `mirror_strategy`. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## rpm / deb / alpine-specific Attributes +```terraform +# 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://repo.almalinux.org/almalinux" + description = "AlmaLinux RPM package repository" -| Attribute | Default | Description | -|-------------------|---------------|-------------------------------------------------------------------------------------------------| -| `mirrorlist` | | Extra upstream mirror base URLs. Requests are load-balanced with failover across `base_url` + `mirrorlist`. | -| `mirror_strategy` | `round_robin` | Mirror load-balancing strategy across `base_url` + `mirrorlist`. One of `round_robin` or `least_conn`. | - -Only valid on the `artifactapi_remote_rpm`, `artifactapi_remote_deb`, and -`artifactapi_remote_alpine` resources. Setting either on any other remote type is -rejected at plan time. - -```hcl -resource "artifactapi_remote_rpm" "epel" { - name = "epel-9" - base_url = "https://download.example.com/pub/epel/9/Everything/x86_64" + # Extra mirrors; requests are load-balanced with failover across + # base_url + mirrorlist (rpm/deb/alpine remotes only). mirrorlist = [ - "https://mirror-a.example.net/epel/9/Everything/x86_64", - "https://mirror-b.example.org/epel/9/Everything/x86_64", + "https://mirror-a.example.net/almalinux", + "https://mirror-b.example.org/almalinux", ] + + # Load-balancing strategy across base_url + mirrorlist: + # "round_robin" (default) or "least_conn". mirror_strategy = "least_conn" + + immutable_ttl = 0 + mutable_ttl = 7200 } ``` -## Example + +## Schema -See `examples/resources/artifactapi_remote_rpm/main.tf`. +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_rpm.almalinux almalinux +``` diff --git a/docs/resources/remote_terraform.md b/docs/resources/remote_terraform.md index e1a2177..1fbada7 100644 --- a/docs/resources/remote_terraform.md +++ b/docs/resources/remote_terraform.md @@ -1,37 +1,90 @@ -# `artifactapi_remote_terraform` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_terraform Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI terraform remote, a caching proxy for an upstream repository. Provider download URLs are rewritten to the generic remote named in releases_remote. +--- -Per-type remote resources manage upstream repository proxies. Each type applies its own mutability classification rules automatically (e.g., Docker classifies tag manifests as mutable and blobs as immutable; Helm classifies `index.yaml` as mutable). +# artifactapi_remote_terraform (Resource) -## Common Attributes +Manages an ArtifactAPI terraform remote, a caching proxy for an upstream repository. Provider download URLs are rewritten to the generic remote named in `releases_remote`. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Terraform / github_rpm / github_deb / github_alpine-specific Attributes +```terraform +# A generic remote is needed for the releases CDN that the Terraform registry +# redirects provider downloads to. +resource "artifactapi_remote_generic" "hashicorp_releases" { + name = "hashicorp-releases" + base_url = "https://releases.hashicorp.com" + description = "HashiCorp product releases" -| Attribute | Default | Description | -|-------------------|---------|----------------------------------------------------------| -| `releases_remote` | `""` | Name of a backend remote that serves the download bytes. Terraform uses it for download URL rewriting; `github_rpm`/`github_deb`/`github_alpine` 302-redirect `.rpm`/`.deb`/`.apk` downloads to it. | + immutable_ttl = 0 + mutable_ttl = 7200 -## Example + patterns = [ + "terraform/.*terraform_.*_linux_amd64\\.zip$", + "vault/.*vault_.*_linux_amd64\\.zip$", + ] +} -See `examples/resources/artifactapi_remote_terraform/main.tf`. +# Terraform registry remote proxies the Terraform provider registry. +# The releases_remote attribute points to a generic remote that serves +# the actual provider/module archives after URL rewriting. +resource "artifactapi_remote_terraform" "terraform_registry" { + name = "terraform-registry" + base_url = "https://registry.terraform.io" + description = "Terraform provider registry" + releases_remote = artifactapi_remote_generic.hashicorp_releases.name + + immutable_ttl = 0 + mutable_ttl = 300 +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_terraform.terraform_registry terraform-registry +``` diff --git a/docs/resources/remote_vcs.md b/docs/resources/remote_vcs.md index 35b5de8..3f3dbd6 100644 --- a/docs/resources/remote_vcs.md +++ b/docs/resources/remote_vcs.md @@ -1,31 +1,75 @@ -# `artifactapi_remote_vcs` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_remote_vcs Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI vcs remote, a caching proxy for an upstream repository. Caches GitHub (base_url = "https://github.com") or Gitea source archives and release assets. Tag, commit and release-download paths are immutable; branch archives redirect to the archive of the branch's current commit, re-resolved after mutable_ttl. +--- -Caches GitHub (`base_url = "https://github.com"`) or Gitea source archives and release assets. Tag, commit and release-download paths are immutable; branch archives redirect to the archive of the branch's current commit, re-resolved after `mutable_ttl`. Paths: [vcs remote](https://git.unkin.net/unkin/artifactapi/src/branch/master/docs/vcs/remote.md). +# artifactapi_remote_vcs (Resource) -## Common Attributes +Manages an ArtifactAPI vcs remote, a caching proxy for an upstream repository. Caches GitHub (`base_url = "https://github.com"`) or Gitea source archives and release assets. Tag, commit and release-download paths are immutable; branch archives redirect to the archive of the branch's current commit, re-resolved after `mutable_ttl`. -| Attribute | Required | Default | Description | -|----------------------|----------|---------|-------------------------------------------------------------------| -| `name` | Yes | | Unique name (forces replacement on change) | -| `base_url` | Yes | | Upstream repository URL | -| `description` | No | `""` | Human-readable description | -| `username` | No | `""` | Upstream auth username (sensitive) | -| `password` | No | `""` | Upstream auth password (sensitive) | -| `immutable_ttl` | No | `0` | TTL in seconds for immutable artifacts (0 = cache forever) | -| `mutable_ttl` | No | `3600` | TTL in seconds for mutable artifacts | -| `check_mutable` | No | `true` | Enable conditional revalidation for mutable artifacts | -| `patterns` | No | | Allowlist of path patterns to proxy (empty = all) | -| `blocklist` | No | | Paths to always deny (checked before patterns) | -| `mutable_patterns` | No | | Override: treat matching paths as mutable | -| `immutable_patterns` | No | | Override: treat matching paths as immutable | -| `quarantine_enabled` | No | `false` | Enable quarantine for new artifacts | -| `quarantine_days` | No | `3` | Days to quarantine new artifacts | -| `stale_on_error` | No | `true` | Serve stale cache when upstream is unreachable | -| `serve_stale` | No | `false` | Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes | -| `upstream_dial_timeout` | No | `0` | Upstream TCP connect timeout in seconds (0 = server default) | -| `upstream_tls_timeout` | No | `0` | Upstream TLS handshake timeout in seconds (0 = server default) | -| `upstream_response_header_timeout` | No | `0` | Upstream response-header timeout in seconds (0 = server default) | +## Example Usage -## Example +```terraform +# VCS remote caches GitHub/Gitea source archives and release assets. +# Tag, commit and release paths are immutable; branch archives redirect to +# the archive of the branch's current commit, re-resolved after mutable_ttl. +resource "artifactapi_remote_vcs" "github" { + name = "github-vcs" + base_url = "https://github.com" + description = "GitHub source archives and release assets" -See `examples/resources/artifactapi_remote_vcs/main.tf`. + immutable_ttl = 0 + mutable_ttl = 600 + + patterns = ["^cli/cli/", "^psf/requests/"] +} +``` + + +## Schema + +### Required + +- `base_url` (String) Upstream repository base URL. +- `name` (String) Unique name of the remote. + +### Optional + +- `ban_tags` (List of String) Tags to ban (docker only). +- `ban_tags_enabled` (Boolean) Enable tag banning (docker only). +- `blocklist` (List of String) Paths to always deny (checked before patterns). +- `cache_repodata` (Boolean) Cache generated repodata (github_rpm only). +- `check_mutable` (Boolean) Enable conditional revalidation for mutable artifacts. +- `description` (String) Human-readable description. +- `immutable_patterns` (List of String) Override: paths that should be immutable even if the provider would classify as mutable. +- `immutable_ttl` (Number) TTL in seconds for immutable artifacts (0 = forever). +- `mirror_strategy` (String) Mirror load-balancing strategy across base_url + mirrorlist; only valid on remote rpm/deb/apk (alpine) repos. One of "round_robin" (default) or "least_conn". +- `mirrorlist` (List of String) Extra upstream mirror base URLs; only valid on remote rpm/deb/apk (alpine) repos. Requests are load-balanced with failover across base_url + mirrorlist. +- `mutable_patterns` (List of String) Override: paths that should be mutable even if the provider would classify as immutable. +- `mutable_ttl` (Number) TTL in seconds for mutable artifacts. +- `password` (String, Sensitive) Password or token for upstream authentication. +- `patterns` (List of String) Paths to proxy (empty = all). This is the allowlist. +- `quarantine_days` (Number) Days to quarantine new artifacts when `quarantine_enabled` is set. +- `quarantine_enabled` (Boolean) Hold newly published upstream artifacts back until they are `quarantine_days` old. +- `releases_remote` (String) Name of a backend remote that serves the actual download bytes. Used by the terraform remote (download URL rewriting) and the github_rpm/github_deb/github_alpine remotes (302 redirect of .rpm/.deb/.apk downloads to a generic github.com remote). +- `serve_stale` (Boolean) Let rpm/deb/alpine virtuals serve this member's last good index while it refreshes. +- `stale_on_error` (Boolean) Serve stale cached content when upstream is unreachable. +- `sync_interval` (Number) Release re-scan interval in seconds, 0..2592000 (0 = mutable_ttl); github_rpm/github_deb/github_alpine only. +- `upstream_dial_timeout` (Number) Upstream TCP connect timeout in seconds (0 = server default). +- `upstream_response_header_timeout` (Number) Upstream response-header timeout in seconds (0 = server default). +- `upstream_tls_timeout` (Number) Upstream TLS handshake timeout in seconds (0 = server default). +- `username` (String, Sensitive) Username for upstream authentication. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_remote_vcs.github github-vcs +``` diff --git a/docs/resources/virtual.md b/docs/resources/virtual.md index f1c0c41..f0ac693 100644 --- a/docs/resources/virtual.md +++ b/docs/resources/virtual.md @@ -1,12 +1,44 @@ -# `artifactapi_virtual` +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "artifactapi_virtual Resource - artifactapi" +subcategory: "" +description: |- + Manages an ArtifactAPI virtual repository that merges multiple remotes. +--- -Virtual repositories merge multiple remotes of the same package type into a single endpoint. +# artifactapi_virtual (Resource) -```hcl +Manages an ArtifactAPI virtual repository that merges multiple remotes. + +## Example Usage + +```terraform +# Helm remotes to be merged into a virtual repository +resource "artifactapi_remote_helm" "jetstack" { + name = "jetstack" + base_url = "https://charts.jetstack.io" + description = "Jetstack Helm charts (cert-manager)" + + immutable_ttl = 0 + mutable_ttl = 3600 +} + +resource "artifactapi_remote_helm" "hashicorp_helm" { + name = "hashicorp-helm" + base_url = "https://helm.releases.hashicorp.com" + description = "HashiCorp Helm charts" + + immutable_ttl = 0 + mutable_ttl = 3600 +} + +# Virtual repository merges multiple remotes of the same package type +# into a single endpoint. Earlier members have higher priority for +# duplicate entries. resource "artifactapi_virtual" "helm" { name = "helm" package_type = "helm" - description = "All helm repos merged" + description = "All Helm repos merged" members = [ artifactapi_remote_helm.jetstack.name, @@ -15,10 +47,27 @@ resource "artifactapi_virtual" "helm" { } ``` -| Attribute | Required | Description | -|----------------|----------|-------------------------------------------| -| `name` | Yes | Unique name (forces replacement on change)| -| `package_type` | Yes | Package type of member remotes | -| `description` | No | Human-readable description | -| `members` | Yes | List of remote names to include | -| `parallel_fetch` | No | Fetch each member's index files concurrently (rpm/deb); default `false` | + +## Schema + +### Required + +- `members` (List of String) Ordered list of member remote names. Earlier members have higher priority for duplicate entries. +- `name` (String) Unique name of the virtual repository. +- `package_type` (String) Package type (must match member remotes): helm, pypi. + +### Optional + +- `description` (String) Human-readable description. +- `parallel_fetch` (Boolean) Fetch each member's index files concurrently. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import by name. +terraform import artifactapi_virtual.helm helm +``` diff --git a/examples/data-sources/artifactapi_remote/main.tf b/examples/data-sources/artifactapi_remote/data-source.tf similarity index 62% rename from examples/data-sources/artifactapi_remote/main.tf rename to examples/data-sources/artifactapi_remote/data-source.tf index a0de77c..a69fab9 100644 --- a/examples/data-sources/artifactapi_remote/main.tf +++ b/examples/data-sources/artifactapi_remote/data-source.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Read the configuration of an existing remote by name. # All fields (base_url, package_type, TTLs, patterns, etc.) are available # as computed attributes. diff --git a/examples/data-sources/artifactapi_virtual/main.tf b/examples/data-sources/artifactapi_virtual/data-source.tf similarity index 59% rename from examples/data-sources/artifactapi_virtual/main.tf rename to examples/data-sources/artifactapi_virtual/data-source.tf index 885c6b8..36edb92 100644 --- a/examples/data-sources/artifactapi_virtual/main.tf +++ b/examples/data-sources/artifactapi_virtual/data-source.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Read the configuration of an existing virtual repository by name. # Returns the package type, description, and ordered member list. data "artifactapi_virtual" "helm" { diff --git a/examples/main.tf b/examples/main.tf deleted file mode 100644 index 7be98a6..0000000 --- a/examples/main.tf +++ /dev/null @@ -1,205 +0,0 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" - # token is read from ARTIFACTAPI_TOKEN when unset -} - -# --------------------------------------------------------------------------- -# Generic remotes -# --------------------------------------------------------------------------- - -resource "artifactapi_remote_generic" "github" { - name = "github" - base_url = "https://github.com" - description = "GitHub releases" - - immutable_ttl = 0 - mutable_ttl = 7200 - - patterns = [ - "ducaale/xh/.*/xh-.*-x86_64-unknown-linux-musl.tar.gz$", - "mikefarah/yq/.*/yq_linux_amd64$", - "neovim/neovim-releases/.*/nvim-linux-x86_64.tar.gz$", - ] - - mutable_patterns = [ - ".*/archive/refs/heads/.*\\.tar\\.gz$", - ] -} - -resource "artifactapi_remote_generic" "hashicorp_releases" { - name = "hashicorp-releases" - base_url = "https://releases.hashicorp.com" - description = "HashiCorp product releases" - - immutable_ttl = 0 - mutable_ttl = 7200 - - patterns = [ - "terraform/.*terraform_.*_linux_amd64\\.zip$", - "vault/.*vault_.*_linux_amd64\\.zip$", - ] -} - -# --------------------------------------------------------------------------- -# Docker -# --------------------------------------------------------------------------- - -resource "artifactapi_remote_docker" "dockerhub" { - name = "dockerhub" - base_url = "https://registry-1.docker.io" - description = "Docker Hub registry" - - immutable_ttl = 0 - mutable_ttl = 300 - ban_tags_enabled = true - ban_tags = ["latest"] - - patterns = [ - "^library/almalinux", - "^library/postgres", - "^library/redis", - "^bitnami/", - ] -} - -# --------------------------------------------------------------------------- -# Helm -# --------------------------------------------------------------------------- - -resource "artifactapi_remote_helm" "jetstack" { - name = "jetstack" - base_url = "https://charts.jetstack.io" - description = "Jetstack Helm charts (cert-manager)" - - immutable_ttl = 0 - mutable_ttl = 3600 -} - -resource "artifactapi_remote_helm" "hashicorp_helm" { - name = "hashicorp-helm" - base_url = "https://helm.releases.hashicorp.com" - description = "HashiCorp Helm charts" - - immutable_ttl = 0 - mutable_ttl = 3600 -} - -# --------------------------------------------------------------------------- -# Language package managers -# --------------------------------------------------------------------------- - -resource "artifactapi_remote_pypi" "pypi" { - name = "pypi" - base_url = "https://pypi.org" - description = "Python Package Index" - - immutable_ttl = 0 - mutable_ttl = 900 -} - -resource "artifactapi_remote_npm" "npmjs" { - name = "npmjs" - base_url = "https://registry.npmjs.org" - description = "npm public registry" - - immutable_ttl = 0 - mutable_ttl = 900 -} - -# --------------------------------------------------------------------------- -# OS package managers -# --------------------------------------------------------------------------- - -resource "artifactapi_remote_rpm" "almalinux" { - name = "almalinux" - base_url = "https://gsl-syd.mm.fcix.net/almalinux" - description = "AlmaLinux RPM package repository" - - immutable_ttl = 0 - mutable_ttl = 7200 -} - -resource "artifactapi_remote_alpine" "alpine" { - name = "alpine" - base_url = "https://dl-cdn.alpinelinux.org" - description = "Alpine Linux APK package repository" - - immutable_ttl = 0 - mutable_ttl = 7200 -} - -# --------------------------------------------------------------------------- -# Infrastructure tooling -# --------------------------------------------------------------------------- - -resource "artifactapi_remote_terraform" "terraform_registry" { - name = "terraform-registry" - base_url = "https://registry.terraform.io" - description = "Terraform provider registry" - releases_remote = artifactapi_remote_generic.hashicorp_releases.name - - immutable_ttl = 0 - mutable_ttl = 300 -} - -resource "artifactapi_remote_goproxy" "goproxy" { - name = "goproxy" - base_url = "https://proxy.golang.org" - description = "Go module proxy" - - immutable_ttl = 0 - mutable_ttl = 300 -} - -resource "artifactapi_remote_puppet" "puppet_forge" { - name = "puppet-forge" - base_url = "https://forgeapi.puppet.com" - description = "Puppet Forge module repository" - - immutable_ttl = 0 - mutable_ttl = 3600 -} - -# --------------------------------------------------------------------------- -# Virtual repositories -# --------------------------------------------------------------------------- - -resource "artifactapi_virtual" "helm" { - name = "helm" - package_type = "helm" - description = "All Helm repos merged" - - members = [ - artifactapi_remote_helm.jetstack.name, - artifactapi_remote_helm.hashicorp_helm.name, - ] -} - -# --------------------------------------------------------------------------- -# Data sources -# --------------------------------------------------------------------------- - -data "artifactapi_remote" "dockerhub" { - name = artifactapi_remote_docker.dockerhub.name -} - -data "artifactapi_virtual" "helm" { - name = artifactapi_virtual.helm.name -} - -output "dockerhub_base_url" { - value = data.artifactapi_remote.dockerhub.base_url -} - -output "helm_members" { - value = data.artifactapi_virtual.helm.members -} diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf new file mode 100644 index 0000000..297f2a8 --- /dev/null +++ b/examples/provider/provider.tf @@ -0,0 +1,12 @@ +terraform { + required_providers { + artifactapi = { + source = "IUCLabs/artifactapi" + } + } +} + +provider "artifactapi" { + endpoint = "https://artifactapi.example.com" + # token defaults to the ARTIFACTAPI_TOKEN environment variable +} diff --git a/examples/resources/artifactapi_local_alpine/import.sh b/examples/resources/artifactapi_local_alpine/import.sh new file mode 100644 index 0000000..ac415a8 --- /dev/null +++ b/examples/resources/artifactapi_local_alpine/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_alpine.internal alpine-internal diff --git a/examples/resources/artifactapi_local_alpine/main.tf b/examples/resources/artifactapi_local_alpine/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_alpine/main.tf rename to examples/resources/artifactapi_local_alpine/resource.tf diff --git a/examples/resources/artifactapi_local_ansible/import.sh b/examples/resources/artifactapi_local_ansible/import.sh new file mode 100644 index 0000000..e3315f8 --- /dev/null +++ b/examples/resources/artifactapi_local_ansible/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_ansible.internal ansible-internal diff --git a/examples/resources/artifactapi_local_ansible/main.tf b/examples/resources/artifactapi_local_ansible/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_ansible/main.tf rename to examples/resources/artifactapi_local_ansible/resource.tf diff --git a/examples/resources/artifactapi_local_deb/import.sh b/examples/resources/artifactapi_local_deb/import.sh new file mode 100644 index 0000000..fa4633f --- /dev/null +++ b/examples/resources/artifactapi_local_deb/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_deb.internal deb-internal diff --git a/examples/resources/artifactapi_local_deb/main.tf b/examples/resources/artifactapi_local_deb/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_deb/main.tf rename to examples/resources/artifactapi_local_deb/resource.tf diff --git a/examples/resources/artifactapi_local_docker/import.sh b/examples/resources/artifactapi_local_docker/import.sh new file mode 100644 index 0000000..419308e --- /dev/null +++ b/examples/resources/artifactapi_local_docker/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_docker.internal docker-internal diff --git a/examples/resources/artifactapi_local_docker/main.tf b/examples/resources/artifactapi_local_docker/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_docker/main.tf rename to examples/resources/artifactapi_local_docker/resource.tf diff --git a/examples/resources/artifactapi_local_gems/import.sh b/examples/resources/artifactapi_local_gems/import.sh new file mode 100644 index 0000000..5ced803 --- /dev/null +++ b/examples/resources/artifactapi_local_gems/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_gems.internal gems-internal diff --git a/examples/resources/artifactapi_local_gems/main.tf b/examples/resources/artifactapi_local_gems/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_gems/main.tf rename to examples/resources/artifactapi_local_gems/resource.tf diff --git a/examples/resources/artifactapi_local_generic/import.sh b/examples/resources/artifactapi_local_generic/import.sh new file mode 100644 index 0000000..1c32bf4 --- /dev/null +++ b/examples/resources/artifactapi_local_generic/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_generic.rootfs_images rootfs-images diff --git a/examples/resources/artifactapi_local_generic/main.tf b/examples/resources/artifactapi_local_generic/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_generic/main.tf rename to examples/resources/artifactapi_local_generic/resource.tf diff --git a/examples/resources/artifactapi_local_goproxy/import.sh b/examples/resources/artifactapi_local_goproxy/import.sh new file mode 100644 index 0000000..086999f --- /dev/null +++ b/examples/resources/artifactapi_local_goproxy/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_goproxy.internal go-internal diff --git a/examples/resources/artifactapi_local_goproxy/main.tf b/examples/resources/artifactapi_local_goproxy/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_goproxy/main.tf rename to examples/resources/artifactapi_local_goproxy/resource.tf diff --git a/examples/resources/artifactapi_local_helm/import.sh b/examples/resources/artifactapi_local_helm/import.sh new file mode 100644 index 0000000..49ac492 --- /dev/null +++ b/examples/resources/artifactapi_local_helm/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_helm.internal helm-internal diff --git a/examples/resources/artifactapi_local_helm/main.tf b/examples/resources/artifactapi_local_helm/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_helm/main.tf rename to examples/resources/artifactapi_local_helm/resource.tf diff --git a/examples/resources/artifactapi_local_npm/import.sh b/examples/resources/artifactapi_local_npm/import.sh new file mode 100644 index 0000000..043abbf --- /dev/null +++ b/examples/resources/artifactapi_local_npm/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_npm.internal npm-internal diff --git a/examples/resources/artifactapi_local_npm/main.tf b/examples/resources/artifactapi_local_npm/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_npm/main.tf rename to examples/resources/artifactapi_local_npm/resource.tf diff --git a/examples/resources/artifactapi_local_puppet/import.sh b/examples/resources/artifactapi_local_puppet/import.sh new file mode 100644 index 0000000..c13133b --- /dev/null +++ b/examples/resources/artifactapi_local_puppet/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_puppet.internal puppet-internal diff --git a/examples/resources/artifactapi_local_puppet/main.tf b/examples/resources/artifactapi_local_puppet/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_puppet/main.tf rename to examples/resources/artifactapi_local_puppet/resource.tf diff --git a/examples/resources/artifactapi_local_pypi/import.sh b/examples/resources/artifactapi_local_pypi/import.sh new file mode 100644 index 0000000..a5e15d5 --- /dev/null +++ b/examples/resources/artifactapi_local_pypi/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_pypi.internal pypi-internal diff --git a/examples/resources/artifactapi_local_pypi/main.tf b/examples/resources/artifactapi_local_pypi/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_pypi/main.tf rename to examples/resources/artifactapi_local_pypi/resource.tf diff --git a/examples/resources/artifactapi_local_rpm/import.sh b/examples/resources/artifactapi_local_rpm/import.sh new file mode 100644 index 0000000..ded50ff --- /dev/null +++ b/examples/resources/artifactapi_local_rpm/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_rpm.internal rpm-internal diff --git a/examples/resources/artifactapi_local_rpm/main.tf b/examples/resources/artifactapi_local_rpm/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_rpm/main.tf rename to examples/resources/artifactapi_local_rpm/resource.tf diff --git a/examples/resources/artifactapi_local_terraform/import.sh b/examples/resources/artifactapi_local_terraform/import.sh new file mode 100644 index 0000000..94cfe1f --- /dev/null +++ b/examples/resources/artifactapi_local_terraform/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_local_terraform.internal tf-internal diff --git a/examples/resources/artifactapi_local_terraform/main.tf b/examples/resources/artifactapi_local_terraform/resource.tf similarity index 100% rename from examples/resources/artifactapi_local_terraform/main.tf rename to examples/resources/artifactapi_local_terraform/resource.tf diff --git a/examples/resources/artifactapi_remote_alpine/import.sh b/examples/resources/artifactapi_remote_alpine/import.sh new file mode 100644 index 0000000..2e1f6c3 --- /dev/null +++ b/examples/resources/artifactapi_remote_alpine/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_alpine.alpine alpine diff --git a/examples/resources/artifactapi_remote_alpine/main.tf b/examples/resources/artifactapi_remote_alpine/resource.tf similarity index 60% rename from examples/resources/artifactapi_remote_alpine/main.tf rename to examples/resources/artifactapi_remote_alpine/resource.tf index fd55536..ec09f5e 100644 --- a/examples/resources/artifactapi_remote_alpine/main.tf +++ b/examples/resources/artifactapi_remote_alpine/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Alpine remote proxies an Alpine Linux APK repository. # The provider knows APKINDEX.tar.gz is mutable; .apk packages are immutable. resource "artifactapi_remote_alpine" "alpine" { diff --git a/examples/resources/artifactapi_remote_ansible/import.sh b/examples/resources/artifactapi_remote_ansible/import.sh new file mode 100644 index 0000000..ae235dd --- /dev/null +++ b/examples/resources/artifactapi_remote_ansible/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_ansible.galaxy galaxy diff --git a/examples/resources/artifactapi_remote_ansible/main.tf b/examples/resources/artifactapi_remote_ansible/resource.tf similarity index 58% rename from examples/resources/artifactapi_remote_ansible/main.tf rename to examples/resources/artifactapi_remote_ansible/resource.tf index 1ab408f..2b5c43f 100644 --- a/examples/resources/artifactapi_remote_ansible/main.tf +++ b/examples/resources/artifactapi_remote_ansible/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Ansible remote proxies the Galaxy v3 collections API. # The provider knows JSON metadata is mutable; collection tarballs are immutable. resource "artifactapi_remote_ansible" "galaxy" { diff --git a/examples/resources/artifactapi_remote_cargo/import.sh b/examples/resources/artifactapi_remote_cargo/import.sh new file mode 100644 index 0000000..cd999cb --- /dev/null +++ b/examples/resources/artifactapi_remote_cargo/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_cargo.crates_io crates-io diff --git a/examples/resources/artifactapi_remote_cargo/main.tf b/examples/resources/artifactapi_remote_cargo/resource.tf similarity index 58% rename from examples/resources/artifactapi_remote_cargo/main.tf rename to examples/resources/artifactapi_remote_cargo/resource.tf index 0be77c9..d21a668 100644 --- a/examples/resources/artifactapi_remote_cargo/main.tf +++ b/examples/resources/artifactapi_remote_cargo/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Cargo remote proxies a crates.io sparse registry. # The provider knows index files are mutable; .crate downloads are immutable. resource "artifactapi_remote_cargo" "crates_io" { diff --git a/examples/resources/artifactapi_remote_deb/import.sh b/examples/resources/artifactapi_remote_deb/import.sh new file mode 100644 index 0000000..4819ec2 --- /dev/null +++ b/examples/resources/artifactapi_remote_deb/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_deb.debian debian diff --git a/examples/resources/artifactapi_remote_deb/main.tf b/examples/resources/artifactapi_remote_deb/resource.tf similarity index 60% rename from examples/resources/artifactapi_remote_deb/main.tf rename to examples/resources/artifactapi_remote_deb/resource.tf index 281ec83..c5e0f98 100644 --- a/examples/resources/artifactapi_remote_deb/main.tf +++ b/examples/resources/artifactapi_remote_deb/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Deb remote proxies a Debian/apt package repository. # The provider knows the index files (Release, Packages) are mutable; .deb packages are immutable. resource "artifactapi_remote_deb" "debian" { diff --git a/examples/resources/artifactapi_remote_docker/import.sh b/examples/resources/artifactapi_remote_docker/import.sh new file mode 100644 index 0000000..eb90fd7 --- /dev/null +++ b/examples/resources/artifactapi_remote_docker/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_docker.dockerhub dockerhub diff --git a/examples/resources/artifactapi_remote_docker/main.tf b/examples/resources/artifactapi_remote_docker/resource.tf similarity index 68% rename from examples/resources/artifactapi_remote_docker/main.tf rename to examples/resources/artifactapi_remote_docker/resource.tf index 25e783d..74c53cd 100644 --- a/examples/resources/artifactapi_remote_docker/main.tf +++ b/examples/resources/artifactapi_remote_docker/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Docker remote proxies a container registry. # The provider auto-classifies: tag manifests are mutable, blobs are immutable. resource "artifactapi_remote_docker" "dockerhub" { diff --git a/examples/resources/artifactapi_remote_gems/import.sh b/examples/resources/artifactapi_remote_gems/import.sh new file mode 100644 index 0000000..2949bb5 --- /dev/null +++ b/examples/resources/artifactapi_remote_gems/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_gems.rubygems rubygems diff --git a/examples/resources/artifactapi_remote_gems/main.tf b/examples/resources/artifactapi_remote_gems/resource.tf similarity index 56% rename from examples/resources/artifactapi_remote_gems/main.tf rename to examples/resources/artifactapi_remote_gems/resource.tf index 7b97e56..e484ff7 100644 --- a/examples/resources/artifactapi_remote_gems/main.tf +++ b/examples/resources/artifactapi_remote_gems/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Gems remote proxies a RubyGems source. # The provider knows the compact index is mutable; .gem downloads are immutable. resource "artifactapi_remote_gems" "rubygems" { diff --git a/examples/resources/artifactapi_remote_generic/import.sh b/examples/resources/artifactapi_remote_generic/import.sh new file mode 100644 index 0000000..85ce82e --- /dev/null +++ b/examples/resources/artifactapi_remote_generic/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_generic.github github diff --git a/examples/resources/artifactapi_remote_generic/main.tf b/examples/resources/artifactapi_remote_generic/resource.tf similarity index 72% rename from examples/resources/artifactapi_remote_generic/main.tf rename to examples/resources/artifactapi_remote_generic/resource.tf index 10b819f..05fe62d 100644 --- a/examples/resources/artifactapi_remote_generic/main.tf +++ b/examples/resources/artifactapi_remote_generic/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # A generic remote proxies arbitrary HTTP endpoints. # Patterns act as an allowlist; everything matching is immutable by default. resource "artifactapi_remote_generic" "github" { diff --git a/examples/resources/artifactapi_remote_github_alpine/import.sh b/examples/resources/artifactapi_remote_github_alpine/import.sh new file mode 100644 index 0000000..7621962 --- /dev/null +++ b/examples/resources/artifactapi_remote_github_alpine/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_github_alpine.acme_tools acme-tools diff --git a/examples/resources/artifactapi_remote_github_alpine/main.tf b/examples/resources/artifactapi_remote_github_alpine/resource.tf similarity index 54% rename from examples/resources/artifactapi_remote_github_alpine/main.tf rename to examples/resources/artifactapi_remote_github_alpine/resource.tf index 0d60b6c..45e20d8 100644 --- a/examples/resources/artifactapi_remote_github_alpine/main.tf +++ b/examples/resources/artifactapi_remote_github_alpine/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Backend generic remote that serves the actual .apk bytes from github.com. # Its patterns must allowlist the target repo's release-download assets. resource "artifactapi_remote_generic" "github" { @@ -18,17 +5,17 @@ resource "artifactapi_remote_generic" "github" { base_url = "https://github.com" patterns = [ - "goodtune/ghp/releases/download/.*\\.apk$", + "acme/tools/releases/download/.*\\.apk$", ] } -# Metadata-only remote: scans goodtune/ghp releases for .apk assets and serves a +# Metadata-only remote: scans acme/tools releases for .apk assets and serves a # synthesized apk repo (APKINDEX). Packages are never precached; downloads # 302-redirect to the "github" remote above. -resource "artifactapi_remote_github_alpine" "goodtune_ghp" { - name = "goodtune-ghp" - base_url = "https://api.github.com/repos/goodtune/ghp" - description = "goodtune/ghp GitHub releases as an apk repo" +resource "artifactapi_remote_github_alpine" "acme_tools" { + name = "acme-tools" + base_url = "https://api.github.com/repos/acme/tools" + description = "acme/tools GitHub releases as an apk repo" releases_remote = artifactapi_remote_generic.github.name mutable_ttl = 3600 diff --git a/examples/resources/artifactapi_remote_github_deb/import.sh b/examples/resources/artifactapi_remote_github_deb/import.sh new file mode 100644 index 0000000..8d6c59e --- /dev/null +++ b/examples/resources/artifactapi_remote_github_deb/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_github_deb.acme_tools acme-tools diff --git a/examples/resources/artifactapi_remote_github_deb/main.tf b/examples/resources/artifactapi_remote_github_deb/resource.tf similarity index 54% rename from examples/resources/artifactapi_remote_github_deb/main.tf rename to examples/resources/artifactapi_remote_github_deb/resource.tf index 41da707..a29d440 100644 --- a/examples/resources/artifactapi_remote_github_deb/main.tf +++ b/examples/resources/artifactapi_remote_github_deb/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Backend generic remote that serves the actual .deb bytes from github.com. # Its patterns must allowlist the target repo's release-download assets. resource "artifactapi_remote_generic" "github" { @@ -18,17 +5,17 @@ resource "artifactapi_remote_generic" "github" { base_url = "https://github.com" patterns = [ - "goodtune/ghp/releases/download/.*\\.deb$", + "acme/tools/releases/download/.*\\.deb$", ] } -# Metadata-only remote: scans goodtune/ghp releases for .deb assets and serves a +# Metadata-only remote: scans acme/tools releases for .deb assets and serves a # synthesized apt repo. Packages are never precached; downloads 302-redirect to # the "github" remote above. -resource "artifactapi_remote_github_deb" "goodtune_ghp" { - name = "goodtune-ghp" - base_url = "https://api.github.com/repos/goodtune/ghp" - description = "goodtune/ghp GitHub releases as an apt repo" +resource "artifactapi_remote_github_deb" "acme_tools" { + name = "acme-tools" + base_url = "https://api.github.com/repos/acme/tools" + description = "acme/tools GitHub releases as an apt repo" releases_remote = artifactapi_remote_generic.github.name mutable_ttl = 3600 diff --git a/examples/resources/artifactapi_remote_github_rpm/import.sh b/examples/resources/artifactapi_remote_github_rpm/import.sh new file mode 100644 index 0000000..48d47df --- /dev/null +++ b/examples/resources/artifactapi_remote_github_rpm/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_github_rpm.acme_tools acme-tools diff --git a/examples/resources/artifactapi_remote_github_rpm/main.tf b/examples/resources/artifactapi_remote_github_rpm/resource.tf similarity index 84% rename from examples/resources/artifactapi_remote_github_rpm/main.tf rename to examples/resources/artifactapi_remote_github_rpm/resource.tf index 8a7f761..2934bac 100644 --- a/examples/resources/artifactapi_remote_github_rpm/main.tf +++ b/examples/resources/artifactapi_remote_github_rpm/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Backend generic remote that serves the actual .rpm bytes from github.com. # Its patterns must allowlist the target repo's release-download assets. resource "artifactapi_remote_generic" "github" { diff --git a/examples/resources/artifactapi_remote_goproxy/import.sh b/examples/resources/artifactapi_remote_goproxy/import.sh new file mode 100644 index 0000000..827cc74 --- /dev/null +++ b/examples/resources/artifactapi_remote_goproxy/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_goproxy.goproxy goproxy diff --git a/examples/resources/artifactapi_remote_goproxy/main.tf b/examples/resources/artifactapi_remote_goproxy/resource.tf similarity index 58% rename from examples/resources/artifactapi_remote_goproxy/main.tf rename to examples/resources/artifactapi_remote_goproxy/resource.tf index d69449e..d3c15e6 100644 --- a/examples/resources/artifactapi_remote_goproxy/main.tf +++ b/examples/resources/artifactapi_remote_goproxy/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Go module proxy remote proxies a Go module proxy. # The provider knows @v/list is mutable; .zip, .mod, and .info files are immutable. resource "artifactapi_remote_goproxy" "goproxy" { diff --git a/examples/resources/artifactapi_remote_helm/import.sh b/examples/resources/artifactapi_remote_helm/import.sh new file mode 100644 index 0000000..dda8700 --- /dev/null +++ b/examples/resources/artifactapi_remote_helm/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_helm.jetstack jetstack diff --git a/examples/resources/artifactapi_remote_helm/main.tf b/examples/resources/artifactapi_remote_helm/resource.tf similarity index 58% rename from examples/resources/artifactapi_remote_helm/main.tf rename to examples/resources/artifactapi_remote_helm/resource.tf index f18698b..21998a2 100644 --- a/examples/resources/artifactapi_remote_helm/main.tf +++ b/examples/resources/artifactapi_remote_helm/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Helm remote proxies a Helm chart repository. # The provider knows index.yaml is mutable; chart tarballs are immutable. resource "artifactapi_remote_helm" "jetstack" { diff --git a/examples/resources/artifactapi_remote_npm/import.sh b/examples/resources/artifactapi_remote_npm/import.sh new file mode 100644 index 0000000..adb126d --- /dev/null +++ b/examples/resources/artifactapi_remote_npm/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_npm.npmjs npmjs diff --git a/examples/resources/artifactapi_remote_npm/main.tf b/examples/resources/artifactapi_remote_npm/resource.tf similarity index 56% rename from examples/resources/artifactapi_remote_npm/main.tf rename to examples/resources/artifactapi_remote_npm/resource.tf index 766503c..fcc0537 100644 --- a/examples/resources/artifactapi_remote_npm/main.tf +++ b/examples/resources/artifactapi_remote_npm/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # NPM remote proxies an npm registry. # The provider knows package metadata is mutable; tarballs are immutable. resource "artifactapi_remote_npm" "npmjs" { diff --git a/examples/resources/artifactapi_remote_puppet/import.sh b/examples/resources/artifactapi_remote_puppet/import.sh new file mode 100644 index 0000000..9313b06 --- /dev/null +++ b/examples/resources/artifactapi_remote_puppet/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_puppet.puppet_forge puppet-forge diff --git a/examples/resources/artifactapi_remote_puppet/main.tf b/examples/resources/artifactapi_remote_puppet/resource.tf similarity index 60% rename from examples/resources/artifactapi_remote_puppet/main.tf rename to examples/resources/artifactapi_remote_puppet/resource.tf index 39cf1cf..745992e 100644 --- a/examples/resources/artifactapi_remote_puppet/main.tf +++ b/examples/resources/artifactapi_remote_puppet/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Puppet remote proxies a Puppet Forge repository. # The provider knows module metadata is mutable; release tarballs are immutable. resource "artifactapi_remote_puppet" "puppet_forge" { diff --git a/examples/resources/artifactapi_remote_pypi/import.sh b/examples/resources/artifactapi_remote_pypi/import.sh new file mode 100644 index 0000000..55c1162 --- /dev/null +++ b/examples/resources/artifactapi_remote_pypi/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_pypi.pypi pypi diff --git a/examples/resources/artifactapi_remote_pypi/main.tf b/examples/resources/artifactapi_remote_pypi/resource.tf similarity index 57% rename from examples/resources/artifactapi_remote_pypi/main.tf rename to examples/resources/artifactapi_remote_pypi/resource.tf index e85f904..f6ead7e 100644 --- a/examples/resources/artifactapi_remote_pypi/main.tf +++ b/examples/resources/artifactapi_remote_pypi/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # PyPI remote proxies a Python package index. # The provider knows /simple/ index pages are mutable; sdists and wheels are immutable. resource "artifactapi_remote_pypi" "pypi" { diff --git a/examples/resources/artifactapi_remote_rpm/import.sh b/examples/resources/artifactapi_remote_rpm/import.sh new file mode 100644 index 0000000..1ff7e7b --- /dev/null +++ b/examples/resources/artifactapi_remote_rpm/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_rpm.almalinux almalinux diff --git a/examples/resources/artifactapi_remote_rpm/main.tf b/examples/resources/artifactapi_remote_rpm/resource.tf similarity index 59% rename from examples/resources/artifactapi_remote_rpm/main.tf rename to examples/resources/artifactapi_remote_rpm/resource.tf index 8c41e85..fe67cc0 100644 --- a/examples/resources/artifactapi_remote_rpm/main.tf +++ b/examples/resources/artifactapi_remote_rpm/resource.tf @@ -1,28 +1,15 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-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" + base_url = "https://repo.almalinux.org/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", + "https://mirror-a.example.net/almalinux", + "https://mirror-b.example.org/almalinux", ] # Load-balancing strategy across base_url + mirrorlist: diff --git a/examples/resources/artifactapi_remote_terraform/import.sh b/examples/resources/artifactapi_remote_terraform/import.sh new file mode 100644 index 0000000..2c51cfd --- /dev/null +++ b/examples/resources/artifactapi_remote_terraform/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_terraform.terraform_registry terraform-registry diff --git a/examples/resources/artifactapi_remote_terraform/main.tf b/examples/resources/artifactapi_remote_terraform/resource.tf similarity index 80% rename from examples/resources/artifactapi_remote_terraform/main.tf rename to examples/resources/artifactapi_remote_terraform/resource.tf index 3da3ebe..bb954a7 100644 --- a/examples/resources/artifactapi_remote_terraform/main.tf +++ b/examples/resources/artifactapi_remote_terraform/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # A generic remote is needed for the releases CDN that the Terraform registry # redirects provider downloads to. resource "artifactapi_remote_generic" "hashicorp_releases" { diff --git a/examples/resources/artifactapi_remote_vcs/import.sh b/examples/resources/artifactapi_remote_vcs/import.sh new file mode 100644 index 0000000..4c80d2d --- /dev/null +++ b/examples/resources/artifactapi_remote_vcs/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_remote_vcs.github github-vcs diff --git a/examples/resources/artifactapi_remote_vcs/main.tf b/examples/resources/artifactapi_remote_vcs/resource.tf similarity index 67% rename from examples/resources/artifactapi_remote_vcs/main.tf rename to examples/resources/artifactapi_remote_vcs/resource.tf index 565db88..4cf26dd 100644 --- a/examples/resources/artifactapi_remote_vcs/main.tf +++ b/examples/resources/artifactapi_remote_vcs/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # VCS remote caches GitHub/Gitea source archives and release assets. # Tag, commit and release paths are immutable; branch archives redirect to # the archive of the branch's current commit, re-resolved after mutable_ttl. diff --git a/examples/resources/artifactapi_virtual/import.sh b/examples/resources/artifactapi_virtual/import.sh new file mode 100644 index 0000000..e3bdcb1 --- /dev/null +++ b/examples/resources/artifactapi_virtual/import.sh @@ -0,0 +1,2 @@ +# Import by name. +terraform import artifactapi_virtual.helm helm diff --git a/examples/resources/artifactapi_virtual/main.tf b/examples/resources/artifactapi_virtual/resource.tf similarity index 79% rename from examples/resources/artifactapi_virtual/main.tf rename to examples/resources/artifactapi_virtual/resource.tf index 468a03f..dc80794 100644 --- a/examples/resources/artifactapi_virtual/main.tf +++ b/examples/resources/artifactapi_virtual/resource.tf @@ -1,16 +1,3 @@ -terraform { - required_providers { - artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" - } - } -} - -provider "artifactapi" { - endpoint = "https://artifactapi.example.com" -} - # Helm remotes to be merged into a virtual repository resource "artifactapi_remote_helm" "jetstack" { name = "jetstack" diff --git a/internal/provider/datasource_remote.go b/internal/provider/datasource_remote.go index 717462f..be5770d 100644 --- a/internal/provider/datasource_remote.go +++ b/internal/provider/datasource_remote.go @@ -29,33 +29,33 @@ func (d *remoteDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp.Schema = schema.Schema{ Description: "Read an existing ArtifactAPI remote.", Attributes: map[string]schema.Attribute{ - "name": schema.StringAttribute{Required: true}, - "package_type": schema.StringAttribute{Computed: true}, - "base_url": schema.StringAttribute{Computed: true}, - "mirrorlist": schema.ListAttribute{Computed: true, ElementType: types.StringType}, - "mirror_strategy": schema.StringAttribute{Computed: true}, - "description": schema.StringAttribute{Computed: true}, - "immutable_ttl": schema.Int64Attribute{Computed: true}, - "mutable_ttl": schema.Int64Attribute{Computed: true}, - "check_mutable": schema.BoolAttribute{Computed: true}, - "patterns": schema.ListAttribute{Computed: true, ElementType: types.StringType}, - "blocklist": schema.ListAttribute{Computed: true, ElementType: types.StringType}, - "mutable_patterns": schema.ListAttribute{Computed: true, ElementType: types.StringType}, - "immutable_patterns": schema.ListAttribute{Computed: true, ElementType: types.StringType}, - "ban_tags_enabled": schema.BoolAttribute{Computed: true}, - "ban_tags": schema.ListAttribute{Computed: true, ElementType: types.StringType}, - "quarantine_enabled": schema.BoolAttribute{Computed: true}, - "quarantine_days": schema.Int64Attribute{Computed: true}, - "stale_on_error": schema.BoolAttribute{Computed: true}, - "serve_stale": schema.BoolAttribute{Computed: true}, - "cache_repodata": schema.BoolAttribute{Computed: true}, - "sync_interval": schema.Int64Attribute{Computed: true}, - "releases_remote": schema.StringAttribute{Computed: true}, - "managed_by": schema.StringAttribute{Computed: true}, + "name": schema.StringAttribute{Required: true, Description: "Name of the remote to read."}, + "package_type": schema.StringAttribute{Computed: true, Description: "Package type of the repository (e.g. docker, helm, rpm)."}, + "base_url": schema.StringAttribute{Computed: true, Description: "Upstream repository base URL."}, + "mirrorlist": schema.ListAttribute{Computed: true, ElementType: types.StringType, Description: "Extra upstream mirror base URLs (rpm/deb/alpine only)."}, + "mirror_strategy": schema.StringAttribute{Computed: true, Description: "Mirror load-balancing strategy: round_robin or least_conn."}, + "description": schema.StringAttribute{Computed: true, Description: "Human-readable description."}, + "immutable_ttl": schema.Int64Attribute{Computed: true, Description: "TTL in seconds for immutable artifacts (0 = forever)."}, + "mutable_ttl": schema.Int64Attribute{Computed: true, Description: "TTL in seconds for mutable artifacts."}, + "check_mutable": schema.BoolAttribute{Computed: true, Description: "Whether mutable artifacts are conditionally revalidated."}, + "patterns": schema.ListAttribute{Computed: true, ElementType: types.StringType, Description: "Allowlist of paths to proxy (empty = all)."}, + "blocklist": schema.ListAttribute{Computed: true, ElementType: types.StringType, Description: "Paths that are always denied."}, + "mutable_patterns": schema.ListAttribute{Computed: true, ElementType: types.StringType, Description: "Paths forced to be treated as mutable."}, + "immutable_patterns": schema.ListAttribute{Computed: true, ElementType: types.StringType, Description: "Paths forced to be treated as immutable."}, + "ban_tags_enabled": schema.BoolAttribute{Computed: true, Description: "Whether tag banning is enabled (docker only)."}, + "ban_tags": schema.ListAttribute{Computed: true, ElementType: types.StringType, Description: "Banned tags (docker only)."}, + "quarantine_enabled": schema.BoolAttribute{Computed: true, Description: "Whether newly published upstream artifacts are quarantined."}, + "quarantine_days": schema.Int64Attribute{Computed: true, Description: "Days new artifacts are quarantined."}, + "stale_on_error": schema.BoolAttribute{Computed: true, Description: "Whether stale cached content is served when upstream is unreachable."}, + "serve_stale": schema.BoolAttribute{Computed: true, Description: "Whether rpm/deb/alpine virtuals serve this member's last good index while it refreshes."}, + "cache_repodata": schema.BoolAttribute{Computed: true, Description: "Whether generated repodata is cached (github_rpm only)."}, + "sync_interval": schema.Int64Attribute{Computed: true, Description: "Release re-scan interval in seconds (github_rpm/github_deb/github_alpine only)."}, + "releases_remote": schema.StringAttribute{Computed: true, Description: "Name of the backend remote that serves download bytes."}, + "managed_by": schema.StringAttribute{Computed: true, Description: "What manages the repository (e.g. terraform)."}, - "upstream_dial_timeout": schema.Int64Attribute{Computed: true}, - "upstream_tls_timeout": schema.Int64Attribute{Computed: true}, - "upstream_response_header_timeout": schema.Int64Attribute{Computed: true}, + "upstream_dial_timeout": schema.Int64Attribute{Computed: true, Description: "Upstream TCP connect timeout in seconds (0 = server default)."}, + "upstream_tls_timeout": schema.Int64Attribute{Computed: true, Description: "Upstream TLS handshake timeout in seconds (0 = server default)."}, + "upstream_response_header_timeout": schema.Int64Attribute{Computed: true, Description: "Upstream response-header timeout in seconds (0 = server default)."}, }, } } diff --git a/internal/provider/datasource_virtual.go b/internal/provider/datasource_virtual.go index 7514566..af33bd1 100644 --- a/internal/provider/datasource_virtual.go +++ b/internal/provider/datasource_virtual.go @@ -30,11 +30,11 @@ func (d *virtualDataSource) Schema(_ context.Context, _ datasource.SchemaRequest Description: "Read an existing ArtifactAPI virtual repository.", Attributes: map[string]schema.Attribute{ "name": schema.StringAttribute{Required: true, Description: "Virtual repository name."}, - "package_type": schema.StringAttribute{Computed: true}, - "description": schema.StringAttribute{Computed: true}, - "members": schema.ListAttribute{Computed: true, ElementType: types.StringType}, - "managed_by": schema.StringAttribute{Computed: true}, - "parallel_fetch": schema.BoolAttribute{Computed: true}, + "package_type": schema.StringAttribute{Computed: true, Description: "Package type of the virtual repository."}, + "description": schema.StringAttribute{Computed: true, Description: "Human-readable description."}, + "members": schema.ListAttribute{Computed: true, ElementType: types.StringType, Description: "Ordered list of member remote names."}, + "managed_by": schema.StringAttribute{Computed: true, Description: "What manages the repository (e.g. terraform)."}, + "parallel_fetch": schema.BoolAttribute{Computed: true, Description: "Whether member index files are fetched concurrently."}, }, } } diff --git a/internal/provider/provider.go b/internal/provider/provider.go index c2287f3..d5ad5d7 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -35,7 +35,7 @@ func (p *ArtifactAPIProvider) Metadata(_ context.Context, _ provider.MetadataReq func (p *ArtifactAPIProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) { resp.Schema = schema.Schema{ - Description: "Manage ArtifactAPI remotes and virtual repositories.", + Description: "Manage ArtifactAPI local, remote and virtual repositories.", Attributes: map[string]schema.Attribute{ "endpoint": schema.StringAttribute{ Description: "The ArtifactAPI server endpoint URL (e.g. https://artifactapi.example.com).", diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 1eba749..5dc6b78 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -82,6 +82,8 @@ func TestProvider_DataSources_Invariants(t *testing.T) { checkRegistered(t, names, "data-sources") } +var exampleFile = map[string]string{"resources": "resource.tf", "data-sources": "data-source.tf"} + func checkRegistered(t *testing.T, names []string, kind string) { t.Helper() if len(names) == 0 { @@ -99,7 +101,7 @@ func checkRegistered(t *testing.T, names []string, kind string) { t.Errorf("%s: duplicate type name %q", kind, n) } seen[n] = true - if _, err := os.Stat(filepath.Join("../../examples", kind, n, "main.tf")); err != nil { + if _, err := os.Stat(filepath.Join("../../examples", kind, n, exampleFile[kind])); err != nil { t.Errorf("%s: %s has no example: %v", kind, n, err) } if _, err := os.Stat(filepath.Join("../../docs", kind, strings.TrimPrefix(n, "artifactapi_")+".md")); err != nil { diff --git a/internal/provider/resource_remote.go b/internal/provider/resource_remote.go index df1892c..4a2c966 100644 --- a/internal/provider/resource_remote.go +++ b/internal/provider/resource_remote.go @@ -3,6 +3,7 @@ package provider import ( "context" "fmt" + "strings" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -26,6 +27,21 @@ var ( // base_url + mirrorlist for these. var mirrorlistPackageTypes = map[string]bool{"rpm": true, "deb": true, "alpine": true} +const githubReleasesNote = "Set `base_url` to the releases API root (`https://api.github.com/repos/{owner}/{repo}`) and `releases_remote` to a generic `github.com` remote that streams the package bytes; package downloads 302-redirect there. `patterns` filters which release assets become packages (regex on asset filename). `password` may hold a token for private repos or higher API rate limits." + +var remoteTypeNotes = map[string]string{ + "docker": "Tag manifests are mutable and blobs are immutable; `ban_tags` blocks specific tags.", + "helm": "`index.yaml` is mutable; chart archives are immutable.", + "rpm": "`repodata/*` is mutable and packages are immutable. Supports `mirrorlist` and `mirror_strategy`.", + "deb": "Supports `mirrorlist` and `mirror_strategy`.", + "alpine": "Supports `mirrorlist` and `mirror_strategy`.", + "terraform": "Provider download URLs are rewritten to the generic remote named in `releases_remote`.", + "github_rpm": "Exposes a GitHub repository's release `.rpm` assets as a dnf/yum repository without precaching packages. " + githubReleasesNote, + "github_deb": "Exposes a GitHub repository's release `.deb` assets as an apt repository, synthesising `Packages`/`Release` from release metadata. " + githubReleasesNote, + "github_alpine": "Exposes a GitHub repository's release `.apk` assets as an apk repository, synthesising `APKINDEX.tar.gz` from release metadata. " + githubReleasesNote, + "vcs": "Caches GitHub (`base_url = \"https://github.com\"`) or Gitea source archives and release assets. Tag, commit and release-download paths are immutable; branch archives redirect to the archive of the branch's current commit, re-resolved after `mutable_ttl`.", +} + // defaultMirrorStrategy is the API's server-side default for mirror_strategy // (stored NOT NULL DEFAULT 'round_robin' and always echoed back on read). const defaultMirrorStrategy = "round_robin" @@ -108,13 +124,16 @@ func (r *remoteResource) Schema(_ context.Context, _ resource.SchemaRequest, res Optional: true, Computed: true, Default: stringdefault.StaticString(defaultMirrorStrategy), }, "description": schema.StringAttribute{ - Optional: true, Computed: true, Default: stringdefault.StaticString(""), + Description: "Human-readable description.", + Optional: true, Computed: true, Default: stringdefault.StaticString(""), }, "username": schema.StringAttribute{ - Optional: true, Computed: true, Sensitive: true, Default: stringdefault.StaticString(""), + Description: "Username for upstream authentication.", + Optional: true, Computed: true, Sensitive: true, Default: stringdefault.StaticString(""), }, "password": schema.StringAttribute{ - Optional: true, Computed: true, Sensitive: true, Default: stringdefault.StaticString(""), + Description: "Password or token for upstream authentication.", + Optional: true, Computed: true, Sensitive: true, Default: stringdefault.StaticString(""), }, "immutable_ttl": schema.Int64Attribute{ Description: "TTL in seconds for immutable artifacts (0 = forever).", @@ -149,10 +168,12 @@ func (r *remoteResource) Schema(_ context.Context, _ resource.SchemaRequest, res ElementType: types.StringType, }, "quarantine_enabled": schema.BoolAttribute{ - Optional: true, Computed: true, Default: booldefault.StaticBool(false), + Description: "Hold newly published upstream artifacts back until they are `quarantine_days` old.", + Optional: true, Computed: true, Default: booldefault.StaticBool(false), }, "quarantine_days": schema.Int64Attribute{ - Optional: true, Computed: true, Default: int64default.StaticInt64(3), + Description: "Days to quarantine new artifacts when `quarantine_enabled` is set.", + Optional: true, Computed: true, Default: int64default.StaticInt64(3), }, "stale_on_error": schema.BoolAttribute{ Description: "Serve stale cached content when upstream is unreachable.", @@ -198,7 +219,7 @@ func (r *remoteResource) Schema(_ context.Context, _ resource.SchemaRequest, res } resp.Schema = schema.Schema{ - Description: fmt.Sprintf("Manages an ArtifactAPI %s remote.", r.packageType), + Description: strings.TrimSpace(fmt.Sprintf("Manages an ArtifactAPI %s remote, a caching proxy for an upstream repository. %s", r.packageType, remoteTypeNotes[r.packageType])), Attributes: attrs, } } -- 2.47.3 From c61dd5968d2c8eb8981524c0bc491c9d590929fe Mon Sep 17 00:00:00 2001 From: unkin-agent Date: Tue, 17 Nov 2026 06:30:40 +1100 Subject: [PATCH 3/3] Rewrite README and add MIT license --- LICENSE | 21 ++++++++++++++ README.md | 86 ++++++++++++++++++++++--------------------------------- 2 files changed, 56 insertions(+), 51 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..83ee371 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 IUCLabs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 4287ca4..dd13c77 100644 --- a/README.md +++ b/README.md @@ -1,75 +1,59 @@ -# terraform-provider-artifactapi +# Terraform Provider ArtifactAPI -Terraform provider for managing [ArtifactAPI](https://git.unkin.net/unkin/artifactapi) remotes and virtual repositories. +The ArtifactAPI provider manages repositories on an ArtifactAPI server: local +repositories that host packages directly, remotes that cache an upstream +(Docker, Helm, PyPI, npm, RPM, Deb, Alpine, Go, Terraform, GitHub releases and +more), and virtual repositories that merge several remotes behind one endpoint. +It works with Terraform and OpenTofu. -## Requirements - -- Go >= 1.23 -- Terraform >= 1.0 - -## Building - -```sh -make build -``` - -## Installation - -Install the provider to your local Terraform plugin directory: - -```sh -make install -``` - -This places the binary at `~/.terraform.d/plugins/git.unkin.net/unkin/artifactapi///`. - -A `make install` build is referenced with `source = "git.unkin.net/unkin/artifactapi"` (the provider address, matching that path); the `artifactapi.example.com/terraform-unkin/artifactapi` source below is for installing from an artifactapi registry. - -## Provider Configuration +## Quick start ```hcl terraform { required_providers { artifactapi = { - source = "artifactapi.example.com/terraform-unkin/artifactapi" - version = "0.0.1" + source = "IUCLabs/artifactapi" } } } provider "artifactapi" { endpoint = "https://artifactapi.example.com" - token = var.artifactapi_token # optional + # token defaults to the ARTIFACTAPI_TOKEN environment variable +} + +resource "artifactapi_remote_docker" "dockerhub" { + name = "dockerhub" + base_url = "https://registry-1.docker.io" + mutable_ttl = 300 +} + +resource "artifactapi_local_rpm" "internal" { + name = "rpm-internal" } ``` -| Attribute | Required | Description | -|------------|----------|------------------------------------------------------------------------------| -| `endpoint` | Yes | ArtifactAPI server endpoint URL | -| `token` | No | Bearer token sent as `Authorization` header; falls back to `ARTIFACTAPI_TOKEN` | +All resources can be imported by name, e.g. +`terraform import artifactapi_remote_docker.dockerhub dockerhub`. -## Resources and Data Sources +## Requirements -Each resource is documented in [`docs/resources/`](docs/resources/) and each data -source in [`docs/data-sources/`](docs/data-sources/), with a matching example under -[`examples/`](examples/). +- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0 or [OpenTofu](https://opentofu.org) >= 1.6 +- [Go](https://go.dev/doc/install) >= 1.25 (to build the provider) -## Import - -Resources can be imported by name: +## Building ```sh -terraform import artifactapi_remote_docker.dockerhub dockerhub -terraform import artifactapi_virtual.helm helm +make build +make test +make docs # regenerate docs/ from the schema and examples/ ``` -## Development +## Documentation -```sh -make build # Build the provider binary -make install # Install to local plugin directory -make test # Run tests -make lint # Run go vet -make fmt # Format code -make clean # Remove binary -``` +See [`docs/`](docs/index.md) for the provider, resource and data source +reference, and [`examples/`](examples/) for usage. + +## License + +[MIT](LICENSE) -- 2.47.3