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

Assigning a WWPN when applying a server profile from a template #475

Closed josyfj closed 2 years ago

josyfj commented 2 years ago

Issue: When applying a server profile from a template, we are unable to add a WWPN, which causes the apply to fail.

Affected resource:

resource "oneview_server_profile" "server_profile" {
  name = "My_Test_Profile"
  template = "Terraform_Test_Template"
  hardware_name = "<Server_hardware_name>"
  connection_settings {
      connections{
        name = "<network_name>"
        port_id = "1"
        network_uri = <network_uri>"
        wwpn = "<wwpn>"
      }
  }
}

Error message:

╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to module.Add_Profile.oneview_server_profile.server_profile, provider
│ "provider[\"registry.terraform.io/hewlettpackard/oneview\"]" produced an unexpected new value: Root resource was present, but   
│ now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Expected output: The server profile is applied using the proper connection and connection settings.

nabhajit-ray commented 2 years ago

Hi @josyfj ,

Please share your server profile configuration and with attribute values wherever possible.

josyfj commented 2 years ago

Hello @nabhajit-ray ,

Below are more details with attribute values. I've noticed that as of Oneview 7, there are 2 parameters that are different from the current version. It asks for an Adapter Location as well as a Port and generates the WWPN automatically I believe. Would these parameters need to be added in order for this resource to work with Oneview 7?


resource "oneview_server_profile" "server_profile" {
  for_each = var.Profile
  name = "My_Test_Profile_Terraform"
  template = "Test_Profile_Tempalte"
  hardware_name = "<IP_Address>"
  connection_settings {
      connections{
        name = "TestFCNetwork"
        port_id = "1"
        network_uri = "r/rest/fc-networks/<Network_URI>"
        wwpn = "29:00:7a:2b:21:e0:00:7c"
      }
  }
}

Here is the output I get with debug mode turned on: 

Plan: 1 to add, 0 to change, 0 to destroy.
2022-05-30T15:31:27.247+0200 [DEBUG] command: asking for input: "\nDo you want to perform these actions in workspace \"cre\"?"

Do you want to perform these actions in workspace "create"?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

2022-05-30T15:31:37.380+0200 [INFO]  backend/local: apply calling Apply
2022-05-30T15:31:37.380+0200 [DEBUG] Building and walking apply graph for NormalMode plan
2022-05-30T15:31:37.380+0200 [DEBUG] Resource state not found for node "module.Add_Server_Profile_Terraform.oneview_serverofile.server_profile[\"Profile1\"]", instance module.Add_Server_Profile_Terraform.oneview_server_profile.server_profile["Pile1"]
2022-05-30T15:31:37.381+0200 [DEBUG] ProviderTransformer: "module.Add_Server_Profile_Terraform.oneview_server_profile.servprofile[\"Profile1\"]" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/hewlettpackard/onew"]
2022-05-30T15:31:37.381+0200 [DEBUG] ProviderTransformer: "module.Add_Server_Profile_Terraform.oneview_server_profile.servprofile (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"] 
2022-05-30T15:31:37.382+0200 [DEBUG] ProviderTransformer: "oneview_scope.scope (expand)" (*terraform.nodeExpandApplyableRerce) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-05-30T15:31:37.382+0200 [DEBUG] pruning unused provider["registry.terraform.io/hashicorp/null"]
2022-05-30T15:31:37.382+0200 [DEBUG] ReferenceTransformer: "var.SAN_Password" references: []
2022-05-30T15:31:37.383+0200 [DEBUG] ReferenceTransformer: "var.Volume" references: []
2022-05-30T15:31:37.383+0200 [DEBUG] ReferenceTransformer: "oneview_scope.scope (expand)" references: []
2022-05-30T15:31:37.383+0200 [DEBUG] ReferenceTransformer: "var.Replicated_Volumes" references: []
2022-05-30T15:31:37.383+0200 [DEBUG] ReferenceTransformer: "var.Server_List" references: []
2022-05-30T15:31:37.383+0200 [DEBUG] ReferenceTransformer: "var.Alletra_Password" references: []
2022-05-30T15:31:37.384+0200 [DEBUG] ReferenceTransformer: "var.ILO_User" references: []
2022-05-30T15:31:37.384+0200 [DEBUG] ReferenceTransformer: "var.Alletra_User" references: []
2022-05-30T15:31:37.384+0200 [DEBUG] ReferenceTransformer: "var.ILO_Password" references: []
2022-05-30T15:31:37.384+0200 [DEBUG] ReferenceTransformer: "var.Networks" references: []
2022-05-30T15:31:37.384+0200 [DEBUG] ReferenceTransformer: "var.Server_User" references: []
2022-05-30T15:31:37.385+0200 [DEBUG] ReferenceTransformer: "module.Add_Server_Profile_Terraform.oneview_server_profile.ser_profile[\"Profile1\"]" references: [module.Add_Server_Profile_Terraform.var.Profile (expand)]
2022-05-30T15:31:37.385+0200 [DEBUG] ReferenceTransformer: "module.Add_Server_Profile_Terraform (expand)" references: []  
2022-05-30T15:31:37.385+0200 [DEBUG] ReferenceTransformer: "var.OV_Endpoint" references: []
2022-05-30T15:31:37.385+0200 [DEBUG] ReferenceTransformer: "var.OV_Password" references: []
2022-05-30T15:31:37.385+0200 [DEBUG] ReferenceTransformer: "var.Server_Profiles" references: []
2022-05-30T15:31:37.385+0200 [DEBUG] ReferenceTransformer: "var.Server_Password" references: []
2022-05-30T15:31:37.385+0200 [DEBUG] ReferenceTransformer: "var.SAN_Manager_IPs" references: []
2022-05-30T15:31:37.386+0200 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hewlettpackard/oneview\"]" reences: [var.OV_Password var.OV_User var.OV_Endpoint]
2022-05-30T15:31:37.386+0200 [DEBUG] ReferenceTransformer: "var.Operation_Type" references: []
2022-05-30T15:31:37.386+0200 [DEBUG] ReferenceTransformer: "var.Storage_Pools" references: []
2022-05-30T15:31:37.386+0200 [DEBUG] ReferenceTransformer: "var.OV_User" references: []
2022-05-30T15:31:37.386+0200 [DEBUG] ReferenceTransformer: "var.SAN_User" references: []
2022-05-30T15:31:37.386+0200 [DEBUG] ReferenceTransformer: "var.Server_Templates" references: []
2022-05-30T15:31:37.387+0200 [DEBUG] ReferenceTransformer: "var.SS_Proximity" references: []
2022-05-30T15:31:37.387+0200 [DEBUG] ReferenceTransformer: "module.Add_Server_Profile_Terraform (close)" references: []   
2022-05-30T15:31:37.387+0200 [DEBUG] ReferenceTransformer: "module.Add_Server_Profile_Terraform.oneview_server_profile.ser_profile (expand)" references: [module.Add_Server_Profile_Terraform.var.Profile (expand)]
2022-05-30T15:31:37.387+0200 [DEBUG] ReferenceTransformer: "var.Script_Dir" references: []
2022-05-30T15:31:37.387+0200 [DEBUG] ReferenceTransformer: "module.Add_Server_Profile_Terraform.var.Profile (expand)" refeces: [var.Server_Profiles]
2022-05-30T15:31:37.388+0200 [DEBUG] pruneUnusedNodes: oneview_scope.scope (expand) is no longer needed, removing
2022-05-30T15:31:37.389+0200 [DEBUG] Starting graph walk: walkApply
2022-05-30T15:31:37.390+0200 [DEBUG] created provider logger: level=debug
2022-05-30T15:31:37.390+0200 [INFO]  provider: configuring client automatic mTLS
2022-05-30T15:31:37.400+0200 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hewlettpacd/oneview/6.5.0-13/windows_amd64/terraform-provider-oneview_v6.5.0-13.exe args=[.terraform/providers/registry.terraform.iowlettpackard/oneview/6.5.0-13/windows_amd64/terraform-provider-oneview_v6.5.0-13.exe]
2022-05-30T15:31:37.409+0200 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hewlettpack/oneview/6.5.0-13/windows_amd64/terraform-provider-oneview_v6.5.0-13.exe pid=40640
2022-05-30T15:31:37.409+0200 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hettpackard/oneview/6.5.0-13/windows_amd64/terraform-provider-oneview_v6.5.0-13.exe
2022-05-30T15:31:37.439+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: configuring server automatic mTLS:mestamp=2022-05-30T15:31:37.436+0200
2022-05-30T15:31:37.470+0200 [DEBUG] provider: using plugin: version=5
2022-05-30T15:31:37.470+0200 [DEBUG] provider.terraform-provider-oneview_v6.5.0-13.exe: plugin address: address=127.0.0.1:00 network=tcp timestamp=2022-05-30T15:31:37.469+0200
2022-05-30T15:31:37.545+0200 [WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/hewlettpackard/oneview\ changed the config value, but that value is unused
2022-05-30T15:31:38.815+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [WARN] Truncat attribute path of 0 diagnostics for TypeSet: timestamp=2022-05-30T15:31:38.815+0200
2022-05-30T15:31:38.820+0200 [WARN]  Provider "registry.terraform.io/hewlettpackard/oneview" produced an invalid plan for ule.Add_Server_Profile_Terraform.oneview_server_profile.server_profile["Profile1"], but we are tolerating it because it ising the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .update_type: planned value cty.StringVal("put") for a non-computed attribute
      - .san_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unkno
instead
      - .bios_option: attribute representing nested block must not be unknown itself; set nested attribute values to unkno
instead
      - .firmware: attribute representing nested block must not be unknown itself; set nested attribute values to unknown tead
      - .os_deployment_settings: attribute representing nested block must not be unknown itself; set nested attribute valu
to unknown instead
      - .volume_attachments: attribute representing nested block must not be unknown itself; set nested attribute values tnknown instead
      - .boot: attribute representing nested block must not be unknown itself; set nested attribute values to unknown inst      - .boot_mode: attribute representing nested block must not be unknown itself; set nested attribute values to unknownstead
      - .local_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unkn instead
      - .management_processor: attribute representing nested block must not be unknown itself; set nested attribute values unknown instead
module.Add_Server_Profile_Terraform.oneview_server_profile.server_profile["Profile1"]: Creating...
2022-05-30T15:31:38.823+0200 [INFO]  Starting apply for module.Add_Server_Profile_Terraform.oneview_server_profile.server_file["Profile1"]
2022-05-30T15:31:38.824+0200 [DEBUG] module.Add_Server_Profile_Terraform.oneview_server_profile.server_profile["Profile1"]pplying the planned Create change
2022-05-30T15:31:38.827+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settinomputed for "os_deployment_settings" from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200
2022-05-30T15:31:38.827+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settinomputed for "san_storage" from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200
2022-05-30T15:31:38.828+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settinomputed for "volume_attachments" from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200
2022-05-30T15:31:38.828+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settinomputed for "firmware" from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200
2022-05-30T15:31:38.828+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settinomputed for "management_processor" from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200
2022-05-30T15:31:38.828+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settin2022-05-30T15:31:38.829+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settining computed for "bios_option" from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200                                in
2022-05-30T15:31:38.829+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settining computed for "connection_settings.0.connections.0.ipv4" from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200   in
2022-05-30T15:31:38.830+0200 [INFO]  provider.terraform-provider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settiner_Profile_Terraform.oneview_server_profile.server_profile[\from ComputedKeys: timestamp=2022-05-30T15:31:38.827+0200   "Profile1\"]" error: Provider produced inconsistent result aider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settinfter apply                                                  from ComputedKeys: timestamp=2022-05-30T15:31:38.828+0200   
╷                                                           ider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settin
│ Error: Provider produced inconsistent result after apply  from ComputedKeys: timestamp=2022-05-30T15:31:38.828+0200   
│                                                           ider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settin
│ When applying changes to module.Add_Server_Profile_Terrafofrom ComputedKeys: timestamp=2022-05-30T15:31:38.828+0200   rm.oneview_server_profile.server_profile["Profile1"], providider-oneview_v6.5.0-13.exe: 2022/05/30 15:31:38 [DEBUG] settiner                                                          from ComputedKeys: timestamp=2022-05-30T15:31:38.828+0200   
│ "provider[\"registry.terraform.io/hewlettpackard/oneview\"er_Profile_Terraform.oneview_server_profile.server_profile[\in]" produced an unexpected new value: Root resource was presefter applynt,                                                                                                                     "P
│ but now absent.
│
│ This is a bug in the provider, which should be reported inrm.oneview_server_profile.server_profile["Profile1"], provid the provider's own issue tracker.                                                                                      er
╵                                                           ]" produced an unexpected new value: Root resource was present
2022-05-30T15:31:39.174+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-05-30T15:31:39.200+0200 [DEBUG] provider: plugin proces the provider's own issue tracker.s exited: path=.terraform/providers/registry.terraform.io/he                                                            e wlettpackard/oneview/6.5.0-13/windows_amd64/terraform-provider-oneview_v6.5.0-13.exe pid=40640
2022-05-30T15:31:39.200+0200 [DEBUG] provider: plugin exited```

Thank you again for all your assistance!
nabhajit-ray commented 2 years ago

Hey @josyfj ,

One quick query, are you having any hostname for your server hardware? In OneView GUI can you check whether the server hardware name is having the iLO ipaddress or the iLO hostname?

josyfj commented 2 years ago

Hello @nabhajit-ray ,

We are using the IP address in this case. There is no hostname currently.

nabhajit-ray commented 2 years ago

Hi @josyfj ,

As discussed we are not able to reproduce the issue. So it would be helpful if you can share the terraform configuration file used by you. Thanks,

nabhajit-ray commented 2 years ago

Since no reponse was received, Closing it now.