Terraform and OpenTofu
This command writes your credentials and the provider mirror to ~/.terraformrc (or TF_CLI_CONFIG_FILE):
relic package setup terraform terraform --write
Install providers through Relic:
terraform init
Providers
By hand, add to the CLI configuration:
provider_installation {
network_mirror { url = "https://relic.example.com/terraform/terraform/providers/" }
}
credentials "relic.example.com" { token = "<token>" }
| Repository | Serves |
|---|---|
Remote of https://registry.terraform.io (OpenTofu: https://registry.opentofu.org) | Public providers, cached. |
| Local | The output of terraform providers mirror <dir>, uploaded as is (<hostname>/<namespace>/<type>/terraform-provider-…zip). |
| Virtual | Both. |
Modules
Publish a module from a directory:
relic package publish terraform tf-local 1.0.0 --namespace acme --provider aws --dir modules/network
Reference it as source = "relic.example.com/tf-local__acme/network/aws"
(<repo>__<namespace>/<name>/<provider>).
Through a remote of a module registry, or a virtual repository with one, public modules work
the same way, for example source = "relic.example.com/terraform__cloudposse/label/null". Relic
lists the upstream's versions, and on the first download fetches the archive the upstream
points at, keeps only the module's directory and caches it as <namespace>/<name>/<provider>/<version>.zip.
It fetches HTTP archives (.zip, .tar.gz) and GitHub sources
(git::https://github.com/<owner>/<repo>?ref=<ref>, through GitHub's archive of that ref).
Other sources, such as other Git hosts or S3, answer 404.