- Create
config.ini
file in the current directory with the following content:
[registry]
proxy_host = "your-registry.terraform-registry.example.com"
[release]
proxy_host = "your-release.terraform-registry.example.com"
path_prefix = ""
terraform_version = "1.1.7"
[server]
address = ":5000"
is_private = false # if true, only the proxy_host will be allowed to access the registry and release by certificate
cert_file = "" # optional
key_file = "" # optional
use_tls = false # optional
- Build container images with podman
podman build -t registry-proxy:dev .
- Install container with podman/docker
podman run --name terraform-registry-proxy -itd -p 5000:5000 registry-proxy:dev
After you have your infrastructure setup you need to update your Terraform configuration so it knows to pull dependencies through the proxy.
terraform {
required_providers {
azurerm = {
source = "hashicorp/aws"
version = "=< 4.16.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "aws" {
region = "cn-north-1"
profile = "default"
}
You would update it to this
terraform {
required_providers {
azurerm = {
source = "your-registry.terraform-registry.example.com/hashicorp/aws"
version = "=< 4.16.0"
}
}
}
# Configure the Microsoft Azure Provider
provider "aws" {
region = "cn-north-1"
profile = "default"
}