---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Test
  hosts: localhost
  tasks:
    - name: Test project path
      ansible.builtin.assert:
        that:
          - lookup('cloud.terraform.tf_output', 'my_output1', 'my_output2', project_path="subdir/") == "value1,value2"
          - lookup('cloud.terraform.tf_output', 'source_output', project_path="subdir/") == "hello_project"
          - lookup('cloud.terraform.tf_output', project_path="subdir/").source_output.value == "hello_project"

    - name: Test state file
      ansible.builtin.assert:
        that:
          - lookup('cloud.terraform.tf_output', 'my_output1', 'my_output2', state_file="subdir/mycustomstate.tfstate") == "value1,value2"
          - lookup('cloud.terraform.tf_output', 'source_output', state_file="subdir/mycustomstate.tfstate") == "hello_custom"
          - lookup('cloud.terraform.tf_output', state_file="subdir/mycustomstate.tfstate").source_output.value == "hello_custom"
