vmware / terraform-provider-vra

Terraform Provider for VMware Aria Automation
https://registry.terraform.io/providers/vmware/vra/
Mozilla Public License 2.0
104 stars 93 forks source link

0.5.0 hides Custom properties on vra_deployment #427

Closed azrdev closed 2 years ago

azrdev commented 2 years ago

Code of Conduct

This project has a Code of Conduct that all participants are expected to understand and follow:

vRA Version

vRealize Automation 8.6.1.19679 (18939583)

Terraform Version

Terraform v1.1.5 on linux_amd64

vRA Terraform Provider Version

Affected Resource(s)

Terraform Configuration Files

resource "vra_deployment" "this" {
  # standard options shouldn't affect the issue
}
locals {
  vra_deployment_properties = [
      for resource in vra_deployment.this.resources :
      jsondecode(resource.properties_json)
  ]
}

output "hostname" {
  value = coalesce(
      [for resource in local.vra_deployment_properties :
       try(resource["Custom.VirtualMachine.Network0.Hostname"], null)
      ]...
  )

Expected Behavior

properties_json to include our Custom... properties, where we can find e.g. a fqdn before updating the provider to 0.5.0

Actual Behavior

properties_json contains only

        [
          {
            "address": "10.100.x.y",
            "powerState": "ON",
            "resourceName": "hostx-y"
          }
        ]

Steps to Reproduce

terraform apply

Screenshots

Debug Output

Panic Output

Important Factoids

References

Community Note

tenthirtyam commented 2 years ago

Per the changelog, v0.5.0 requires vRA 8.6.2 and later.

kaiehrhardt commented 2 years ago

So maybe just one more question. Does the project stick to the semantic versioning specification (https://semver.org/spec/v2.0.0.html). That's why we thought it's a bug.

tenthirtyam commented 2 years ago

Does the project stick to the semantic versioning specification (https://semver.org/spec/v2.0.0.html). That's why we thought it's a bug.

Tagging @frodenas for comment.

frodenas commented 2 years ago

So maybe just one more question. Does the project stick to the semantic versioning specification (https://semver.org/spec/v2.0.0.html). That's why we thought it's a bug.

Yes, we have started sticking to semver. v0.5.0, theoretically, does not introduce any incompatible API changes, hence we didn't bump the major version (although it is debatable if upstream dependencies/requirements bumps, like requiring a newer version of vRA, should require it or not).

Regarding your issue, please let me perform some tests. Internally, we bumped the deployments API from 2019-01-15 to 2020-08-25 (see https://github.com/vmware/terraform-provider-vra/pull/421/commits/4ca2644baf52fe1b1ad468ad252a062bd475a06f), this may have introduced inadvertently a change in the way that deployment resource properties are being returned.

VickyWinner commented 2 years ago

I am facing the same issue. properties_json has just this. "properties_json": "{\"address\":\"10.11.12.13\",\"powerState\":\"ON\",\"resourceName\":\"host1204\"}"

lewis-cloud commented 2 years ago

Hello, we're seeing this behaviour too on: vRealize Automation 8.6.2.20205 Terraform v1.1.6 & v1.1.7 on darwin_arm64

Using v0.5.0 provider only returns the resourceName property in properties_json of our custom resource type. Similarly when deploying a Cloud.vSphere.Machine resource only the address, powerState & resourceName properties exist.

We've worked around this issue by configuring the provder to use v0.4.1 and running terraform init -upgrade.

frodenas commented 2 years ago

I've been able to reproduce this issue. Deployments API 2020-08-25 returns only a summary of resources, which does not contain all the properties, so now we have to make an extra call to retrieve those properties. We will work on a fix as soon as possible.

frodenas commented 2 years ago

This issue has been fixed at v0.5.1, which will be available in the Terraform registry pretty soon.

Release notes for v0.5.0 have been updated to note this issue.

VickyWinner commented 2 years ago

@frodenas This was a quickest than I expected. Thanks. When can we expect this in registry?

frodenas commented 2 years ago

@VickyWinner I expect that it will be available in the terraform registry by the end of the day.