it is expected to return a "output" key on success with the details of the resources being provisioned. But, in my case
- 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"
}
}