How to use a field from a Terraform multi-fields Output in Terratest
[Hi,](https://github.com/gruntwork-io/terratest) I am printing all the attributes of a resource in Terraform via the following: value = "<resource_type>/<logical_name>" for example value = aws_instance.web. However when I get the output in Terratest I am getting it as a string which actually contains map[]. Hence any golang map activities to get particular attribute of that output fails. Small Test: `output "aws_vm_details" { value = aws_instance.web }` `awsVMDetails := terraform.Output(t, terraformOptions, "aws_vm_details") t.Logf("AWS_VM_DETAILS: %s of type %s", awsVMDetails["ami"], reflect.TypeOf(awsVMDetails))` I get the error in that case: `non-integer string index "ami"` awsVMDetails is returned as `string` Kindly help me to find the solution to get/interpret a particular field from a Terraform Output that provides multiple fields.
Hi, I think it depends on which are keys and values of map: * can be used [OutputMap](https://github.com/gruntwork-io/terratest/blob/master/modules/terraform/output.go#L230) for string keys / values * output can be read as [map[string]interface{} ](https://github.com/gruntwork-io/terratest/blob/master/modules/terraform/output.go#L258) and then casted to expected format * can be used reading as [JSON](https://github.com/gruntwork-io/terratest/blob/master/modules/terraform/output.go#L267 ) and then deserialized