vmware / terraform-provider-vra7

Terraform VMware vRealize Automation 7 provider - VMware has ended the active development of this Terraform Provider, so this repository will no longer be updated.
https://registry.terraform.io/providers/vmware/vra7/latest
Mozilla Public License 2.0
38 stars 33 forks source link

Output missing when relying on defaults for "resource_configuration" #80

Closed prydin closed 4 years ago

prydin commented 4 years ago

vRA 7.x version 7.6 Terraform version 0.12.24 terraform-provider-vra7 plugin version 1.0.2

Describe the bug The vRA 7 provider allows a user to specify configuration of individual resources from a blueprint. This is done through the resource_configuration section. However, a user is also permitted to omit this section, which should pull in the default values specified in the blueprint. When the resource_configuration section is omitted, any computed outputs from the resources are missing.

To Reproduce Steps to reproduce the behavior:

  1. Use a config file similar to this:

    resource "vra7_deployment" "machine" {
    count             = 1
    catalog_item_name = "Ubuntu 18"
    description = "some description"
    reasons = "some reason"
    lease_days = 10
    
    deployment_configuration = {
    "blueprint_custom_property" = "This is a blueprint custom property"
    }
    }
  2. Run terraform plan and terraform apply

  3. The resources are provisioned, but the resource data is missing from the state file.

Expected behavior Computed data is present in the .tfstate file: https://gist.github.com/prydin/0809bed0e8f0fb118d8e3b35bd46b3b7

Actual Behavior Computed values, such as IDs and IP addresses are missing as is evident here: https://gist.github.com/prydin/0050cf26c70b98c8ad4a3d4d5547b03a

Desktop (please complete the following information):

prydin commented 4 years ago

Terraform log: https://gist.github.com/prydin/cf6e2880d0626a11e7b19da352f31c9f

prydin commented 4 years ago

After investigating this a bit deeper, I got some interesting clues. The data from vRA is received correctly and appears to have all the fields. It also looks like it's parsed and processed correctly by the provider, but for some reason, the resource_configuration computed fields of the state don't seem to be populated by the Terraform core if they're not present in the configuration files.

Prativa20 commented 4 years ago

@prydin Fixed as part of https://github.com/vmware/terraform-provider-vra7/pull/82. Please verify.

Thanks, Prativa