The collection automates the management and provisioning of infrastructure as code (IaC) using the Terraform CLI tool within Ansible playbooks and Execution Environment runtimes.
GNU General Public License v3.0
100
stars
36
forks
source link
Terraform Resources of "mode" "data" Are Included by Default #167
The inventory plugin adds any matching resource to the inventory. A number of resource types have "lookup" (aka data) and "concrete" (aka managed) resources. It's not an uncommon process to "lookup" a similar resource to apply some or all of it's settings to a managed resource. This can be seen in AWS (a supported cloud) with the aws_instance data source and resource.
My opinion is the data resources should be excluded by default (breaking change). A sub-option should be added to provider-mapping to specify the mode. It could be restricted to 2 values, "data", and "managed", or 3 including - "any". I'd advocate for the breaking change as it is closer to my expectation as a user of the collection. Being able to add an additional provider mapping to select data or catch both via an "any" value would ensure no existing use cases are left uncovered.
SUMMARY
The inventory plugin adds any matching resource to the inventory. A number of resource types have "lookup" (aka data) and "concrete" (aka managed) resources. It's not an uncommon process to "lookup" a similar resource to apply some or all of it's settings to a managed resource. This can be seen in AWS (a supported cloud) with the
aws_instance
data source and resource.My opinion is the data resources should be excluded by default (breaking change). A sub-option should be added to provider-mapping to specify the mode. It could be restricted to 2 values, "data", and "managed", or 3 including - "any". I'd advocate for the breaking change as it is closer to my expectation as a user of the collection. Being able to add an additional provider mapping to select data or catch both via an "any" value would ensure no existing use cases are left uncovered.
ISSUE TYPE
COMPONENT NAME
plugins/inventory/terraform_state.py
ANSIBLE VERSION
COLLECTION VERSION
At the time of testing I was using this version from git dcb5408.
CONFIGURATION
OS / ENVIRONMENT
Fedora Workstation 40, ansible-core and tofu from packages
STEPS TO REPRODUCE
main.tf
hosts.terraform_state.yml
EXPECTED RESULTS
ACTUAL RESULTS