Skip to content

Commit

Permalink
[Datasource][Resource] Add dedicated host id attribute to shared proc…
Browse files Browse the repository at this point in the history
…essor poo (#5992)

* Update dependencies

* Add dedicated host id attribute to shared processor pool resource and data source

* Update documentation
  • Loading branch information
ismirlia authored Feb 18, 2025
1 parent b941f32 commit f434f27
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 5 deletions.
6 changes: 6 additions & 0 deletions ibm/service/power/data_source_ibm_pi_shared_processor_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions ibm/service/power/ibm_pi_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions ibm/service/power/resource_ibm_pi_shared_processor_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 11 additions & 4 deletions website/docs/d/pi_shared_processor_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,49 @@ 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"
pi_cloud_instance_id = "49fba6c9-23f8-40bc-9899-aca322ee7d5b"
}
```

**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.
Expand Down
9 changes: 8 additions & 1 deletion website/docs/d/pi_shared_processor_pools.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<value of the 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"
Expand All @@ -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.
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/pi_shared_processor_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit f434f27

Please sign in to comment.