From f434f2781d524977739ba7371f623175f13505ad Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Tue, 18 Feb 2025 02:22:43 -0600 Subject: [PATCH] [Datasource][Resource] Add dedicated host id attribute to shared processor poo (#5992) * Update dependencies * Add dedicated host id attribute to shared processor pool resource and data source * Update documentation --- .../data_source_ibm_pi_shared_processor_pool.go | 6 ++++++ .../data_source_ibm_pi_shared_processor_pools.go | 6 ++++++ ibm/service/power/ibm_pi_constants.go | 1 + .../resource_ibm_pi_shared_processor_pool.go | 6 ++++++ .../docs/d/pi_shared_processor_pool.html.markdown | 15 +++++++++++---- .../d/pi_shared_processor_pools.html.markdown | 9 ++++++++- .../docs/r/pi_shared_processor_pool.html.markdown | 1 + 7 files changed, 39 insertions(+), 5 deletions(-) diff --git a/ibm/service/power/data_source_ibm_pi_shared_processor_pool.go b/ibm/service/power/data_source_ibm_pi_shared_processor_pool.go index dc22966c847..6292495d0b9 100644 --- a/ibm/service/power/data_source_ibm_pi_shared_processor_pool.go +++ b/ibm/service/power/data_source_ibm_pi_shared_processor_pool.go @@ -49,6 +49,11 @@ func DataSourceIBMPISharedProcessorPool() *schema.Resource { Description: "The CRN of this resource.", Type: schema.TypeString, }, + Attr_DedicatedHostID: { + Computed: true, + Description: "The dedicated host ID where the shared processor pool resides.", + Type: schema.TypeString, + }, Attr_HostID: { Computed: true, Description: "The host ID where the shared processor pool resides.", @@ -171,6 +176,7 @@ func dataSourceIBMPISharedProcessorPoolRead(ctx context.Context, d *schema.Resou d.Set(Attr_UserTags, tags) } } + d.Set(Attr_DedicatedHostID, response.SharedProcessorPool.DedicatedHostID) d.Set(Attr_HostID, response.SharedProcessorPool.HostID) d.Set(Attr_Name, response.SharedProcessorPool.Name) d.Set(Attr_ReservedCores, response.SharedProcessorPool.ReservedCores) diff --git a/ibm/service/power/data_source_ibm_pi_shared_processor_pools.go b/ibm/service/power/data_source_ibm_pi_shared_processor_pools.go index 021b095d30e..f9db66b7f89 100644 --- a/ibm/service/power/data_source_ibm_pi_shared_processor_pools.go +++ b/ibm/service/power/data_source_ibm_pi_shared_processor_pools.go @@ -49,6 +49,11 @@ func DataSourceIBMPISharedProcessorPools() *schema.Resource { Description: "The CRN of this resource.", Type: schema.TypeString, }, + Attr_DedicatedHostID: { + Computed: true, + Description: "The dedicated host ID where the shared processor pool resides.", + Type: schema.TypeString, + }, Attr_HostID: { Computed: true, Description: "The host ID where the shared processor pool resides.", @@ -113,6 +118,7 @@ func dataSourceIBMPISharedProcessorPoolsRead(ctx context.Context, d *schema.Reso key := map[string]interface{}{ Attr_AllocatedCores: *pool.AllocatedCores, Attr_AvailableCores: *pool.AvailableCores, + Attr_DedicatedHostID: pool.DedicatedHostID, Attr_HostID: pool.HostID, Attr_Name: *pool.Name, Attr_ReservedCores: *pool.ReservedCores, diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index 4c25f93b96c..14bf8b0fb98 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -220,6 +220,7 @@ const ( Attr_DatacenterStatus = "pi_datacenter_status" Attr_DatacenterType = "pi_datacenter_type" Attr_Dedicated = "dedicated" + Attr_DedicatedHostID = "dedicated_host_id" Attr_Default = "default" Attr_DeleteOnTermination = "delete_on_termination" Attr_DeploymentType = "deployment_type" diff --git a/ibm/service/power/resource_ibm_pi_shared_processor_pool.go b/ibm/service/power/resource_ibm_pi_shared_processor_pool.go index babdbe57a15..c2fd50dbfba 100644 --- a/ibm/service/power/resource_ibm_pi_shared_processor_pool.go +++ b/ibm/service/power/resource_ibm_pi_shared_processor_pool.go @@ -108,6 +108,11 @@ func ResourceIBMPISharedProcessorPool() *schema.Resource { Description: "The CRN of this resource.", Type: schema.TypeString, }, + Attr_DedicatedHostID: { + Computed: true, + Description: "The dedicated host ID where the shared processor pool resides.", + Type: schema.TypeString, + }, Attr_HostID: { Computed: true, Description: "The host ID where the shared processor pool resides.", @@ -333,6 +338,7 @@ func resourceIBMPISharedProcessorPoolRead(ctx context.Context, d *schema.Resourc d.Set(Arg_SharedProcessorPoolPlacementGroups, pgIDs) } } + d.Set(Attr_DedicatedHostID, response.SharedProcessorPool.DedicatedHostID) d.Set(Attr_HostID, response.SharedProcessorPool.HostID) d.Set(Attr_Status, response.SharedProcessorPool.Status) d.Set(Attr_StatusDetail, response.SharedProcessorPool.StatusDetail) diff --git a/website/docs/d/pi_shared_processor_pool.html.markdown b/website/docs/d/pi_shared_processor_pool.html.markdown index f40e6ef8c32..2e6977b1920 100644 --- a/website/docs/d/pi_shared_processor_pool.html.markdown +++ b/website/docs/d/pi_shared_processor_pool.html.markdown @@ -7,9 +7,11 @@ description: |- --- # ibm_pi_shared_processor_pool + Retrieve information about a shared processor pool. For more information, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). ## Example Usage + ```terraform data "ibm_pi_shared_processor_pool" "ds_pool" { pi_shared_processor_pool_id = "my-spp" @@ -17,32 +19,37 @@ data "ibm_pi_shared_processor_pool" "ds_pool" { } ``` -**Notes** +### Notes + - Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. - If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: - `region` - `lon` - `zone` - `lon04` Example usage: + ```terraform provider "ibm" { region = "lon" zone = "lon04" } - ``` + ``` ## Argument reference -Review the argument references that you can specify for your data source. + +Review the argument references that you can specify for your data source. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. - `pi_shared_processor_pool_id` - (Required, String) The ID of the shared processor pool. ## Attribute reference -In addition to all argument reference list, you can access the following attribute references after your data source is created. + +In addition to all argument reference list, you can access the following attribute references after your data source is created. - `allocated_cores` - (Float) The allocated cores in the shared processor pool. - `available_cores` - (Integer) The available cores in the shared processor pool. - `crn` - (String) The CRN of this resource. +- `dedicated_host_id` - (String) The dedicated host ID where the shared processor pool resides. - `host_id` - (Integer) The host ID where the shared processor pool resides. - `id` - (String) The shared processor pool's unique ID. - `instances` - (List) List of server instances deployed in the shared processor pool. diff --git a/website/docs/d/pi_shared_processor_pools.html.markdown b/website/docs/d/pi_shared_processor_pools.html.markdown index 5402ae6b4e8..1204aeadf28 100644 --- a/website/docs/d/pi_shared_processor_pools.html.markdown +++ b/website/docs/d/pi_shared_processor_pools.html.markdown @@ -7,22 +7,26 @@ description: |- --- # ibm_pi_shared_processor_pools + Retrieve information about all shared processor pools. For more information, see [getting started with IBM Power Systems Virtual Servers](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started). ## Example usage + ```terraform data "ibm_pi_shared_processor_pools" "example" { pi_cloud_instance_id = "" } ``` -**Notes** +### Notes + - Please find [supported Regions](https://cloud.ibm.com/apidocs/power-cloud#endpoint) for endpoints. - If a Power cloud instance is provisioned at `lon04`, The provider level attributes should be as follows: - `region` - `lon` - `zone` - `lon04` Example usage: + ```terraform provider "ibm" { region = "lon" @@ -31,11 +35,13 @@ Example usage: ``` ## Argument reference + Review the argument references that you can specify for your data source. - `pi_cloud_instance_id` - (Required, String) The GUID of the service instance associated with an account. ## Attribute reference + In addition to all argument reference list, you can access the following attribute references after your data source is created. - `shared_processor_pools` - (List) List of all the shared processor pools. @@ -44,6 +50,7 @@ In addition to all argument reference list, you can access the following attribu - `allocated_cores` - (Float) The allocated cores in the shared processor pool. - `available_cores` - (Integer) The available cores in the shared processor pool. - `crn` - (String) The CRN of this resource. + - `dedicated_host_id` - (String) The dedicated host ID where the shared processor pool resides. - `host_id` - (Integer) The host ID where the shared processor pool resides. - `name` - (String) The name of the shared processor pool. - `reserved_cores` - (Integer) The amount of reserved cores for the shared processor pool. diff --git a/website/docs/r/pi_shared_processor_pool.html.markdown b/website/docs/r/pi_shared_processor_pool.html.markdown index 24250d17a7d..1daa17c9f6b 100644 --- a/website/docs/r/pi_shared_processor_pool.html.markdown +++ b/website/docs/r/pi_shared_processor_pool.html.markdown @@ -67,6 +67,7 @@ In addition to all argument reference list, you can access the following attribu - `allocated_cores` - (Float) The allocated cores in the shared processor pool. - `available_cores` - (Integer) The available cores in the shared processor pool. - `crn` - (String) The CRN of this resource. +- `dedicated_host_id` - (String) The dedicated host ID where the shared processor pool resides. - `host_id` - (Integer) The host ID where the shared processor pool resides. - `instances` - (List of Map) The list of server instances that are deployed in the shared processor pool.