Intro
This article is dedicated to configure proxy settings for Docker installation of Terraform Enterprise Flexible Deployment Options (FDO)
Problem description
In some environments Terraform Enterprise host doesn't have access to the internet and proxy has to be used for terraform init stage of the runs.
Example of an error message:
Operation failed: failed fetching Terraform: failed downloading terraform:
failed downloading "https://releases.hashicorp.com/terraform/1.5.3/terraform_1.5.3_linux_amd64.zip":
GET https://releases.hashicorp.com/terraform/1.5.3/terraform_1.5.3_linux_amd64.zip giving up after 5 attempt(s):
failed making temp file: open /tmp/terraform/71bf0bd0bd10f6eeac2261e23543df18.download-504ba21b-3a45-c1d4-ff08-7cd03823c4d8: read-only file system
Solution
Add proxy environment variables to the docker_compose environment section:
---
version: "3.9"
name: terraform-enterprise
services:
tfe:
image: images.releases.hashicorp.com/hashicorp/terraform-enterprise:v202309-1
environment:
TFE_HOSTNAME: tfe.domain.com
http_proxy: http://10.5.1.175:8080
https_proxy: http://10.5.1.175:8080
no_proxy: localhost,127.0.0.1,.amazonaws.com,tfe.domain.com
and restart Terraform Enterprise to apply proxy settings:
sudo docker compose -f docker_compose_file.yml restart