Skip to content

Usage of modules not supported #5

Open

Description

@splashx

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions