diff --git a/docs/resources/remote_ansible.md b/docs/resources/remote_ansible.md new file mode 100644 index 0000000..47158dd --- /dev/null +++ b/docs/resources/remote_ansible.md @@ -0,0 +1,30 @@ +# `artifactapi_remote_ansible` + +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). + +## Common Attributes + +| 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 | +| `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 + +See `examples/resources/artifactapi_remote_ansible/main.tf`. diff --git a/examples/resources/artifactapi_remote_ansible/main.tf b/examples/resources/artifactapi_remote_ansible/main.tf new file mode 100644 index 0000000..1ab408f --- /dev/null +++ b/examples/resources/artifactapi_remote_ansible/main.tf @@ -0,0 +1,23 @@ +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" { + name = "galaxy" + base_url = "https://galaxy.ansible.com" + description = "Ansible Galaxy" + + immutable_ttl = 0 + mutable_ttl = 300 +} diff --git a/internal/provider/resource_remote_ansible.go b/internal/provider/resource_remote_ansible.go new file mode 100644 index 0000000..a1fb4b0 --- /dev/null +++ b/internal/provider/resource_remote_ansible.go @@ -0,0 +1,3 @@ +package provider + +func init() { registerResource(newRemoteResource("ansible")) }