-
Notifications
You must be signed in to change notification settings - Fork 173
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
Comments
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. |
@Spikeophant it fails during init as well, running this inside a container. However the same works fine if I run it outside a container
|
It doesn't appear that terraform is in the path of the container. In your
python can you echo $PATH and see what it outputs, then run the container
in interactive mode and echo $PATH and see if they match? I misunderstood
your issue originally, thinking it couldn't find the .tf files, but it
cannot find the terraform executable itself.
…On Thu, Aug 27, 2020 at 12:22 PM mike-19 ***@***.***> wrote:
@Spikeophant <https://github.com/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'
>>>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADR432WSEY3MD2DIQSXWJSLSC2W6VANCNFSM4MJVISYA>
.
|
Hi I am struggling with this as well.in my case i cannot find the working directory,please help! Thanks |
I am also seeing same error |
What's the content in your dockerfile ?
…On Fri, May 7, 2021, 8:39 AM amitanand-ms ***@***.***> wrote:
I am also seeing same error
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKXNST3JHYEYW35XE6VH6DTMNKYLANCNFSM4MJVISYA>
.
|
I am not using docker, just trying to use terraform through Python on a VM
through a simple python code.
from python_terraform import *
tf =
Terraform(working_dir='/root/terraform',variables={'azure_pass':passw,
'resource_group_name':"testrgpython" ,'resource_location':"eastus"})
approve = {"auto-approve": True}
tf.plan()
And this gives the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python3.6/site-packages/python_terraform/__init__.py", line
154, in plan
return self.cmd('plan', *args, **options)
File
"/usr/local/lib/python3.6/site-packages/python_terraform/__init__.py", line
293, in cmd
cwd=working_folder, env=environ_vars)
File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'terraform':
'terraform'
.tf does exist in working directory
***@***.*** ~]# ls /root/terraform
terraform.tf
…On Fri, May 7, 2021 at 7:50 AM mike-19 ***@***.***> wrote:
What's the content in your dockerfile ?
On Fri, May 7, 2021, 8:39 AM amitanand-ms ***@***.***> wrote:
> I am also seeing same error
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#83 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ABKXNST3JHYEYW35XE6VH6DTMNKYLANCNFSM4MJVISYA
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALEPG7MH7EBZ4Y2LRVEJACTTMPHZ5ANCNFSM4MJVISYA>
.
--
Thanks
Amit Anand
|
Can you paste the output of the command
Which terraform
…On Fri, May 7, 2021, 7:25 PM amitanand-ms ***@***.***> wrote:
I am not using docker, just trying to use terraform through Python on a VM
through a simple python code.
from python_terraform import *
tf =
Terraform(working_dir='/root/terraform',variables={'azure_pass':passw,
'resource_group_name':"testrgpython" ,'resource_location':"eastus"})
approve = {"auto-approve": True}
tf.plan()
And this gives the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python3.6/site-packages/python_terraform/__init__.py", line
154, in plan
return self.cmd('plan', *args, **options)
File
"/usr/local/lib/python3.6/site-packages/python_terraform/__init__.py", line
293, in cmd
cwd=working_folder, env=environ_vars)
File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'terraform':
'terraform'
.tf does exist in working directory
***@***.*** ~]# ls /root/terraform
terraform.tf
On Fri, May 7, 2021 at 7:50 AM mike-19 ***@***.***> wrote:
> What's the content in your dockerfile ?
>
> On Fri, May 7, 2021, 8:39 AM amitanand-ms ***@***.***> wrote:
>
> > I am also seeing same error
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub
> > <
>
#83 (comment)
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/ABKXNST3JHYEYW35XE6VH6DTMNKYLANCNFSM4MJVISYA
> >
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#83 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ALEPG7MH7EBZ4Y2LRVEJACTTMPHZ5ANCNFSM4MJVISYA
>
> .
>
--
Thanks
Amit Anand
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#83 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKXNST6I44ROCYF6HP63ZDTMPWMVANCNFSM4MJVISYA>
.
|
Ran into the same issue, |
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
Here is my simple terraform script:
And this is the issue it is throwing: Tried passing both absolute and relative path. Doubled confirmed with file and directory
The text was updated successfully, but these errors were encountered: