Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting no such file or directory issue #83

Open
taragurung opened this issue Apr 16, 2020 · 9 comments
Open

Getting no such file or directory issue #83

taragurung opened this issue Apr 16, 2020 · 9 comments

Comments

@taragurung
Copy link

I am just trying to run simple terraform script with the package and getting the file not found issue even though the file exists.

I am running a python container and testing it inside it. Tried with both python3 and python2 but same problem.

Here is my python script
Screen Shot 2020-04-16 at 5 52 09 PM

Here is my simple terraform script:
Screen Shot 2020-04-16 at 5 51 41 PM

And this is the issue it is throwing: Tried passing both absolute and relative path. Doubled confirmed with file and directory

Screen Shot 2020-04-16 at 5 52 40 PM

@Spikeophant
Copy link
Collaborator

Spikeophant commented May 13, 2020

I believe running init first will take care of this. I always init before apply in any scripts I use this in. Mostly I run this in ci/cd pipelines.

@mike-19
Copy link

mike-19 commented Aug 27, 2020

@Spikeophant it fails during init as well, running this inside a container. However the same works fine if I run it outside a container

# python
Python 3.7.6 (default, Feb 26 2020, 15:44:31)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from python_terraform import *
>>> tf = Terraform()
>>> tf.init()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/python_terraform/__init__.py", line 180, in init
    return self.cmd('init', *args, **options)
  File "/usr/local/lib/python3.7/site-packages/python_terraform/__init__.py", line 293, in cmd
    cwd=working_folder, env=environ_vars)
  File "/usr/local/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'terraform': 'terraform'
>>>

@Spikeophant
Copy link
Collaborator

Spikeophant commented Aug 27, 2020 via email

@alexcargf
Copy link

Hi I am struggling with this as well.in my case i cannot find the working directory,please help! Thanks

@amitanand-ms
Copy link

I am also seeing same error

@mike-19
Copy link

mike-19 commented May 7, 2021 via email

@amitanand-ms
Copy link

amitanand-ms commented May 7, 2021 via email

@mike-19
Copy link

mike-19 commented May 7, 2021 via email

@garciassolutions
Copy link

Ran into the same issue, terraform needed to be installed on the VM.
Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants