HewlettPackard / terraform-provider-oneview

Automates the provisioning of physical infrastructure from a private cloud using templates from HPE OneView with Terraform
Apache License 2.0
49 stars 30 forks source link

upgrading from 6.6 to 7.0 not working #510

Closed rismoney closed 1 year ago

rismoney commented 1 year ago

I have updated the OV API to 4000, and TF provider to 7.0 and I am getting errors on the first resource (actually a data item) encountered X 60 (1 for each) as they're all within modules.

Not sure where the breakage is. example:


│ Error: Error in response: filters:[name matches ''], org.antlr.runtime.EarlyExitException.
│  Response Status: 500 Server Error
│  Response Details:
│
│   with module.EG01F05B11.data.oneview_ethernet_network.network[1],
│   on .terraform\modules\EG01F05B11\sp_netmapping\main.tf line 29, in data "oneview_ethernet_network" "network":
│   29: data "oneview_ethernet_network" "network" {

Codebase works totally fine in 6.6.0. Ran terraform init -upgrade If revert the code back to 6.6.0 it works without issue.

rismoney commented 1 year ago
data "oneview_ethernet_network" "network" {
  count = length(local.netmappings.connections)
  name = lookup(local.netmappings.connections[count.index],"networkUri")
}

I think the issue is that it is no longer allowing name to be empty. Looking to see how to work around this. We have valid server configurations with network adapters that do not have a vlan/network assigned to them.

Not sure if this is the culprit - https://github.com/HewlettPackard/terraform-provider-oneview/blob/master/oneview/data_source_ethernet_network.go#L127-133

going to try some code work arounds to nil it.

rismoney commented 1 year ago

Ok, I think i have a satisfactory workaround for this edge case. created a fake TF_RESERVED_3000_DONOTRM

data "oneview_ethernet_network" "network" {
  count = length(local.netmappings.connections)
  name = lookup(local.netmappings.connections[count.index],"networkUri") != "" ? lookup(local.netmappings.connections[count.index],"networkUri") : "TF_RESERVED_3000_DONOTRM"
}

Then I can check the uri if it is equal to the TF_RESERVED val, and then null it for the network_uri, since it IS acceptable as a blank selection on a server profile.