Terraform not found after listing Terraform in packages.txt

Summary

Can someone tell me where external dependencies are installed to? I’m installing terraform successfully, but I’m still seeing “terraform: not found”.

More detail

I have an application that uses Terraform to deploy resources to Snowflake. It works locally but not on Community Cloud. I am seeing a “/bin/sh: 1: terraform: not found” error; even though I listed terraform in the packages.txt file per the documentation and I am seeing Community Cloud processing the dependencies. It says “Apt dependencies were installed from /app//packages.txt using apt-get”.

Expected behavior:

I expected Terraform to be found after including a packages.txt file.

Actual behavior:

I am still seeing the “terraform: not found” error.

Additional information

Here’s a screenshot of what I’m seeing in my app and in the app’s terminal on Community Cloud.

Thank you in advance!

Update 1

Despite Streamlit not throwing an error the first time I tried listing terraform as a package in packages.txt, it appears there is no terraform package. Just helper packages (per that search I link out to). I am now seeing the appropriate error when my Streamlit app tries to update.

So now I’m trying to following the installation process manually by embedding the commands listed here. I’ll follow up with how that goes, but in the meantime if anyone sees this and has used Terraform in a Streamlit Community Cloud app before, I’d love to hear how you did it!

Update 2

Trying to embed the necessary commands to install Terraform in subprocess.run() results in the application telling me “a password is required”. Given that, and installing the package via the packages.txt file didn’t work, I think I’ve run out of workarounds. Any advice on this is appreciated!

You cannot use apt from inside your aplication. Try the Binary download for Linux available in the downloads page. You will need the AMD64 flavour, I guess.

Alternatively, take a look at libterraform.

Disclaimer: I didn’t test any of the above.

1 Like

Fabulous, thank you! I was able to include the binary download in the repo and route commands there to the binary file. Awesome suggestion!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.