Skip to content

terraform: State Queries #2

@FrancisBilla

Description

@FrancisBilla
SUMMARY

Currently terraform doesnt allow some resource manipulations outside of it. But such manipulations will be convenient to use by other ansible code. A lookup plugin to pull the resource IDS generated by terraform will be useful to do that.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

terraform lookup plugin

ADDITIONAL INFORMATION

The lookup plugin would take the path to the terraform state file and the either the resource type or resource name or both and return the IDS for the matched parameters passed.

- hosts: localhost
  vars:
    content: "{{ lookup('terraform', resource_name='load_balancer', state_file='myproject/terraform.tfstate', resource_type='aws_lb') }}"
  tasks:
   - debug: msg = "The ID is {{ content }}"

Metadata

Metadata

Labels

enhancementNew feature or requestfeature IdeaThis proposes the idea of adding new features to the project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions