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

Using server profile template for profile creation generates: Error: Provider produced inconsistent result after apply #448

Closed BoudewijnSwen closed 2 years ago

BoudewijnSwen commented 2 years ago

OneView version: 6.40.00-0450507 Terraform OneView provider: version = "6.4.0-13"

After creating a server profile template for a DL380 Gen9 1 and trying to use it for a server profile, I seem to keep running into a bug in the provider.

main.tf:

# Setup Terraform OneView provider
terraform {
  required_version = ">= 0.13"
  required_providers {
    oneview = {
      source  = "hewlettpackard/oneview"
      version = "6.4.0-13"
    }
  }
}

# Setup local variables
locals {
  ov_endpoint = "https://10.${var.mgt_subnet}.13.37"
}

# Create terraform OneView client
provider "oneview" {
    ov_username   = var.ov_username
    ov_password   = var.ov_password
    ov_endpoint   = local.ov_endpoint
    ov_sslverify  = var.ov_ssl_enabled
    ov_apiversion = var.ov_api_version
    ov_ifmatch    = "*"
}

data "oneview_scope" "scope" {
  name = var.domain_scope
}

data "oneview_server_hardware" "hv1" {
 name = "hv1.fqdn.cloud"
}

data "oneview_server_profile_template" "DL380_Gen9_1_SPT" {
 name = "DL380_Gen9_1_SPT"
}

resource "oneview_server_profile" "hv1_profile" {
  name = "hv1"
  hardware_name = data.oneview_server_hardware.hv1.name
  server_hardware_type = data.oneview_server_profile_template.DL380_Gen9_1_SPT.server_hardware_type
  template = data.oneview_server_profile_template.DL380_Gen9_1_SPT.uri
  scopes_uri = data.oneview_scope.scope.uri
}

terraform apply:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # oneview_server_profile.hv1_profile will be created
  + resource "oneview_server_profile" "hv1_profile" {
      + affinity                      = (known after apply)
      + associated_server             = (known after apply)
      + category                      = (known after apply)
      + created                       = (known after apply)
      + description                   = (known after apply)
      + enclosure_bay                 = (known after apply)
      + enclosure_group               = (known after apply)
      + enclosure_uri                 = (known after apply)
      + etag                          = (known after apply)
      + hardware_name                 = "hv1.fqdn.cloud"
      + hardware_uri                  = (known after apply)
      + hide_unused_flex_nics         = (known after apply)
      + id                            = (known after apply)
      + ilo_ip                        = (known after apply)
      + in_progress                   = (known after apply)
      + iscsi_initiator_name          = (known after apply)
      + iscsi_initiator_name_type     = (known after apply)
      + mac_type                      = (known after apply)
      + modified                      = (known after apply)
      + name                          = "hv1"
      + profile_uuid                  = (known after apply)
      + public_mac                    = (known after apply)
      + public_slot_id                = (known after apply)
      + refresh_state                 = (known after apply)
      + scopes_uri                    = "/rest/scopes/e6971a0e-22cb-451f-8e7a-ec9138931199"
      + serial_number                 = (known after apply)
      + serial_number_type            = (known after apply)
      + server_hardware_reapply_state = (known after apply)
      + server_hardware_type          = "DL380 Gen9 1"
      + server_hardware_type_uri      = (known after apply)
      + service_manager               = (known after apply)
      + state                         = (known after apply)
      + status                        = (known after apply)
      + task_uri                      = (known after apply)
      + template                      = "/rest/server-profile-templates/2568bc8a-665d-4332-bf29-bb52c609a7c9"
      + template_compliance           = (known after apply)
      + type                          = (known after apply)
      + update_type                   = "put"
      + uri                           = (known after apply)
      + uuid                          = (known after apply)
      + wwn_type                      = (known after apply)

      + bios_option {
          + consistency_state = (known after apply)
          + manage_bios       = (known after apply)
          + reapply_state     = (known after apply)

          + overridden_settings {
              + id    = (known after apply)
              + value = (known after apply)
            }
        }

      + boot {
          + boot_order  = (known after apply)
          + manage_boot = (known after apply)
        }

      + boot_mode {
          + manage_mode     = (known after apply)
          + mode            = (known after apply)
          + pxe_boot_policy = (known after apply)
          + secure_boot     = (known after apply)
        }

      + connection_settings {
          + reapply_state = (known after apply)

          + connections {
              + allocated_mbps         = (known after apply)
              + allocated_vfs          = (known after apply)
              + function_type          = (known after apply)
              + id                     = (known after apply)
              + interconnect_port      = (known after apply)
              + interconnect_uri       = (known after apply)
              + isolated_trunk         = (known after apply)
              + lag_name               = (known after apply)
              + mac                    = (known after apply)
              + mac_type               = (known after apply)
              + managed                = (known after apply)
              + maximum_mbps           = (known after apply)
              + name                   = (known after apply)
              + network_name           = (known after apply)
              + network_uri            = (known after apply)
              + port_id                = (known after apply)
              + private_vlan_port_type = (known after apply)
              + requested_mbps         = (known after apply)
              + requested_vfs          = (known after apply)
              + state                  = (known after apply)
              + status                 = (known after apply)
              + wwnn                   = (known after apply)
              + wwpn                   = (known after apply)
              + wwpn_type              = (known after apply)

              + boot {
                  + boot_vlan_id       = (known after apply)
                  + boot_volume_source = (known after apply)
                  + ethernet_boot_type = (known after apply)
                  + priority           = (known after apply)

                  + boot_target {
                      + array_wwpn = (known after apply)
                      + lun        = (known after apply)
                    }

                  + iscsi {
                      + boot_target_lun         = (known after apply)
                      + boot_target_name        = (known after apply)
                      + chap_level              = (known after apply)
                      + chap_name               = (known after apply)
                      + chap_secret             = (known after apply)
                      + first_boot_target_ip    = (known after apply)
                      + first_boot_target_port  = (known after apply)
                      + initiator_name          = (known after apply)
                      + initiator_name_source   = (known after apply)
                      + mutual_chap_name        = (known after apply)
                      + mutual_chap_secret      = (known after apply)
                      + second_boot_target_ip   = (known after apply)
                      + second_boot_target_port = (known after apply)
                    }
                }

              + ipv4 {
                  + gateway           = (known after apply)
                  + ip_address        = (known after apply)
                  + ip_address_source = (known after apply)
                  + subnet_mask       = (known after apply)
                }
            }
        }

      + firmware {
          + consistency_state           = (known after apply)
          + firmware_activation_type    = (known after apply)
          + firmware_baseline_uri       = (known after apply)
          + firmware_install_type       = (known after apply)
          + firmware_schedule_date_time = (known after apply)
          + force_install_firmware      = (known after apply)
          + manage_firmware             = (known after apply)
          + reapply_state               = (known after apply)
        }

      + local_storage {
          + reapply_state = (known after apply)

          + controller {
              + device_slot              = (known after apply)
              + drive_write_cache        = (known after apply)
              + import_configuration     = (known after apply)
              + initialize               = (known after apply)
              + mode                     = (known after apply)
              + predictive_spare_rebuild = (known after apply)

              + logical_drives {
                  + accelerator         = (known after apply)
                  + bootable            = (known after apply)
                  + drive_number        = (known after apply)
                  + drive_technology    = (known after apply)
                  + name                = (known after apply)
                  + num_physical_drives = (known after apply)
                  + num_spare_drives    = (known after apply)
                  + raid_level          = (known after apply)
                  + sas_logical_jbod_id = (known after apply)
                }
            }

          + sas_logical_jbod {
              + description          = (known after apply)
              + device_slot          = (known after apply)
              + drive_max_size_gb    = (known after apply)
              + drive_min_size_gb    = (known after apply)
              + drive_technology     = (known after apply)
              + erase_data           = (known after apply)
              + id                   = (known after apply)
              + name                 = (known after apply)
              + num_physical_drive   = (known after apply)
              + persistent           = (known after apply)
              + sas_logical_jbod_uri = (known after apply)
              + status               = (known after apply)
            }
        }

      + management_processor {
          + compliance_control = (known after apply)
          + manage_mp          = (known after apply)
          + reapply_state      = (known after apply)

          + mp_settings {
              + administrator_account {
                  + delete_administrator_account = (known after apply)
                  + password                     = (sensitive value)
                }

              + directory {
                  + directory_authentication     = (known after apply)
                  + directory_generic_ldap       = (known after apply)
                  + directory_server_address     = (known after apply)
                  + directory_server_certificate = (known after apply)
                  + directory_server_port        = (known after apply)
                  + directory_user_context       = (known after apply)
                  + ilo_distinguished_name       = (known after apply)
                  + kerberos_authentication      = (known after apply)
                  + kerberos_kdc_server_address  = (known after apply)
                  + kerberos_kdc_server_port     = (known after apply)
                  + kerberos_key_tab             = (known after apply)
                  + kerberos_realm               = (known after apply)
                  + password                     = (sensitive value)
                }

              + directory_groups {
                  + group_dn                     = (known after apply)
                  + group_sid                    = (known after apply)
                  + ilo_config_priv              = (known after apply)
                  + remote_console_priv          = (known after apply)
                  + user_config_priv             = (known after apply)
                  + virtual_media_priv           = (known after apply)
                  + virtual_power_and_reset_priv = (known after apply)
                }

              + ilo_host_name {
                  + hostname = (known after apply)
                }

              + key_manager {
                  + certificate_name         = (known after apply)
                  + group_name               = (known after apply)
                  + login_name               = (known after apply)
                  + password                 = (sensitive value)
                  + primary_server_address   = (known after apply)
                  + primary_server_port      = (known after apply)
                  + redundancy_required      = (known after apply)
                  + secondary_server_address = (known after apply)
                  + secondary_server_port    = (known after apply)
                }

              + local_accounts {
                  + display_name                 = (known after apply)
                  + ilo_config_priv              = (known after apply)
                  + password                     = (sensitive value)
                  + remote_console_priv          = (known after apply)
                  + user_config_priv             = (known after apply)
                  + user_name                    = (known after apply)
                  + virtual_media_priv           = (known after apply)
                  + virtual_power_and_reset_priv = (known after apply)
                }
            }
        }

      + os_deployment_settings {
          + deploy_method           = (known after apply)
          + deployment_mac          = (known after apply)
          + deployment_port_id      = (known after apply)
          + force_os_deployment     = (known after apply)
          + os_deployment_plan_name = (known after apply)
          + os_deployment_plan_uri  = (known after apply)
          + os_volume               = (known after apply)
          + reapply_state           = (known after apply)

          + os_custom_attributes {
              + constraints = (known after apply)
              + name        = (known after apply)
              + type        = (known after apply)
              + value       = (known after apply)
            }
        }

      + san_storage {
          + host_os_type       = (known after apply)
          + manage_san_storage = (known after apply)

          + san_system_credentials {
              + chap_level         = (known after apply)
              + chap_name          = (known after apply)
              + chap_secret        = (known after apply)
              + chap_source        = (known after apply)
              + mutual_chap_name   = (known after apply)
              + mutual_chap_secret = (known after apply)
              + storage_system_uri = (known after apply)
            }
        }

      + volume_attachments {
          + associated_template_attachment_id = (known after apply)
          + boot_volume_priority              = (known after apply)
          + id                                = (known after apply)
          + is_permanent                      = (known after apply)
          + lun                               = (known after apply)
          + lun_type                          = (known after apply)
          + state                             = (known after apply)
          + status                            = (known after apply)
          + volume_storage_system_uri         = (known after apply)
          + volume_uri                        = (known after apply)

          + storage_paths {
              + connection_id   = (known after apply)
              + is_enabled      = (known after apply)
              + network_uri     = (known after apply)
              + status          = (known after apply)
              + target_selector = (known after apply)

              + targets {
                  + ip_address = (known after apply)
                  + name       = (known after apply)
                  + tcp_port   = (known after apply)
                }
            }

          + volume {
              + initial_scope_uris = (known after apply)
              + is_permanent       = (known after apply)
              + template_uri       = (known after apply)

              + properties {
                  + data_protection_level            = (known after apply)
                  + data_transfer_limit              = (known after apply)
                  + description                      = (known after apply)
                  + folder                           = (known after apply)
                  + iops_limit                       = (known after apply)
                  + is_adaptive_optimization_enabled = (known after apply)
                  + is_compressed                    = (known after apply)
                  + is_data_reduction_enabled        = (known after apply)
                  + is_deduplicated                  = (known after apply)
                  + is_encrypted                     = (known after apply)
                  + is_pinned                        = (known after apply)
                  + is_shareable                     = (known after apply)
                  + name                             = (known after apply)
                  + performance_policy               = (known after apply)
                  + provisioning_type                = (known after apply)
                  + size                             = (known after apply)
                  + snapshot_pool                    = (known after apply)
                  + storage_pool                     = (known after apply)
                  + template_version                 = (known after apply)
                  + volume_set                       = (known after apply)
                }
            }
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.
2021-12-22T01:26:04.903-0500 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

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

  Enter a value: yes

Debug log after the apply:

2021-12-22T01:26:06.628-0500 [INFO]  backend/local: apply calling Apply
2021-12-22T01:26:06.628-0500 [DEBUG] Building and walking apply graph for NormalMode plan
2021-12-22T01:26:06.628-0500 [DEBUG] Resource state not found for node "oneview_server_profile.hv1_profile", instance oneview_server_profile.hv1_profile
2021-12-22T01:26:06.628-0500 [DEBUG] ProviderTransformer: "data.oneview_server_profile_template.DL380_Gen9_1_SPT (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2021-12-22T01:26:06.628-0500 [DEBUG] ProviderTransformer: "oneview_server_profile.hv1_profile" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2021-12-22T01:26:06.628-0500 [DEBUG] ProviderTransformer: "data.oneview_scope.scope (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2021-12-22T01:26:06.628-0500 [DEBUG] ProviderTransformer: "data.oneview_server_hardware._hv006 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2021-12-22T01:26:06.628-0500 [DEBUG] ProviderTransformer: "oneview_server_profile.hv1_profile (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2021-12-22T01:26:06.628-0500 [DEBUG] ReferenceTransformer: "oneview_server_profile.hv1_profile (expand)" references: []
2021-12-22T01:26:06.628-0500 [DEBUG] ReferenceTransformer: "data.oneview_server_profile_template.DL380_Gen9_1_SPT (expand)" references: []
2021-12-22T01:26:06.628-0500 [DEBUG] ReferenceTransformer: "var.domain_scope" references: []
2021-12-22T01:26:06.628-0500 [DEBUG] ReferenceTransformer: "var.nlc_env" references: []
2021-12-22T01:26:06.628-0500 [DEBUG] ReferenceTransformer: "var.mgt_subnet" references: []
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "oneview_server_profile.hv1_profile" references: [data.oneview_scope.scope (expand) data.oneview_server_hardware._hv006 (expand) data.oneview_server_profile_template.DL380_Gen9_1_SPT (expand) data.oneview_server_profile_template.DL380_Gen9_1_SPT (expand)]
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hewlettpackard/oneview\"]" references: [var.ov_username var.ov_api_version local.ov_endpoint (expand) var.ov_password var.ov_ssl_enabled]
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "var.ov_api_version" references: []
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "var.ov_ssl_enabled" references: []
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "data.oneview_scope.scope (expand)" references: []
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "local.ov_endpoint (expand)" references: [var.mgt_subnet]
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "data.oneview_server_hardware._hv006 (expand)" references: []
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "var.ov_username" references: []
2021-12-22T01:26:06.629-0500 [DEBUG] ReferenceTransformer: "var.ov_password" references: []
2021-12-22T01:26:06.629-0500 [DEBUG] Starting graph walk: walkApply
2021-12-22T01:26:06.630-0500 [DEBUG] created provider logger: level=debug
2021-12-22T01:26:06.630-0500 [INFO]  provider: configuring client automatic mTLS
2021-12-22T01:26:06.640-0500 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.4.0-13/linux_amd64/terraform-provider-oneview_v6.4.0-13 args=[.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.4.0-13/linux_amd64/terraform-provider-oneview_v6.4.0-13]
2021-12-22T01:26:06.641-0500 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.4.0-13/linux_amd64/terraform-provider-oneview_v6.4.0-13 pid=45022
2021-12-22T01:26:06.641-0500 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.4.0-13/linux_amd64/terraform-provider-oneview_v6.4.0-13
2021-12-22T01:26:06.650-0500 [INFO]  provider.terraform-provider-oneview_v6.4.0-13: configuring server automatic mTLS: timestamp=2021-12-22T01:26:06.648-0500
2021-12-22T01:26:06.671-0500 [DEBUG] provider: using plugin: version=5
2021-12-22T01:26:06.671-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: plugin address: address=/tmp/plugin056292869 network=unix timestamp=2021-12-22T01:26:06.671-0500
2021-12-22T01:26:06.708-0500 [DEBUG] No provider meta schema returned
2021-12-22T01:26:06.738-0500 [WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/hewlettpackard/oneview\"]" changed the config value, but that value is unused
2021-12-22T01:26:06.798-0500 [WARN]  Provider "registry.terraform.io/hewlettpackard/oneview" produced an invalid plan for oneview_server_profile.hv1_profile, but we are tolerating it because it is using 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
      - .connection_settings: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .firmware: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .san_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .boot: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .boot_mode: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .management_processor: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .os_deployment_settings: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .volume_attachments: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .bios_option: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .local_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
oneview_server_profile.hv1_profile: Creating...
2021-12-22T01:26:06.798-0500 [INFO]  Starting apply for oneview_server_profile.hv1_profile
2021-12-22T01:26:06.800-0500 [DEBUG] oneview_server_profile.hv1_profile: applying the planned Create change
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "os_deployment_settings" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "management_processor" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "local_storage" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "volume_attachments" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "bios_option" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "san_storage" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "boot" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "connection_settings" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "firmware" from ComputedKeys
2021-12-22T01:26:06.803-0500 [DEBUG] provider.terraform-provider-oneview_v6.4.0-13: 2021/12/22 01:26:06 [DEBUG] setting computed for "boot_mode" from ComputedKeys
2021-12-22T01:26:06.814-0500 [ERROR] vertex "oneview_server_profile.hv1_profile" error: Provider produced inconsistent result after apply
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to oneview_server_profile.hv1_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.
╵
2021-12-22T01:26:06.817-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-12-22T01:26:06.818-0500 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.4.0-13/linux_amd64/terraform-provider-oneview_v6.4.0-13 pid=45022
2021-12-22T01:26:06.818-0500 [DEBUG] provider: plugin exited

Hopefully this all a clear report and someone can help me out here! If you need additional information, I am happy to provide it!

BoudewijnSwen commented 2 years ago

Am I posting this in the wrong place? Or is there any information missing? I would love to provide more feedback if needed, but I am not sure anyone is reading/maintaining this :)

nabhajit-ray commented 2 years ago

Hi @BoudewijnSwen ,

Can you clean up your state file and try this again?

BoudewijnSwen commented 2 years ago

Ran it again in a clean environment. Same issue.

Now with OV Version: 6.50.00-0452161 SDK version: "6.1.0-13" (local setup of master branch, to be able to use templates for Gen10's)

Main.tf: (omitted all non relevant stuff)

terraform {
  required_version = ">= 0.13"
  required_providers {
    oneview = {
      source  = "hewlettpackard/oneview"
      version = "6.1.0-13"
    }
  }
}

locals {
  workload_hypervisors = {
    "hv001" = { sn = "ABCDE", profile_name = "hv001" },
    "hv002" = { sn = "XYZ", profile_name = "hv002" }
  }
}

data "oneview_server_profile_template" "DL380_Gen9_1_W_SPT" {
  name = "${upper(var.env)}_DL380_Gen9_1_W_SPT"
}

resource "oneview_server_profile" "wdhv_profile" {
  for_each              = local.workload_hypervisors
  name                  = each.value.profile_name
  hardware_name         = "ILO${each.value.sn}.x.cloud"
  server_hardware_type  = data.oneview_server_profile_template.DL380_Gen9_1_W_SPT.server_hardware_type
  template              = data.oneview_server_profile_template.DL380_Gen9_1_W_SPT.uri
  scopes_uri            = data.oneview_scope.workload.uri
}

Terraform apply:

Terraform will perform the following actions:

  # oneview_server_profile.wdhv_profile["hv001"] will be created
  + resource "oneview_server_profile" "wdhv_profile" {
      + hardware_name                 = "ILOABCDE.x.cloud"
      + name                          = "hv001"
      + scopes_uri                    = "/rest/scopes/1e748329-09b5-48be-bdec-27f62bd9a8dc"
      + server_hardware_type          = "DL380 Gen9 1"
      + template                      = "/rest/server-profile-templates/e02cdb3a-c296-436e-9e49-4db490403dc1"
      + update_type                   = "put"

      <values omitted --> All (known after apply)>
    }

  # oneview_server_profile.wdhv_profile["hv002"] will be created
  + resource "oneview_server_profile" "wdhv_profile" {
      + hardware_name                 = "ILOXYZ.x.cloud"
      + name                          = "hv002"
      + scopes_uri                    = "/rest/scopes/1e748329-09b5-48be-bdec-27f62bd9a8dc"
      + server_hardware_type          = "DL380 Gen9 1"
      + template                      = "/rest/server-profile-templates/e02cdb3a-c296-436e-9e49-4db490403dc1"
      + update_type                   = "put"

      <values omitted --> All (known after apply)>
    }

Plan: 2 to add, 0 to change, 0 to destroy.
2022-03-16T12:11:00.287+0100 [DEBUG] command: asking for input: "\nDo you want to perform these actions?"

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

  Enter a value: yes

2022-03-16T12:11:04.776+0100 [INFO]  backend/local: apply calling Apply
2022-03-16T12:11:04.776+0100 [DEBUG] Building and walking apply graph for NormalMode plan
2022-03-16T12:11:04.777+0100 [DEBUG] Resource state not found for node "oneview_server_profile.wdhv_profile[\"hv001\"]", instance oneview_server_profile.wdhv_profile["hv001"]
2022-03-16T12:11:04.777+0100 [DEBUG] Resource state not found for node "oneview_server_profile.wdhv_profile[\"hv002\"]", instance oneview_server_profile.wdhv_profile["hv002"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "data.oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile.wdhv_profile[\"hv001\"]" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "data.oneview_firmware_drivers.hpe_service_pack_2021_10_0 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile.wdhv_profile (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_appliance_time_and_locale.config (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile_template.DL360_Gen10_Plus_1_W_SPT (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "data.oneview_firmware_drivers.hpe_2021_05_0_and_qlogic_2_29_2_bundle (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "data.oneview_firmware_drivers.qlogic_firmware_2_29_2 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_scope.workload (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile.wdhv_profile[\"hv002\"]" (*terraform.NodeApplyableResourceInstance) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_scope.management (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "data.oneview_firmware_drivers.hpe_service_pack_2021_05_0 (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "data.oneview_scope.management (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "data.oneview_scope.workload (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile_template.DL360_Gen10_Plus_1_M_SPT (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_firmware_drivers.hpe_2021_05_0_and_qlogic_2_29_2_bundle (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile_template.DL380_Gen9_1_M_SPT (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.778+0100 [DEBUG] ProviderTransformer: "oneview_server_profile_template.DL380_Gen9_1_W_EHV_SPT (expand)" (*terraform.nodeExpandApplyableResource) needs provider["registry.terraform.io/hewlettpackard/oneview"]
2022-03-16T12:11:04.779+0100 [DEBUG] ReferenceTransformer: "local.ov_endpoint (expand)" references: [var.env var.ov_domain var.env]
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var._1w1_ilo_hv01_pw" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile_template.DL380_Gen9_1_W_EHV_SPT (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ov_username" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "data.oneview_firmware_drivers.hpe_service_pack_2021_10_0 (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ilo_default_password" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_scope.workload (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile_template.DL360_Gen10_Plus_1_M_SPT (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "local.ov_dns_servers (expand)" references: [var.mgt_subnet var.mgt_subnet]
2022-03-16T12:11:04.780+0100 [INFO]  ReferenceTransformer: reference not found: "each.value"
2022-03-16T12:11:04.780+0100 [INFO]  ReferenceTransformer: reference not found: "each.value"
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile.wdhv_profile[\"hv002\"]" references: [local.workload_hypervisors (expand) var.env data.oneview_scope.workload (expand) data.oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand) data.oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand)]
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ov_password" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ov_domain" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "local.workload_hypervisors (expand)" references: [var.ilo_default_username var._1w1_ilo_hv01_pw var.ilo_default_username var._1w1_ilo_hv02_pw]
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ov_api_version" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_firmware_drivers.hpe_2021_05_0_and_qlogic_2_29_2_bundle (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile_template.DL380_Gen9_1_M_SPT (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "data.oneview_firmware_drivers.hpe_service_pack_2021_05_0 (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_scope.management (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile.wdhv_profile (expand)" references: [local.workload_hypervisors (expand)]
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile_template.DL360_Gen10_Plus_1_W_SPT (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "data.oneview_scope.management (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ov_ssl_enabled" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ilo_user_password" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_appliance_time_and_locale.config (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.mgt_subnet" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "data.oneview_scope.workload (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var._1w1_ilo_hv02_pw" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "data.oneview_firmware_drivers.qlogic_firmware_2_29_2 (expand)" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.env" references: []
2022-03-16T12:11:04.780+0100 [DEBUG] ReferenceTransformer: "var.ilo_default_username" references: []
2022-03-16T12:11:04.780+0100 [INFO]  ReferenceTransformer: reference not found: "each.value"
2022-03-16T12:11:04.782+0100 [INFO]  ReferenceTransformer: reference not found: "each.value"
2022-03-16T12:11:04.782+0100 [DEBUG] ReferenceTransformer: "oneview_server_profile.wdhv_profile[\"hv001\"]" references: [local.workload_hypervisors (expand) data.oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand) var.env data.oneview_scope.workload (expand) data.oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand)]
2022-03-16T12:11:04.782+0100 [DEBUG] ReferenceTransformer: "data.oneview_firmware_drivers.hpe_2021_05_0_and_qlogic_2_29_2_bundle (expand)" references: []
2022-03-16T12:11:04.782+0100 [DEBUG] ReferenceTransformer: "data.oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand)" references: []
2022-03-16T12:11:04.782+0100 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/hewlettpackard/oneview\"]" references: [var.ov_ssl_enabled var.ov_username var.ov_api_version local.ov_endpoint (expand) var.ov_password]
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: data.oneview_firmware_drivers.hpe_2021_05_0_and_qlogic_2_29_2_bundle (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: data.oneview_firmware_drivers.qlogic_firmware_2_29_2 (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_server_profile_template.DL380_Gen9_1_W_EHV_SPT (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_scope.workload (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_server_profile_template.DL360_Gen10_Plus_1_M_SPT (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: data.oneview_firmware_drivers.hpe_service_pack_2021_10_0 (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: local.ov_dns_servers (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: data.oneview_firmware_drivers.hpe_service_pack_2021_05_0 (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_scope.management (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: data.oneview_scope.management (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_server_profile_template.DL360_Gen10_Plus_1_W_SPT (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_server_profile_template.DL380_Gen9_1_W_SPT (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_appliance_time_and_locale.config (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_firmware_drivers.hpe_2021_05_0_and_qlogic_2_29_2_bundle (expand) is no longer needed, removing
2022-03-16T12:11:04.784+0100 [DEBUG] pruneUnusedNodes: oneview_server_profile_template.DL380_Gen9_1_M_SPT (expand) is no longer needed, removing
2022-03-16T12:11:04.786+0100 [DEBUG] Starting graph walk: walkApply
2022-03-16T12:11:04.788+0100 [DEBUG] created provider logger: level=debug
2022-03-16T12:11:04.788+0100 [INFO]  provider: configuring client automatic mTLS
2022-03-16T12:11:04.803+0100 [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.1.0-13/linux_amd64/terraform-provider-oneview_v6.1.0-13 args=[.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.1.0-13/linux_amd64/terraform-provider-oneview_v6.1.0-13]
2022-03-16T12:11:04.804+0100 [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.1.0-13/linux_amd64/terraform-provider-oneview_v6.1.0-13 pid=14977
2022-03-16T12:11:04.804+0100 [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.1.0-13/linux_amd64/terraform-provider-oneview_v6.1.0-13
2022-03-16T12:11:04.826+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: configuring server automatic mTLS: timestamp=2022-03-16T12:11:04.826+0100
2022-03-16T12:11:04.899+0100 [DEBUG] provider: using plugin: version=5
2022-03-16T12:11:04.899+0100 [DEBUG] provider.terraform-provider-oneview_v6.1.0-13: plugin address: address=/tmp/plugin324506112 network=unix timestamp=2022-03-16T12:11:04.898+0100
2022-03-16T12:11:05.036+0100 [WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/hewlettpackard/oneview\"]" changed the config value, but that value is unused
2022-03-16T12:11:05.152+0100 [WARN]  Provider "registry.terraform.io/hewlettpackard/oneview" produced an invalid plan for oneview_server_profile.wdhv_profile["hv002"], but we are tolerating it because it is using 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
      - .volume_attachments: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .boot_mode: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .connection_settings: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .management_processor: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .san_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .bios_option: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .boot: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .firmware: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .local_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .os_deployment_settings: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
2022-03-16T12:11:05.152+0100 [WARN]  Provider "registry.terraform.io/hewlettpackard/oneview" produced an invalid plan for oneview_server_profile.wdhv_profile["hv001"], but we are tolerating it because it is using 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
      - .boot_mode: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .connection_settings: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .management_processor: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .san_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .volume_attachments: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .bios_option: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .boot: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .firmware: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .local_storage: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
      - .os_deployment_settings: attribute representing nested block must not be unknown itself; set nested attribute values to unknown instead
oneview_server_profile.wdhv_profile["hv001"]: Creating...
oneview_server_profile.wdhv_profile["hv002"]: Creating...
2022-03-16T12:11:05.152+0100 [INFO]  Starting apply for oneview_server_profile.wdhv_profile["hv001"]
2022-03-16T12:11:05.153+0100 [INFO]  Starting apply for oneview_server_profile.wdhv_profile["hv002"]
2022-03-16T12:11:05.155+0100 [DEBUG] oneview_server_profile.wdhv_profile["hv001"]: applying the planned Create change
2022-03-16T12:11:05.155+0100 [DEBUG] oneview_server_profile.wdhv_profile["hv002"]: applying the planned Create change
2022-03-16T12:11:05.161+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "volume_attachments" from ComputedKeys: timestamp=2022-03-16T12:11:05.161+0100
2022-03-16T12:11:05.161+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "boot" from ComputedKeys: timestamp=2022-03-16T12:11:05.161+0100
2022-03-16T12:11:05.161+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "firmware" from ComputedKeys: timestamp=2022-03-16T12:11:05.161+0100
2022-03-16T12:11:05.162+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "boot_mode" from ComputedKeys: timestamp=2022-03-16T12:11:05.161+0100
2022-03-16T12:11:05.162+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "management_processor" from ComputedKeys: timestamp=2022-03-16T12:11:05.161+0100
2022-03-16T12:11:05.162+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "local_storage" from ComputedKeys: timestamp=2022-03-16T12:11:05.162+0100
2022-03-16T12:11:05.162+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "connection_settings" from ComputedKeys: timestamp=2022-03-16T12:11:05.162+0100
2022-03-16T12:11:05.162+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "os_deployment_settings" from ComputedKeys: timestamp=2022-03-16T12:11:05.162+0100
2022-03-16T12:11:05.162+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "san_storage" from ComputedKeys: timestamp=2022-03-16T12:11:05.162+0100
2022-03-16T12:11:05.162+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "bios_option" from ComputedKeys: timestamp=2022-03-16T12:11:05.162+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "firmware" from ComputedKeys: timestamp=2022-03-16T12:11:05.166+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "volume_attachments" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "management_processor" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "local_storage" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "boot_mode" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "boot" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "bios_option" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "os_deployment_settings" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "san_storage" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.167+0100 [INFO]  provider.terraform-provider-oneview_v6.1.0-13: 2022/03/16 12:11:05 [DEBUG] setting computed for "connection_settings" from ComputedKeys: timestamp=2022-03-16T12:11:05.167+0100
2022-03-16T12:11:05.418+0100 [ERROR] vertex "oneview_server_profile.wdhv_profile[\"hv002\"]" error: Provider produced inconsistent result after apply
2022-03-16T12:11:05.524+0100 [ERROR] vertex "oneview_server_profile.wdhv_profile[\"hv001\"]" error: Provider produced inconsistent result after apply
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to oneview_server_profile.wdhv_profile["hv002"], 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.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to oneview_server_profile.wdhv_profile["hv001"], 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.
╵
2022-03-16T12:11:05.629+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-03-16T12:11:05.631+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hewlettpackard/oneview/6.1.0-13/linux_amd64/terraform-provider-oneview_v6.1.0-13 pid=14977
2022-03-16T12:11:05.631+0100 [DEBUG] provider: plugin exited
BoudewijnSwen commented 2 years ago

BTW: Copy-pasting most of the settings (not the "compliance_control" attributes) from the template into the "oneview_server_profile" resource and creating it like that seems to work fine. Also applying the template via the UI works fine as well.

nabhajit-ray commented 2 years ago

Hi @BoudewijnSwen ,

After looking into your configuration, we found that you're using template uri instead of template name during server profile creation.

Correct configuration will be:

resource "oneview_server_profile" "hv1_profile" { name = "hv1" hardware_name = data.oneview_server_hardware.hv1.name server_hardware_type = data.oneview_server_profile_template.DL380_Gen9_1_SPT.server_hardware_type template = data.oneview_server_profile_template.DL380_Gen9_1_SPT.name scopes_uri = data.oneview_scope.scope.uri } We have the correct configuration in our documentation. It is missing in our example which will be fixed. Let us know if it works for you.

nabhajit-ray commented 2 years ago

Closing this, since we did not hear from you. Please reopen if it is still not fixed