What ansible documentation say is that the terraform ansible module ouputs Terraform outputs https://www.terraform.io/docs/configuration/outputs.html
If you don't have any Terraform output declared in your .tf files you won't see any output. HTH El mié, 13 ene 2021 a las 21:38, Bharath Annamaneni (< [email protected]>) escribió: > Hello Ansible Users, > > I am trying to run/use the Ansible's Terraform Module to provision the > servers in Public Cloud. The Terraform Code works fine when run manually > and through Ansible, but, the *Ansible doesn't return the output of the > resources being provisioned by Terraform*. > > Per Ansible's Terraform Module documentation > <https://docs.ansible.com/ansible/latest/collections/community/general/terraform_module.html#return-values> > it is expected to return a "output" key on success with the details of the > resources being provisioned. But, in my case > > > > *its empty.play.yml * > - hosts: localhost > gather_facts: false > become: false > > tasks: > - name: Provision AWS > community.general.terraform: > project_path: "/home/terraform/aws-vm" > state: present > force_init: true > variables: > type: t2.micro > register: terraform > > - debug: > var: terraform > > > *Output:* > ok: [localhost] => { > "terraform": { > "changed": true, > "command": "/usr/bin/terraform apply -no-color -input=false > -auto-approve=true -lock=true /tmp/tmp5plmx0xb.tfplan", > "failed": false, > "outputs": {}, > "state": "present", > "stderr": "", > "stderr_lines": [], > "stdout": "aws_instance.awsvm: Creating...\naws_instance.awsvm: > Still creating... [10s elapsed]\naws_instance.awsvm: Still creating... [20s > elapsed]\naws_instance.awsvm: Still creating... [30s > elapsed]\naws_instance.awsvm: Still creating... [40s > elapsed]\naws_instance.awsvm: Creation complete after 42s > [id=i-068dd9cb7d994abe3]\n\nApply complete! Resources: 1 added, 0 changed, > 0 destroyed.\n\nThe state of your infrastructure has been saved to the > path\nbelow. This state is required to modify and destroy > your\ninfrastructure, so keep it safe. To inspect the complete state\nuse > the `terraform show` command.\n\nState path: terraform.tfstate\n", > "stdout_lines": [ > "aws_instance.awsvm: Creating...", > "aws_instance.awsvm: Still creating... [10s elapsed]", > "aws_instance.awsvm: Still creating... [20s elapsed]", > "aws_instance.awsvm: Still creating... [30s elapsed]", > "aws_instance.awsvm: Still creating... [40s elapsed]", > "aws_instance.awsvm: Creation complete after 42s > [id=i-068dd9cb7d994abe3]", > "", > "Apply complete! Resources: 1 added, 0 changed, 0 destroyed.", > "", > "The state of your infrastructure has been saved to the path", > "below. This state is required to modify and destroy your", > "infrastructure, so keep it safe. To inspect the complete > state", > "use the `terraform show` command.", > "", > "State path: terraform.tfstate" > ], > "workspace": "default" > } > } > > > *Can anyone please help me resolving the issue.* > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/bd3f7985-c6ff-416e-8a22-71cfb5e97e47n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/bd3f7985-c6ff-416e-8a22-71cfb5e97e47n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFtje5Ocx4ozoT4Afz%2B%3D_MZ8B_6O7D6b2iD%3DGdrfFNHfZVZgGw%40mail.gmail.com.
