Ansible / Terraform execution environment on AWX

Hi,
are there some instrucctions of how to use the terraform module on AWX?
im testing the module cloud.terraform with Ansible on AWX, but im having the error of “missing terraform binary”.

If i use the default EE Quay, it doesnt seems to be installed the Terraform binary, and the job fails.

But if i create my own image with Terraform installed, it also fails.

am i missing to install a module in the collection?

@AndrewLe Welcome to community!

Please refer to the Using cloud.terraform in Ansible Automation Platform.

If it still fail, cloud you tell us your error log and execution-environment.yml ?

Hi,
here is the error:

fatal: [server1l]: FAILED! => {“changed”: false, “cmd”: “/usr/bin/terraform version -json”, “msg”: “[Errno 2] No such file or directory: b’/usr/bin/terraform’”, “rc”: 2, “stderr”: “”, “stderr_lines”: , “stdout”: “”, “stdout_lines”: }

IM using latest EE from quay and the module cloud.terraform is in the collection.

then i reference terraform from:
name: Configure Basic User
cloud.terraform.terraform:
project_path: /files/terraform
state: present

And then i have created a EE like:

FROM quay.io/ansible/awx-ee:latest

ARG DATE=notset
USER root
ADD hashicorp.repo /etc/yum.repos.d/artifactory.repo

RUN echo ${DATE}; \
    yum update -y && \
    yum install terraform -y 

The binary “terraform” is under /usr/bin/terraform

Are you using the module on localhost, or is it running on a separate system.

Sorry, but my only example would be something from vmware:
pyvmomi is in awx-ee, but I cannot execute modules against remote systems unless the remote system has pyvmomi, so I do a delegate_to: localhost

Probably a bad example, but if you are trying to run the terraform on a remote host, the executable would need to be installed there.

1 Like