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

[Datasource][Resource] Add dedicated host id attribute to shared processor pool #191

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.4
require (
github.com/IBM-Cloud/bluemix-go v0.0.0-20241117121028-a3be206688b3
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113
github.com/IBM-Cloud/power-go-client v1.9.0
github.com/IBM-Cloud/power-go-client v1.10.0
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca
github.com/IBM/appconfiguration-go-admin-sdk v0.4.4
github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20241117121028-a3be206688b3/go.mod h1:/7h
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 h1:f2Erqfea1dKpaTFagTJM6W/wnD3JGq/Vn9URh8nuRwk=
github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=
github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs=
github.com/IBM-Cloud/power-go-client v1.9.0 h1:nnErpb/7TJQe8P7OfIlJPhSJVq5oyuCJlMje9Ry6XEY=
github.com/IBM-Cloud/power-go-client v1.9.0/go.mod h1:UDyXeIKEp6r7yWUXYu3r0ZnFSlNZ2YeQTHwM2Tmlgv0=
github.com/IBM-Cloud/power-go-client v1.10.0 h1:yBUHWwvNBmLkWpbZJQJEXoxBa1Dm+eJgMSbk9ljmXUU=
github.com/IBM-Cloud/power-go-client v1.10.0/go.mod h1:UDyXeIKEp6r7yWUXYu3r0ZnFSlNZ2YeQTHwM2Tmlgv0=
github.com/IBM-Cloud/softlayer-go v1.0.5-tf h1:koUAyF9b6X78lLLruGYPSOmrfY2YcGYKOj/Ug9nbKNw=
github.com/IBM-Cloud/softlayer-go v1.0.5-tf/go.mod h1:6HepcfAXROz0Rf63krk5hPZyHT6qyx2MNvYyHof7ik4=
github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca h1:crniVcf+YcmgF03NmmfonXwSQ73oJF+IohFYBwknMxs=
Expand Down
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 @@ -216,6 +216,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
2 changes: 1 addition & 1 deletion ibm/service/power/resource_ibm_pi_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ func createPVMInstance(d *schema.ResourceData, client *instance.IBMPIInstanceCli
SysType: systype,
ImageID: flex.PtrToString(imageid),
ProcType: flex.PtrToString(processortype),
Replicants: replicants,
Replicants: &replicants,
UserData: encodeBase64(userData),
ReplicantNamingScheme: flex.PtrToString(replicationNamingScheme),
ReplicantAffinityPolicy: flex.PtrToString(replicationpolicy),
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
Loading