Closed giridharv20 closed 6 years ago
Try tf.plan(skip_plan=True)
see: https://github.com/beelit94/python-terraform/blob/develop/python_terraform/__init__.py#L109
Another thing to look for is to confirm that your terraform template is valid by running terraform plan/apply
against your target project directly. Alternatively, you can print terraform outputs to the console with python-terraform directly.
Thank you for the response. Surely will try the 'skip_plan' arg. Yes i have validated that my terraform package works standalone through the command line. Also it does work with python-terraform v 0.8.6, but not the latest version 0.10.0.
Update: tf.apply(skip_plan=True) works.
Thank you so much
I am trying to run 'apply' but it hangs.
I have included my code below: // t = Terraform(working_dir='../terraform/jobs/test_1', variables=variables) t = Terraform(working_dir='../terraform/jobs/test_1') t.init() return_code, stdout, stderr = t.plan() print stdout
kwargs = {"auto-approve": True} return_code, stdout, stderr = t.apply(var=variables, **kwargs) // even the code below hangs //return_code, stdout, stderr = t.apply()
when i stop the process, the stdout displays this: Traceback (most recent call last): File "/opt/pycharm/helpers/pydev/pydevd.py", line 1664, in
main()
File "/opt/pycharm/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/opt/pycharm/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/giri/MyProjects/Python/terraform_test/app/app.py", line 16, in
print t.apply(*kwargs)
File "/home/giri/MyProjects/Python/terraform_test/venv/local/lib/python2.7/site-packages/python_terraform/init.py", line 112, in apply
return self.cmd('apply', args, **option_dict)
File "/home/giri/MyProjects/Python/terraform_test/venv/local/lib/python2.7/site-packages/python_terraform/init.py", line 298, in cmd
out, err = p.communicate()
File "/usr/lib/python2.7/subprocess.py", line 483, in communicate
return self._communicate(input)
File "/usr/lib/python2.7/subprocess.py", line 1124, in _communicate
stdout, stderr = self._communicate_with_poll(input)
File "/usr/lib/python2.7/subprocess.py", line 1178, in _communicate_with_poll
ready = poller.poll()
KeyboardInterrupt
Kindly assist me and point out if i am doing something wrong.
Does not seem to work on v 0.10.0 Works good with v 0.8.6