[BUG] TypeError: expected str, bytes or os.PathLike object, not int
mbordash2 opened this issue · comments
Bug Description
When running a terraform module with a parameter defined, the following error is returned:
File "/Users/mbordash/Library/Caches/pypoetry/virtualenvs/infrastructure-qTq6Nujo-py3.8/lib/python3.8/site-packages/runway/module/terraform.py", line 355, in plan
self.run("plan")
File "/Users/mbordash/Library/Caches/pypoetry/virtualenvs/infrastructure-qTq6Nujo-py3.8/lib/python3.8/site-packages/runway/module/terraform.py", line 553, in run
self.terraform_init()
File "/Users/mbordash/Library/Caches/pypoetry/virtualenvs/infrastructure-qTq6Nujo-py3.8/lib/python3.8/site-packages/runway/module/terraform.py", line 448, in terraform_init
run_module_command(
File "/Users/mbordash/Library/Caches/pypoetry/virtualenvs/infrastructure-qTq6Nujo-py3.8/lib/python3.8/site-packages/runway/module/utils.py", line 102, in run_module_command
subprocess.check_call(cmd_list, env=env_vars)
File "/Users/mbordash/.pyenv/versions/3.8.13/lib/python3.8/subprocess.py", line 359, in check_call
retcode = call(*popenargs, **kwargs)
File "/Users/mbordash/.pyenv/versions/3.8.13/lib/python3.8/subprocess.py", line 340, in call
with Popen(*popenargs, **kwargs) as p:
File "/Users/mbordash/.pyenv/versions/3.8.13/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Users/mbordash/.pyenv/versions/3.8.13/lib/python3.8/subprocess.py", line 1626, in _execute_child
env_list.append(k + b'=' + os.fsencode(v))
File "/Users/mbordash/.pyenv/versions/3.8.13/lib/python3.8/os.py", line 806, in fsencode
filename = fspath(filename) # Does type-checking of `filename`.
TypeError: expected str, bytes or os.PathLike object, not int
Runway config:
- name: mydeployment
modules:
- path: external-alb/alb
type: terraform
parameters:
accountNumber: 12345
The error doesn't occur when the parameter is removed.
Expected Behavior
The parameter should be passed along to terraform without error.
Steps To Reproduce
Runway config:
- name: mydeployment
modules:
- path: external-alb/alb
type: terraform
parameters:
accountNumber: 12345
The error doesn't occur when the parameter is removed.
Runway version
2.6.2
Installation Type
pypi (pip, pipenv, poetry, etc)
OS / Environment
- OS: macOS 12.4
- python: 3.8.13 (also reproduced on 3.9)
- terraform version: 1.2.3
Anything else?
No response
As a quick follow up on this, I am able to work around the above issue by using the terraform_write_auto_tfvars
option set to true
. Unclear if this is working as designed or if maybe there is a more graceful way to handle this situation.
- name: mydeployment
modules:
- path: terraform_module
type: terraform
parameters:
account: 1234567
options:
terraform_write_auto_tfvars: true
Fix for this is upcoming from work done in MSI-706.
Fixed in #1569