Expected Outcome
Add a host mapping to the Terraform Enterprise container to resolve the TFE hostname to the private IP address of the instance.
Prerequisites
- Terraform Enterprise Flexible Deployment Options Podman
Use Case
Migrating from a Replicated installation to Flexible Deployment Options and want to enable the equivalent of hairpin_addressing.
Procedure
- Edit the Kube
YAMLfile and add ahostAliasesblock under the Podspec,ex:---
apiVersion: "v1"
kind: "Pod"
...
spec:
hostAliases:
- ip: "<private_ip_of_the_node>"
hostnames: ["<TFE hostname e.g. terraform.example.com>"] - Stop/Start Terraform Enterprise using Systemd(if set up), otherwise manually with:
# podman kube down <path_to_YAML_file>
# podman kube play <path_to_YAML_file> - Verify the changes have been successfully applied
# podman pod inspect terraform-enterprise -f '{{.InfraConfig.HostAdd}}'
[terraform.example.com:10.240.100.10] - Alternatively, verify within the container's
/etc/hostsfile.
NOTE: To enable hairpin_addressing for Terraform runs, set TFE_RUN_PIPELINE_DOCKER_EXTRA_HOSTS as described in the link below.
Additional Information
-
Docker Driver settings - FDO Docker -
extra_hostsapplied to agent containers