Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(serverprofile): add force param to serverprofile creation #551

Merged
merged 1 commit into from
Nov 15, 2023
Merged

feat(serverprofile): add force param to serverprofile creation #551

merged 1 commit into from
Nov 15, 2023

Conversation

FalcoSuessgott
Copy link
Contributor

@FalcoSuessgott FalcoSuessgott commented Nov 6, 2023

This PR adds a list of strings attribute called force_flag to the oneview_server_profile-resource, that was added in HewlettPackard/oneview-golang#403:

data "oneview_server_profile_template" "template" {
  # template name: <Product-Name>_<config_pattern>_<firmware>
  # beispiel: ProLiant DL20 Gen10 Plus -> ProLiant_DL20_Gen10_Plus_default_latest
  name = "${var.product_name}_${var.config_pattern}_${var.firmware_baseline}"
}

resource "oneview_server_profile" "this" {
  name                 = var.hostname
  hardware_name        = var.hostname
  server_hardware_type = data.oneview_server_profile_template.template.server_hardware_type
  template             = data.oneview_server_profile_template.template.name

  force_flags = ["ignoreServerHealth"]
}

I have tested the change and it works as expected:

data.http.ilo["XXXXXXXX"]: Reading...
data.vault_generic_secret.lxca_creds: Reading...
data.vault_generic_secret.oneview_creds: Reading...
module.bm4x_server_project.data.vault_generic_secret.appliance_pw["XXXXXXXX"]: Reading...
module.bm4x_server_project.data.vault_generic_secret.user_pass["XXXXXXXX-bm4xoperator"]: Reading...
module.bm4x_server_project.module.hpe_server["XXXXXXXX"].data.oneview_server_profile_template.template: Reading...
module.bm4x_server_project.data.vault_generic_secret.user_pass["XXXXXXXX-bm4xoperator"]: Read complete after 0s [id=91195/bamberg-10/bm4x/compute/XXXXXXXX/users/admin]
module.bm4x_server_project.data.vault_generic_secret.appliance_pw["XXXXXXXX"]: Read complete after 0s [id=91195/bamberg-10/bm4x/compute/XXXXXXXX/users/appliance]
module.bm4x_server_project.module.hpe_server["XXXXXXXX"].data.oneview_server_profile_template.template: Read complete after 0s [id=ProLiant_DL20_Gen10_Plus_default_latest]
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:
  # module.bm4x_server_project.module.hpe_server["XXXXXXXX"].oneview_server_profile.this will be created
  + resource "oneview_server_profile" "this" {
      + 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)
      + force_flags                   = [
          + "ignoreServerHealth",
        ]
      + hardware_name                 = "bmbg10com5i0t"
      + 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                          = "bmbg10com5i0t"
      + profile_uuid                  = (known after apply)
      + public_mac                    = (known after apply)
      + public_slot_id                = (known after apply)
      + refresh_state                 = (known after apply)
      + scopes_uri                    = (known after apply)
      + serial_number                 = (known after apply)
      + serial_number_type            = (known after apply)
      + server_hardware_reapply_state = (known after apply)
      + server_hardware_type          = "DL20 Gen10 Plus"
      + 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                      = "ProLiant_DL20_Gen10_Plus_default_latest"
      + template_compliance           = (known after apply)
      + type                          = (known after apply)
      + uri                           = (known after apply)
      + uuid                          = (known after apply)
      + wwn_type                      = (known after apply)
    }
Plan: 1 to add, 0 to change, 0 to destroy.

module.bm4x_server_project.module.hpe_server["XXXXXXXX"].oneview_server_profile.this: Creating...
module.bm4x_server_project.module.hpe_server["XXXXXXXX"].oneview_server_profile.this: Still creating... [10s elapsed]
[...]
module.bm4x_server_project.module.hpe_server["XXXXXXXX"].oneview_server_profile.this: Creation complete after 8m52s [id=bmbg10com5i0t]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

fixes #548.

Copy link
Collaborator

@nabhajit-ray nabhajit-ray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add some example configuration for the same. Also the gofmt need to run

@FalcoSuessgott
Copy link
Contributor Author

I will provide some test results tomorrow with the provider containing that change

Copy link
Collaborator

@akshith-gunasheelan akshith-gunasheelan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@nabhajit-ray nabhajit-ray merged commit cf67623 into HewlettPackard:master Nov 15, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: The selected server hardware has health status other than "OK"
3 participants