Custom Worker Image
Terraform Enterprise performs Terraform runs in ephemeral containers, using a built-in tfc-agent container image by default. To add custom tools or logic to your Terraform run environment, you must build a custom image and configure Terraform Enterprise to use it.
Agent
Build your custom image using the Dockerfile
below. Then update the
custom_agent_image_tag
setting with your image (e.g.
registry.example.com/example/tfc-agent:custom-tag
).
Requirements
- The base image must be
hashicorp/tfc-agent:1.6.0
or later.
Dockerfile
FROM hashicorp/tfc-agent:latest # Switch the to root user in order to perform privileged actions such as# installing software.USER root # Install sudo. The container runs as a non-root user, but people may rely on# the ability to apt-get install things.RUN apt-get -y install sudo # Permit tfc-agent to use sudo apt-get commands.RUN echo 'tfc-agent ALL=NOPASSWD: /usr/bin/apt-get , /usr/bin/apt' >> /etc/sudoers.d/50-tfc-agent # Switch back to the tfc-agent user as needed by Terraform agents.USER tfc-agent