ansible-collections/cloud.terraform

inventory_from_outputs Ansible Role does not permit static values

sean-freeman opened this issue · 1 comments

SUMMARY

inventory_from_outputs Ansible Role does not permit static values

The Ansible Role assumes always that Terraform should be aware of the OS Login User and the target Ansible Inventory Group.

In addition, mapping variable "name" is very generic. It would be clearer to prefix every value with host_

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cloud.terraform.inventory_from_outputs

COLLECTION VERSION

1.0.x

CONFIGURATION example
- hosts: localhost
  roles:
    - role: cloud.terraform.inventory_from_outputs
      project_path: "{{ playbook_dir }}/terraform_template"
      mapping_variables:
        host_list: terraform_var_host_list
        name: terraform_var_name
        ip: terraform_var_ip
        user: "root"
        group: "ansible_inv_group1"
ACTUAL RESULTS

Cannot replicate, this bug represents a design decision that should be investigated and alterations accordingly

Thank you for trying this out. Getting feedback from real-world usage is perfect and will guide improvements to this functionality.

For the initial version of the role, we decided on implementing the minimal required parameters for a very simple usecase to work. The assumption is that the terraform file needs changing anyway, and any static variables can just be hardcoded in the .tf file.

We will consider extending the role with support for specifying hardcoded variables, and I also think this is an extremely useful feature. However, perserving compatibility between this role and its counterpart inventory plugin, and to avoid a growing mess of parameters, this is more than a simple fix, so slightly more time for design is necessary.