Introduction
This article provides a procedure for managing DNS options in the /etc/resolv.conf file for the Terraform CLI, which executes inside an isolated Docker container within a Replicated Terraform Enterprise installation.
This approach can be used for troubleshooting DNS resolution issues or as a permanent solution. Note that some DNS options may have performance implications that require consideration before you apply the settings.
Expected Outcome
Terraform runs initiated in Terraform Enterprise will respect the custom DNS options supplied in the build worker's /etc/resolv.conf file.
Prerequisites
- Permission to execute
dockercommands on the Terraform Enterprise host machine. - Access to the Replicated console at
https://<TFE_FQDN>:8800orsudopermission to executereplicatedctlcommands.
Procedure
- Launch a terminal and connect to the Terraform Enterprise host machine via SSH.
Create a temporary directory and navigate into it. This example uses
/var/tmp/sample.$ mkdir -p /var/tmp/sample $ cd /var/tmp/sample
Create a custom initialization script named
init_custom_worker.sh. The following example uses thesedcommand to append DNS options. Substitute the placeholder<<DNS OPTIONS>>with your required DNS options.#!/bin/bash sed 's/\boptions\b/& <<DNS OPTIONS>> /' /etc/resolv.conf
Create a
Dockerfilethat extends the default worker imagehashicorp/build-worker:nowwith the custom initialization script.FROM hashicorp/build-worker:now COPY init_custom_worker.sh /usr/local/bin/
Build a new Docker image from the
Dockerfile. This example tags the new image ashashicorp/build-worker:new.$ docker build -t hashicorp/build-worker:new .
- Update Terraform Enterprise to use the custom worker image through the Replicated console.
- Navigate to the Replicated console settings page for the worker image:
https://<TFE_FQDN>:8800/settings#worker_image. Select the Provide the location of a custom image option.
Enter the tag name of the new Docker image (
hashicorp/build-worker:new) in the text field.Click Save at the bottom of the page to save the settings, and then restart the application by clicking Restart Now.
- Navigate to the Replicated console settings page for the worker image: