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

[ISSUE] Resource intersight_resourcepool_pool has insufficient parameters #270

Open
3 tasks done
cwilloughby-bw opened this issue Apr 22, 2024 · 7 comments
Open
3 tasks done

Comments

@cwilloughby-bw
Copy link

Bug Report Checklist

  • Have you provided a full/minimal configuration to reproduce the issue?
  • Have you [tested with the latest master] to confirm the issue still exists?
  • Have you provided the terraform console logs with environment variable set to TF_LOG=trace?
Description

The intersight_resourcepool_pool resource does not support the full set of parameters required to create a "Server" type resource

Terraform-provider-intersight version

1.0.47

Configuration file
resource "intersight_resourcepool_pool" "hv-m5-g2" {
    name = "hypervisor-pool"

    resource_type = "Server"

    organization {
        object_type = "organization.Organization"
        moid = var.organization_id
    }
}
Actual output (Attach screenshots if applicable)
│ Error: error occurred while updating ResourcepoolPool: 400 Bad Request Response from endpoint: {"code":"InvalidRequest","message":"The Target Platform is mandatory for Resource Pool with Server type.","messageId":"malibu_res_poolparam_mandatory","traceId":"Xa-cW5SmZLetLdQFcmE9vMdeZUkOczYVcigJr5YczlmI_8o_GbJNbg=="}
│ 
│   with module.lab2-pod1.intersight_resourcepool_pool.hv-m5-g2,
│   on ../../modules/site_pod/pools_resource.tf line 14, in resource "intersight_resourcepool_pool" "hv-m5-g2":
│   14: resource "intersight_resourcepool_pool" "hv-m5-g2" {
Related issues/PRs

None found

Suggest a fix

Add support for Target Platform parameter to be set with the intersight_resourcepool_pool resource type.

@cwilloughby-bw
Copy link
Author

Poking at the API, I'm not seeing an actual "Target Platform" parameter there either, so it seems that the presented error message is either inaccurate, or full data isn't being returned in GETs to the /api/v1/resourcepool/Pools endpoint

@vvb
Copy link
Collaborator

vvb commented Apr 23, 2024

@cwilloughby-bw The error is poorly worded and not pointing to the exact property that is missing in the request. I will put in a request to update this error message to be more useful. I think you are missing resource_pool_parameters

resource_pool_parameters = {
object_type = "resourcepool.ServerPoolParameters"
management_mode = "Intersight"
}

@cwilloughby-bw
Copy link
Author

Hey @vvb ,

Thanks for the prompt response! I saw that resource_pool_parameters property in the docs, but it only supports the object_type field. Attempting to set management_mode results in:

│ Error: Unsupported argument
│ 
│   on ../../modules/site_pod/pools_resource.tf line 26, in resource "intersight_resourcepool_pool" "hv-m5-g2":
│   26:         management_mode = "Intersight"
│ 
│ An argument named "management_mode" is not expected here.

@vvb
Copy link
Collaborator

vvb commented May 10, 2024

We need to work on simplifying this. Below is what would work,

resource_pool_parameters {
  object_type    = "resourcepool.ServerPoolParameters"
  class_id       = "resourcepool.ServerPoolParameters"
  additional_properties = jsonencode({
    ResourcepoolServerPoolParameters = {
      ClassId = "resourcepool.ServerPoolParameters"
      ObjectType = "resourcepool.ServerPoolParameters"
      ManagementMode = "Intersight"
    }
  })
}

@cwilloughby-bw
Copy link
Author

cwilloughby-bw commented Jun 1, 2024

Hey @vvb,

This is not working properly in my testing. It's now creating the resource pool, but the management mode is always "IntersightStandalone". Subsequent plans show Terraform wanting to modify the management mode, but that never seems to actually happen.

I ended up needing to modify the above example for it to work properly:

resource_pool_parameters {
        object_type    = "resourcepool.ServerPoolParameters"
        class_id       = "resourcepool.ServerPoolParameters"
        additional_properties = jsonencode({
            ManagementMode = "Intersight"
        })
    }

@scotttyso
Copy link

@mohamuni
Copy link
Contributor

Hi @cwilloughby-bw ,

Please find working example for creating resource pool and setting the ManagementMode attribute.

resource "intersight_resourcepool_pool" "demo_pool" {
    name = "DemoTfPool"
    resource_type = "Server"
    organization {
        object_type = "organization.Organization"
        moid = data.intersight_organization_organization.organization.id
    }
    resource_pool_parameters  {
            class_id = "resourcepool.ServerPoolParameters"
            object_type = "resourcepool.ServerPoolParameters"
            additional_properties = jsonencode({
                ManagementMode = "Intersight"
            })
    }
}

With respect to concerns regarding management mode is always "IntersightStandalone". Subsequent plans show Terraform wanting to modify the management mode, but that never seems to actually happen. We cannot change ManagementMode once the resource pool is created with particular ManagementMode. In case if you need to change ManagementMode you need to destroy the existing resource pool and create new resourcepool with the required ManagementMode. Please let us know in case of any issues/concerns

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

No branches or pull requests

4 participants