diff --git a/ibm/service/power/data_source_ibm_pi_instance_console_languages.go b/ibm/service/power/data_source_ibm_pi_instance_console_languages.go index e5cb5b344df..d34dad28fb7 100644 --- a/ibm/service/power/data_source_ibm_pi_instance_console_languages.go +++ b/ibm/service/power/data_source_ibm_pi_instance_console_languages.go @@ -6,59 +6,52 @@ package power import ( "context" - "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) -const ( - ConsoleLanguages = "console_languages" - ConsoleLanguageCode = "code" - ConsoleLanguageDesc = "language" -) - -/* -Datasource to get the list of available console languages for an instance -*/ +// Datasource to list available console languages for an instance func DataSourceIBMPIInstanceConsoleLanguages() *schema.Resource { return &schema.Resource{ ReadContext: dataSourceIBMPIInstanceConsoleLanguagesRead, Schema: map[string]*schema.Schema{ - helpers.PICloudInstanceId: { - Type: schema.TypeString, + // Arguments + Arg_CloudInstanceID: { + Description: "The GUID of the service instance associated with an account.", Required: true, + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - helpers.PIInstanceName: { - Type: schema.TypeString, + Arg_InstanceName: { + Description: "The unique identifier or name of the instance.", Required: true, - Description: "The unique identifier or name of the instance", + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - // Computed Attributes - ConsoleLanguages: { - Type: schema.TypeList, - Computed: true, + // Attributes + Attr_ConsoleLanguages: { + Computed: true, + Description: "List of all the Console Languages.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - ConsoleLanguageCode: { - Type: schema.TypeString, + Attr_Code: { Computed: true, - Description: "language code", - }, - ConsoleLanguageDesc: { + Description: "Language code.", Type: schema.TypeString, + }, + Attr_Language: { Computed: true, - Description: "language description", + Description: "Language description.", + Type: schema.TypeString, }, }, }, + Type: schema.TypeList, }, }, } @@ -70,8 +63,8 @@ func dataSourceIBMPIInstanceConsoleLanguagesRead(ctx context.Context, d *schema. return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) - instanceName := d.Get(helpers.PIInstanceName).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) + instanceName := d.Get(Arg_InstanceName).(string) client := instance.NewIBMPIInstanceClient(ctx, sess, cloudInstanceID) languages, err := client.GetConsoleLanguages(instanceName) @@ -86,12 +79,12 @@ func dataSourceIBMPIInstanceConsoleLanguagesRead(ctx context.Context, d *schema. result := make([]map[string]interface{}, 0, len(languages.ConsoleLanguages)) for _, language := range languages.ConsoleLanguages { l := map[string]interface{}{ - ConsoleLanguageCode: *language.Code, - ConsoleLanguageDesc: language.Language, + Attr_Code: *language.Code, + Attr_Language: language.Language, } result = append(result, l) } - d.Set(ConsoleLanguages, result) + d.Set(Attr_ConsoleLanguages, result) } return nil diff --git a/ibm/service/power/data_source_ibm_pi_instance_console_languages_test.go b/ibm/service/power/data_source_ibm_pi_instance_console_languages_test.go index acadb056e02..9d52aa963ff 100644 --- a/ibm/service/power/data_source_ibm_pi_instance_console_languages_test.go +++ b/ibm/service/power/data_source_ibm_pi_instance_console_languages_test.go @@ -30,8 +30,8 @@ func TestAccIBMPIInstanceConsoleLanguages(t *testing.T) { func testAccCheckIBMPIInstanceConsoleLanguagesConfig() string { return fmt.Sprintf(` - data "ibm_pi_console_languages" "example" { - pi_cloud_instance_id = "%s" - pi_instance_name = "%s" - }`, acc.Pi_cloud_instance_id, acc.Pi_instance_name) + data "ibm_pi_console_languages" "example" { + pi_cloud_instance_id = "%s" + pi_instance_name = "%s" + }`, acc.Pi_cloud_instance_id, acc.Pi_instance_name) } diff --git a/ibm/service/power/data_source_ibm_pi_instance_ip.go b/ibm/service/power/data_source_ibm_pi_instance_ip.go index 4d57021d367..60cac39d423 100644 --- a/ibm/service/power/data_source_ibm_pi_instance_ip.go +++ b/ibm/service/power/data_source_ibm_pi_instance_ip.go @@ -10,7 +10,6 @@ import ( "strconv" "github.com/IBM-Cloud/power-go-client/clients/instance" - "github.com/IBM-Cloud/power-go-client/helpers" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -18,51 +17,59 @@ import ( ) func DataSourceIBMPIInstanceIP() *schema.Resource { - return &schema.Resource{ ReadContext: dataSourceIBMPIInstancesIPRead, Schema: map[string]*schema.Schema{ - helpers.PIInstanceName: { - Type: schema.TypeString, + // Arguments + Arg_CloudInstanceID: { + Description: "The GUID of the service instance associated with an account.", Required: true, - Description: "Server Name to be used for pvminstances", + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - helpers.PICloudInstanceId: { - Type: schema.TypeString, + Arg_InstanceName: { + Description: "The unique identifier or name of the instance.", Required: true, + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - helpers.PINetworkName: { + Arg_NetworkName: { + Description: "The subnet that the instance belongs to.", Type: schema.TypeString, Required: true, ValidateFunc: validation.NoZeroValues, }, - // Computed attributes - "ip": { - Type: schema.TypeString, - Computed: true, + // Attributes + Attr_ExternalIP: { + Computed: true, + Description: "The external IP of the network that is attached to this instance.", + Type: schema.TypeString, }, - "ipoctet": { - Type: schema.TypeString, - Computed: true, + Attr_IP: { + Computed: true, + Description: "The IP address that is attached to this instance from the subnet.", + Type: schema.TypeString, }, - "macaddress": { - Type: schema.TypeString, - Computed: true, + Attr_IPOctet: { + Computed: true, + Description: "The IP octet of the network that is attached to this instance.", + Type: schema.TypeString, }, - "network_id": { - Type: schema.TypeString, - Computed: true, + Attr_MacAddress: { + Computed: true, + Description: "The MAC address of the network that is attached to this instance.", + Type: schema.TypeString, }, - "type": { - Type: schema.TypeString, - Computed: true, + Attr_NetworkID: { + Computed: true, + Description: "ID of the network.", + Type: schema.TypeString, }, - "external_ip": { - Type: schema.TypeString, - Computed: true, + Attr_Type: { + Computed: true, + Description: "The type of the network that is attached to this instance.", + Type: schema.TypeString, }, }, } @@ -74,11 +81,11 @@ func dataSourceIBMPIInstancesIPRead(ctx context.Context, d *schema.ResourceData, return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) - networkName := d.Get(helpers.PINetworkName).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) + networkName := d.Get(Arg_NetworkName).(string) powerC := instance.NewIBMPIInstanceClient(ctx, sess, cloudInstanceID) - powervmdata, err := powerC.Get(d.Get(helpers.PIInstanceName).(string)) + powervmdata, err := powerC.Get(d.Get(Arg_InstanceName).(string)) if err != nil { return diag.FromErr(err) } @@ -87,17 +94,16 @@ func dataSourceIBMPIInstancesIPRead(ctx context.Context, d *schema.ResourceData, if network.NetworkName == networkName { log.Printf("Printing the ip %s", network.IPAddress) d.SetId(network.NetworkID) - d.Set("ip", network.IPAddress) - d.Set("network_id", network.NetworkID) - d.Set("macaddress", network.MacAddress) - d.Set("external_ip", network.ExternalIP) - d.Set("type", network.Type) + d.Set(Attr_ExternalIP, network.ExternalIP) + d.Set(Attr_IP, network.IPAddress) + d.Set(Attr_MacAddress, network.MacAddress) + d.Set(Attr_NetworkID, network.NetworkID) + d.Set(Attr_Type, network.Type) IPObject := net.ParseIP(network.IPAddress).To4() if len(IPObject) > 0 { - d.Set("ipoctet", strconv.Itoa(int(IPObject[3]))) + d.Set(Attr_IPOctet, strconv.Itoa(int(IPObject[3]))) } - return nil } } diff --git a/ibm/service/power/data_source_ibm_pi_instance_ip_test.go b/ibm/service/power/data_source_ibm_pi_instance_ip_test.go index 36362776a84..b8963ee6394 100644 --- a/ibm/service/power/data_source_ibm_pi_instance_ip_test.go +++ b/ibm/service/power/data_source_ibm_pi_instance_ip_test.go @@ -29,10 +29,9 @@ func TestAccIBMPIInstanceIPDataSource_basic(t *testing.T) { func testAccCheckIBMPIInstanceIPDataSourceConfig() string { return fmt.Sprintf(` - data "ibm_pi_instance_ip" "testacc_ds_instance_ip" { - pi_network_name = "%[1]s" - pi_instance_name = "%[2]s" - pi_cloud_instance_id = "%[3]s" - } - `, acc.Pi_network_name, acc.Pi_instance_name, acc.Pi_cloud_instance_id) + data "ibm_pi_instance_ip" "testacc_ds_instance_ip" { + pi_network_name = "%[1]s" + pi_instance_name = "%[2]s" + pi_cloud_instance_id = "%[3]s" + }`, acc.Pi_network_name, acc.Pi_instance_name, acc.Pi_cloud_instance_id) } diff --git a/ibm/service/power/data_source_ibm_pi_instance_volumes.go b/ibm/service/power/data_source_ibm_pi_instance_volumes.go index 611ef5cf620..0bd9b2a09e1 100644 --- a/ibm/service/power/data_source_ibm_pi_instance_volumes.go +++ b/ibm/service/power/data_source_ibm_pi_instance_volumes.go @@ -6,82 +6,92 @@ package power import ( "context" - "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/IBM-Cloud/power-go-client/power/models" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - "github.com/IBM-Cloud/power-go-client/clients/instance" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" ) func DataSourceIBMPIInstanceVolumes() *schema.Resource { - return &schema.Resource{ ReadContext: dataSourceIBMPIInstanceVolumesRead, Schema: map[string]*schema.Schema{ - helpers.PIInstanceName: { - Type: schema.TypeString, + // Arguments + Arg_CloudInstanceID: { + Description: "The GUID of the service instance associated with an account.", Required: true, - Description: "Instance Name to be used for pvminstances", + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - helpers.PICloudInstanceId: { - Type: schema.TypeString, + Arg_InstanceName: { + Description: "The unique identifier or name of the instance.", Required: true, + Type: schema.TypeString, ValidateFunc: validation.NoZeroValues, }, - //Computed Attributes - "boot_volume_id": { - Type: schema.TypeString, - Computed: true, + // Attribute + Attr_BootVolumeID: { + Computed: true, + Description: "The unique identifier of the boot volume.", + Type: schema.TypeString, }, - "instance_volumes": { - Type: schema.TypeList, - Computed: true, + Attr_InstanceVolumes: { + Computed: true, + Description: "List of volumes attached to instance.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "id": { - Type: schema.TypeString, - Computed: true, + Attr_Bootable: { + Computed: true, + Description: "Indicates if the volume is boot capable.", + Type: schema.TypeBool, }, - "size": { - Type: schema.TypeFloat, - Computed: true, + Attr_Href: { + Computed: true, + Description: "The hyper link of the volume.", + Type: schema.TypeString, }, - "href": { - Type: schema.TypeString, - Computed: true, + Attr_ID: { + Computed: true, + Description: "The unique identifier of the volume.", + Type: schema.TypeString, }, - "name": { - Type: schema.TypeString, - Computed: true, + Attr_Name: { + Computed: true, + Description: "The name of the volume.", + Type: schema.TypeString, }, - "state": { - Type: schema.TypeString, - Computed: true, + Attr_Pool: { + Computed: true, + Description: "Volume pool, name of storage pool where the volume is located.", + Type: schema.TypeString, }, - "type": { - Type: schema.TypeString, - Computed: true, + Attr_Shareable: { + Computed: true, + Description: "Indicates if the volume is shareable between VMs.", + Type: schema.TypeBool, }, - "pool": { - Type: schema.TypeString, - Computed: true, + Attr_Size: { + Computed: true, + Description: "The size of this volume in gigabytes.", + Type: schema.TypeFloat, }, - "shareable": { - Type: schema.TypeBool, - Computed: true, + Attr_State: { + Computed: true, + Description: "The state of the volume.", + Type: schema.TypeString, }, - "bootable": { - Type: schema.TypeBool, - Computed: true, + Attr_Type: { + Computed: true, + Description: "The disk type that is used for this volume.", + Type: schema.TypeString, }, }, }, + Type: schema.TypeList, }, }, } @@ -93,38 +103,36 @@ func dataSourceIBMPIInstanceVolumesRead(ctx context.Context, d *schema.ResourceD return diag.FromErr(err) } - cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) + cloudInstanceID := d.Get(Arg_CloudInstanceID).(string) volumeC := instance.NewIBMPIVolumeClient(ctx, sess, cloudInstanceID) - volumedata, err := volumeC.GetAllInstanceVolumes(d.Get(helpers.PIInstanceName).(string)) + volumedata, err := volumeC.GetAllInstanceVolumes(d.Get(Arg_InstanceName).(string)) if err != nil { return diag.FromErr(err) } var clientgenU, _ = uuid.GenerateUUID() d.SetId(clientgenU) - d.Set("boot_volume_id", *volumedata.Volumes[0].VolumeID) - d.Set("instance_volumes", flattenVolumesInstances(volumedata.Volumes)) + d.Set(Attr_BootVolumeID, *volumedata.Volumes[0].VolumeID) + d.Set(Attr_InstanceVolumes, flattenVolumesInstances(volumedata.Volumes)) return nil - } func flattenVolumesInstances(list []*models.VolumeReference) []map[string]interface{} { result := make([]map[string]interface{}, 0, len(list)) for _, i := range list { l := map[string]interface{}{ - "id": *i.VolumeID, - "state": *i.State, - "href": *i.Href, - "name": *i.Name, - "size": *i.Size, - "type": *i.DiskType, - "pool": i.VolumePool, - "shareable": *i.Shareable, - "bootable": *i.Bootable, + Attr_Bootable: *i.Bootable, + Attr_Href: *i.Href, + Attr_ID: *i.VolumeID, + Attr_Name: *i.Name, + Attr_Pool: i.VolumePool, + Attr_Shareable: *i.Shareable, + Attr_Size: *i.Size, + Attr_State: *i.State, + Attr_Type: *i.DiskType, } - result = append(result, l) } return result diff --git a/ibm/service/power/data_source_ibm_pi_instance_volumes_test.go b/ibm/service/power/data_source_ibm_pi_instance_volumes_test.go index 211c17b9e77..10543c5a66e 100644 --- a/ibm/service/power/data_source_ibm_pi_instance_volumes_test.go +++ b/ibm/service/power/data_source_ibm_pi_instance_volumes_test.go @@ -31,9 +31,8 @@ func TestAccIBMPIVolumesDataSource_basic(t *testing.T) { func testAccCheckIBMPIVolumesDataSourceConfig(name string) string { return fmt.Sprintf(` -data "ibm_pi_instance_volumes" "testacc_ds_volumes" { - pi_instance_name = "%s" - pi_cloud_instance_id = "%s" -}`, acc.Pi_instance_name, acc.Pi_cloud_instance_id) - + data "ibm_pi_instance_volumes" "testacc_ds_volumes" { + pi_instance_name = "%s" + pi_cloud_instance_id = "%s" + }`, acc.Pi_instance_name, acc.Pi_cloud_instance_id) } diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index db553ec77de..445d1935718 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -278,9 +278,10 @@ const ( Attr_DhcpStatus = "status" // Instance - Arg_PVMInstanceId = "pi_instance_id" - Arg_PVMInstanceActionType = "pi_action" - Arg_PVMInstanceHealthStatus = "pi_health_status" + Arg_PVMInstanceId = "pi_instance_id" + Arg_PVMInstanceActionType = "pi_action" + Arg_PVMInstanceHealthStatus = "pi_health_status" + Arg_PIInstanceSharedProcessorPool = "pi_shared_processor_pool" PVMInstanceHealthOk = "OK" PVMInstanceHealthWarning = "WARNING" @@ -291,6 +292,7 @@ const ( // power service instance capabilities CUSTOM_VIRTUAL_CORES = "custom-virtualcores" + PIConsoleLanguageCode = "pi_language_code" PICloudConnectionId = "cloud_connection_id" PICloudConnectionStatus = "status" PICloudConnectionIBMIPAddress = "ibm_ip_address" @@ -315,7 +317,6 @@ const ( Attr_PIInstanceSharedProcessorPool = "shared_processor_pool" Attr_PIInstanceSharedProcessorPoolID = "shared_processor_pool_id" - Arg_PIInstanceSharedProcessorPool = "pi_shared_processor_pool" // Placement Group PIPlacementGroupID = "placement_group_id" diff --git a/ibm/service/power/resource_ibm_pi_instance_console_language.go b/ibm/service/power/resource_ibm_pi_instance_console_language.go index a825760d04e..4f065a0a364 100644 --- a/ibm/service/power/resource_ibm_pi_instance_console_language.go +++ b/ibm/service/power/resource_ibm_pi_instance_console_language.go @@ -18,10 +18,6 @@ import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" ) -const ( - PIConsoleLanguageCode = "pi_language_code" -) - func ResourceIBMPIInstanceConsoleLanguage() *schema.Resource { return &schema.Resource{ CreateContext: resourceIBMPIInstanceConsoleLanguageCreate, @@ -93,7 +89,7 @@ func resourceIBMPIInstanceConsoleLanguageUpdate(ctx context.Context, d *schema.R return diag.FromErr(err) } - if d.HasChange(ConsoleLanguageCode) { + if d.HasChange(PIConsoleLanguageCode) { cloudInstanceID := d.Get(helpers.PICloudInstanceId).(string) instanceName := d.Get(helpers.PIInstanceName).(string) code := d.Get(PIConsoleLanguageCode).(string) diff --git a/website/docs/d/pi_console_languages.html.markdown b/website/docs/d/pi_console_languages.html.markdown index d5f7f36afd3..e679fedd62f 100644 --- a/website/docs/d/pi_console_languages.html.markdown +++ b/website/docs/d/pi_console_languages.html.markdown @@ -1,5 +1,4 @@ --- - subcategory: "Power Systems" layout: "ibm" page_title: "IBM: pi_console_languages" @@ -8,11 +7,9 @@ description: |- --- # ibm_pi_console_languages - Retrieve information about all the available Console Languages for an Instance. 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_console_languages" "example" { pi_cloud_instance_id = "" @@ -21,14 +18,12 @@ data "ibm_pi_console_languages" "example" { ``` **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` +- 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" @@ -37,14 +32,12 @@ 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. - `pi_instance_name` - (Required, String) The unique identifier or name of the instance. ## Attribute reference - In addition to all argument reference list, you can access the following attribute references after your data source is created. - `console_languages` - (List) List of all the Console Languages. diff --git a/website/docs/d/pi_instance_ip.html.markdown b/website/docs/d/pi_instance_ip.html.markdown index 541891d09c1..8f1942cc834 100644 --- a/website/docs/d/pi_instance_ip.html.markdown +++ b/website/docs/d/pi_instance_ip.html.markdown @@ -1,5 +1,4 @@ --- - subcategory: "Power Systems" layout: "ibm" page_title: "IBM: pi_instance_ip" @@ -11,7 +10,6 @@ description: |- Retrieve information about a Power Systems Virtual Server instance IP address. For more information, about Power Systems Virtual Server instance IP address, see [configuring and adding a private network subnet](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-configuring-subnet). ## Example usage - ```terraform data "ibm_pi_instance_ip" "ds_instance_ip" { pi_instance_name = "terraform-test-instance" @@ -19,12 +17,14 @@ data "ibm_pi_instance_ip" "ds_instance_ip" { pi_cloud_instance_id = "49fba6c9-23f8-40bc-9899-aca322ee7d5b" } ``` + **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: +- 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" @@ -36,7 +36,7 @@ data "ibm_pi_instance_ip" "ds_instance_ip" { 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_instance_name` - (Required, String) The name of the instance. +- `pi_instance_name` - (Required, String) The unique identifier or name of the instance. - `pi_network_name` - (Required, String) The subnet that the instance belongs to. diff --git a/website/docs/d/pi_instance_volumes.html.markdown b/website/docs/d/pi_instance_volumes.html.markdown index 1fc2583b2b9..6c175305389 100644 --- a/website/docs/d/pi_instance_volumes.html.markdown +++ b/website/docs/d/pi_instance_volumes.html.markdown @@ -1,5 +1,4 @@ --- - subcategory: "Power Systems" layout: "ibm" page_title: "IBM: pi_instance_volumes" @@ -8,26 +7,25 @@ description: |- --- # ibm_pi_instance_volumes -Retrieves information about a persistent storage volume that is mounted to a Power Systems Virtual Server instance. For more information, about power instance volume, see [snapshotting, cloning, and restoring](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-volume-snapshot-clone). +Retrieves information about the persistent storage volumes that are mounted to a Power Systems Virtual Server instance. For more information, about power instance volume, see [snapshotting, cloning, and restoring](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-volume-snapshot-clone). ## Example usage -The following example retrieves information about the `volume_1` volume that is mounted to the Power Systems Virtual Server instance with the ID. +The following example retrieves information about the volumes attached to the `terraform-test-instance` instance. ```terraform data "ibm_pi_instance_volumes" "ds_volumes" { - pi_instance_name = "volume_1" + pi_instance_name = "terraform-test-instance" pi_cloud_instance_id = "49fba6c9-23f8-40bc-9899-aca322ee7d5b" } ``` **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: +- 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" @@ -39,21 +37,21 @@ data "ibm_pi_instance_volumes" "ds_volumes" { 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_volume_name` - (Required, String) The name of the volume for which you want to retrieve detailed information. +- `pi_instance_name` - (Required, String) The unique identifier or name of the instance. ## Attribute reference In addition to all argument reference list, you can access the following attribute references after your data source is created. - `boot_volume_id` - (String) The unique identifier of the boot volume. -- `instance_volumes` - List of volumes - List of volumes attached to instance. +- `instance_volumes` - (List) List of volumes attached to instance. Nested scheme for `instance_volumes`: - - `bootable`- (Bool) Indicates if the volume is boot capable. + - `bootable`- (Boolean) Indicates if the volume is boot capable. - `href` - (String) The hyper link of the volume. - `id` - (String) The unique identifier of the volume. - `name` - (String) The name of the volume. - `pool` - (String) Volume pool, name of storage pool where the volume is located. - - `shareable` - (Bool) Indicates if the volume is shareable between VMs. + - `shareable` - (Boolean) Indicates if the volume is shareable between VMs. - `size` - (Integer) The size of this volume in gigabytes. - `state` - (String) The state of the volume. - `type` - (String) The disk type that is used for this volume.