Introduction
Expected Outcome
Terraform runs in Terraform Enterprise respect the supplied DNS options in /etc/resolv.conf
.
Prerequisites
- The permission to execute
docker
command in Terraform Enterprise host machine. - The access to the Replicated console on
https://<<TFE FQDN>>:8800
or thesudo
permission to executereplicatedctl
command.
Use Case
- This article aims to provide an example use case to manage DNS options that are suitable for Terraform CLI which is executed inside an isolated docker container. The approach can be used for troubleshooting DNS resolution issues or as a permanent solution, however, some DNS options may have performance implications that would require extra consideration prior to applying the settings.
Procedure
-
Launch a terminal console and ssh into the Terraform Enterprise host machine.
-
Create a temporary directory
/var/tmp/sample
and navigate into the directory. -
Create a custom initialization script
init_custom_worker.sh
, below is the sample for using thesed
command to append DNS options, substitute the placeholder<<DNS OPTIONS>>
with the actual DNS options.#!/bin/bash sed 's/\boptions\b/& <<DNS OPTIONS>> /' /etc/resolv.conf
-
Create the Dockerfile with the sample following content which will extend the default worker image
hashicorp/build-worker:now
with the custom initialization script:FROM hashicorp/build-worker:now COPY init_custom_worker.sh /usr/local/bin/
-
Execute command
docker build -t hashicorp/build-worker:new .
to build a new docker image with the taghashicorp/build-worker:new
, the tag name is only for an example. -
Update Terraform Enterprise to use the custom worker image via the following options:
-
- Command Line Interface
-
-
-
As you should already be in the ssh terminal in Terraform Enterprise host machine from the previous steps, executing the following commands will update the build worker image:
replicatedctl app-config set tbw_image --value "custom_image" replicatedctl app-config set custom_image_tag --value "hashicorp/build-worker:new"
-
Restart Terraform Enterprise application to reload the application settings
- Stop the application with the command
replicatedctl app stop
. - Watch the status of the application with the command
watch replicatedctl app status
. - Wait until the
State
changed tostopped
and theIsTransitioning
isfalse
- Start the application with the command
replicatedctl app start
- Stop the application with the command
-
-
-
- Graphical User Interface
-
- Navigate to the Replicated console at the following page, 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
- Click the Save button at the bottom of the page to save the settings and restart the application by clicking on the Restart Now button.
-
- Graphical User Interface
-
Additional Information
- For further clarification/assistance, please contact support at support@hashicorp.com or submit a ticket via our support portal.