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

Usage of modules not supported #5

Open
splashx opened this issue Jan 30, 2019 · 0 comments
Open

Usage of modules not supported #5

splashx opened this issue Jan 30, 2019 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@splashx
Copy link

splashx commented Jan 30, 2019

tofu will only report resources in the root of the terraform state tree.

The problem is in L111: this assumes there is no terraform module being used except for the main, root definition.

Instead of hardcoded value of 0, self.data.modules should iterated because the length can be n.

An example from a more complex terraform infra using modules:

>>> len(data['modules'])
8
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][0]['resources'].keys() )
[]
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][1]['resources'].keys() )
[]
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][2]['resources'].keys() )
[]
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][3]['resources'].keys() )
[]
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][4]['resources'].keys() )
[]
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][5]['resources'].keys() )
[u'openstack_compute_instance_v2.vm_2n.0', u'openstack_compute_instance_v2.vm_2n.1', u'openstack_compute_instance_v2.vm_2n.2']
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][6]['resources'].keys() )
[u'openstack_compute_instance_v2.vm_2n.0', u'openstack_compute_instance_v2.vm_2n.1', u'openstack_compute_instance_v2.vm_2n.2']
>>> filter( lambda x : re.search('openstack_compute_instance_v2', x), data['modules'][7]['resources'].keys() )
[u'openstack_compute_instance_v2.instance']

This is because in this tf infra there is no vm being built in the root, but only using modules.

@shalomb shalomb added the help wanted Extra attention is needed label Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants