diff --git a/go.mod b/go.mod index 9331c5dfe6..a784b178ad 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.22.5 require ( github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20240725064144-454a2ae23113 - github.com/IBM-Cloud/power-go-client v1.7.0 + github.com/IBM-Cloud/power-go-client v1.8.1 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca github.com/IBM/appconfiguration-go-admin-sdk v0.3.0 github.com/IBM/appid-management-go-sdk v0.0.0-20210908164609-dd0e0eaf732f diff --git a/go.sum b/go.sum index 5db19a9fe9..6e1a9cdfea 100644 --- a/go.sum +++ b/go.sum @@ -118,8 +118,8 @@ github.com/IBM-Cloud/bluemix-go v0.0.0-20240719075425-078fcb3a55be/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.7.0 h1:/GuGwPMTKoCZACfnwt7b6wKr4v32q1VO1AMFGNETRN4= -github.com/IBM-Cloud/power-go-client v1.7.0/go.mod h1:9izycYAmNQ+NAdVPXDC3fHYxqWLjlR2YiwqKYveMv5Y= +github.com/IBM-Cloud/power-go-client v1.8.1 h1:tx1aPJmIQrNru1MD1VHGNasGx3eRIs0zzPZ0KvdFQrg= +github.com/IBM-Cloud/power-go-client v1.8.1/go.mod h1:N4RxrsMUvBQjSQ/qPk0iMZ8zK+fZPRTnHi/gTaASw0g= 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= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 7fdb4aefea..6ab8596933 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -224,6 +224,7 @@ var ( Pi_shared_processor_pool_id string Pi_snapshot_id string Pi_spp_placement_group_id string + Pi_storage_connection string Pi_target_storage_tier string Pi_volume_clone_task_id string Pi_volume_group_id string @@ -1190,7 +1191,10 @@ func init() { Pi_shared_processor_pool_id = "tf-pi-shared-processor-pool" fmt.Println("[WARN] Set the environment variable PI_SHARED_PROCESSOR_POOL_ID for testing ibm_pi_shared_processor_pool resource else it is set to default value 'tf-pi-shared-processor-pool'") } - + Pi_storage_connection = os.Getenv("PI_STORAGE_CONNECTION") + if Pi_storage_connection == "" { + fmt.Println("[WARN] Set the environment variable PI_STORAGE_CONNECTION for testing pi_storage_connection resource else it is empty") + } Pi_target_storage_tier = os.Getenv("PI_TARGET_STORAGE_TIER") if Pi_target_storage_tier == "" { Pi_target_storage_tier = "terraform-test-tier" diff --git a/ibm/service/power/data_source_ibm_pi_instance.go b/ibm/service/power/data_source_ibm_pi_instance.go index c8ac038a9c..10f9a81a18 100644 --- a/ibm/service/power/data_source_ibm_pi_instance.go +++ b/ibm/service/power/data_source_ibm_pi_instance.go @@ -193,6 +193,11 @@ func DataSourceIBMPIInstance() *schema.Resource { Description: "The status of the instance.", Type: schema.TypeString, }, + Attr_StorageConnection: { + Computed: true, + Description: "The storage connection type.", + Type: schema.TypeString, + }, Attr_StoragePool: { Computed: true, Description: "The storage Pool where server is deployed.", @@ -256,6 +261,7 @@ func dataSourceIBMPIInstancesRead(ctx context.Context, d *schema.ResourceData, m d.Set(Attr_SharedProcessorPool, powervmdata.SharedProcessorPool) d.Set(Attr_SharedProcessorPoolID, powervmdata.SharedProcessorPoolID) d.Set(Attr_Status, powervmdata.Status) + d.Set(Attr_StorageConnection, powervmdata.StorageConnection) d.Set(Attr_StorageType, powervmdata.StorageType) d.Set(Attr_StoragePool, powervmdata.StoragePool) d.Set(Attr_StoragePoolAffinity, powervmdata.StoragePoolAffinity) diff --git a/ibm/service/power/data_source_ibm_pi_instances.go b/ibm/service/power/data_source_ibm_pi_instances.go index 481e4e8ba0..4936f82ce9 100644 --- a/ibm/service/power/data_source_ibm_pi_instances.go +++ b/ibm/service/power/data_source_ibm_pi_instances.go @@ -174,6 +174,11 @@ func DataSourceIBMPIInstances() *schema.Resource { Description: "The status of the instance.", Type: schema.TypeString, }, + Attr_StorageConnection: { + Computed: true, + Description: "The storage connection type.", + Type: schema.TypeString, + }, Attr_StoragePool: { Computed: true, Description: "The storage Pool where server is deployed.", @@ -247,6 +252,7 @@ func flattenPvmInstances(list []*models.PVMInstanceReference) []map[string]inter Attr_SharedProcessorPool: i.SharedProcessorPool, Attr_SharedProcessorPoolID: i.SharedProcessorPoolID, Attr_Status: *i.Status, + Attr_StorageConnection: i.StorageConnection, Attr_StoragePool: i.StoragePool, Attr_StoragePoolAffinity: i.StoragePoolAffinity, Attr_StorageType: i.StorageType, diff --git a/ibm/service/power/ibm_pi_constants.go b/ibm/service/power/ibm_pi_constants.go index 6f3fff8509..f7a8cf7883 100644 --- a/ibm/service/power/ibm_pi_constants.go +++ b/ibm/service/power/ibm_pi_constants.go @@ -35,6 +35,7 @@ const ( Arg_ImageID = "pi_image_id" Arg_ImageImportDetails = "pi_image_import_details" Arg_ImageName = "pi_image_name" + Arg_ImportDetails = "pi_image_import_details" Arg_InstanceID = "pi_instance_id" Arg_InstanceName = "pi_instance_name" Arg_Key = "pi_ssh_key" @@ -339,6 +340,7 @@ const ( Attr_Status = "status" Attr_StatusDescriptionErrors = "status_description_errors" Attr_StatusDetail = "status_detail" + Attr_StorageConnection = "storage_connection" Attr_StoragePool = "storage_pool" Attr_StoragePoolAffinity = "storage_pool_affinity" Attr_StoragePoolsCapacity = "storage_pools_capacity" @@ -431,6 +433,7 @@ const ( Hard = "hard" Host = "host" HostGroup = "hostGroup" + MaxVolumeSupport = "maxVolumeSupport" Netweaver = "Netweaver" None = "none" OK = "OK" diff --git a/ibm/service/power/resource_ibm_pi_instance.go b/ibm/service/power/resource_ibm_pi_instance.go index 111ab08889..c0d3b2776b 100644 --- a/ibm/service/power/resource_ibm_pi_instance.go +++ b/ibm/service/power/resource_ibm_pi_instance.go @@ -285,7 +285,7 @@ func ResourceIBMPIInstance() *schema.Resource { Description: "Storage Connectivity Group for server deployment", Optional: true, Type: schema.TypeString, - ValidateFunc: validate.ValidateAllowedStringValues([]string{vSCSI}), + ValidateFunc: validate.ValidateAllowedStringValues([]string{vSCSI, MaxVolumeSupport}), }, Arg_SysType: { Computed: true, diff --git a/ibm/service/power/resource_ibm_pi_instance_test.go b/ibm/service/power/resource_ibm_pi_instance_test.go index 9a0edc79f3..d9d5e3f240 100644 --- a/ibm/service/power/resource_ibm_pi_instance_test.go +++ b/ibm/service/power/resource_ibm_pi_instance_test.go @@ -96,7 +96,6 @@ func testAccCheckIBMPIInstanceDeploymentTypeConfig(name, instanceHealthStatus, e pi_network { network_id = data.ibm_pi_network.power_networks.id } - } `, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus, epic, systype, acc.PiStorageType) } @@ -133,7 +132,6 @@ func testAccCheckIBMPIInstanceIBMiLicense(name, instanceHealthStatus string, IBM pi_network { network_id = data.ibm_pi_network.power_networks.id } - }`, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, instanceHealthStatus, IBMiCSS, IBMiRDSUsers) } @@ -255,7 +253,31 @@ func testAccCheckIBMPIInstanceDeplomentTargetConfig(name string) string { } `, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name) } - +func testAccCheckIBMPIInstanceStorageConnectionConfig(name, instanceHealthStatus string) string { + return fmt.Sprintf(` + resource "ibm_pi_volume" "power_volume" { + pi_cloud_instance_id = "%[1]s" + pi_volume_size = 1 + pi_volume_name = "%[2]s" + pi_volume_type = "tier3" + } + resource "ibm_pi_instance" "power_instance" { + pi_cloud_instance_id = "%[1]s" + pi_memory = "2" + pi_processors = "1" + pi_instance_name = "%[2]s" + pi_proc_type = "shared" + pi_image_id = "%[3]s" + pi_sys_type = "s922" + pi_network { + network_id = "%[4]s" + } + pi_storage_connection = "%[5]s" + pi_health_status = "%[6]s" + pi_volume_ids = [ibm_pi_volume.power_volume.volume_id] + } + `, acc.Pi_cloud_instance_id, name, acc.Pi_image, acc.Pi_network_name, acc.Pi_storage_connection, instanceHealthStatus) +} func testAccCheckIBMPIInstanceDestroy(s *terraform.State) error { sess, err := acc.TestAccProvider.Meta().(conns.ClientSession).IBMPISession() if err != nil { @@ -336,6 +358,25 @@ func TestAccIBMPIInstanceBasic(t *testing.T) { }, }) } +func TestAccIBMPIInstanceStorageConnection(t *testing.T) { + instanceRes := "ibm_pi_instance.power_instance" + name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100)) + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + CheckDestroy: testAccCheckIBMPIInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMPIInstanceStorageConnectionConfig(name, power.OK), + Check: resource.ComposeTestCheckFunc( + testAccCheckIBMPIInstanceExists(instanceRes), + resource.TestCheckResourceAttr(instanceRes, "pi_instance_name", name), + resource.TestCheckResourceAttr(instanceRes, "pi_storage_connection", acc.Pi_storage_connection), + ), + }, + }, + }) +} func TestAccIBMPIInstanceDeploymentTarget(t *testing.T) { instanceRes := "ibm_pi_instance.power_instance" name := fmt.Sprintf("tf-pi-instance-%d", acctest.RandIntRange(10, 100)) @@ -526,7 +567,7 @@ func testAccIBMPISAPInstanceConfig(name, sapProfile string) string { pi_storage_type = "tier1" pi_network { network_id = resource.ibm_pi_network.power_network.network_id - } + } } `, acc.Pi_cloud_instance_id, name, sapProfile, acc.Pi_sap_image) } @@ -703,7 +744,7 @@ func testAccCheckIBMPIStoppedInstanceConfigUpdate(name, instanceHealthStatus, pr pi_volume_pool = data.ibm_pi_image.power_image.storage_pool pi_volume_shareable = true pi_volume_size = 20 - } + } resource "ibm_pi_instance" "power_instance" { pi_cloud_instance_id = "%[1]s" pi_health_status = "%[5]s" diff --git a/website/docs/d/pi_instance.html.markdown b/website/docs/d/pi_instance.html.markdown index dfc470596e..78e66efb96 100644 --- a/website/docs/d/pi_instance.html.markdown +++ b/website/docs/d/pi_instance.html.markdown @@ -91,6 +91,7 @@ In addition to all argument reference list, you can access the following attribu - `shared_processor_pool`- (String) The name of the shared processor pool for the instance. - `shared_processor_pool_id` - (String) The ID of the shared processor pool for the instance. - `status` - (String) The status of the instance. +- `storage_connection` - (String) The storage connection type for the instance. - `storage_pool` - (String) The storage Pool where server is deployed. - `storage_pool_affinity` - (Boolean) Indicates if all volumes attached to the server must reside in the same storage pool. - `storage_type` - (String) The storage type where server is deployed. diff --git a/website/docs/d/pi_instances.html.markdown b/website/docs/d/pi_instances.html.markdown index 0f987e6d0a..ca1dd7527a 100644 --- a/website/docs/d/pi_instances.html.markdown +++ b/website/docs/d/pi_instances.html.markdown @@ -67,13 +67,13 @@ In addition to all argument reference list, you can access the following attribu - `networks` - (List) List of networks associated with this instance. Nested scheme for `networks`: - - `external_ip` - (String) The external IP address of the instance. - - `ip` - (String) The IP address of the instance. - - `macaddress` - (String) The MAC address of the instance. Deprecated please use `mac_address` instead. + - `external_ip` - (String) The external IP address of the instance. + - `ip` - (String) The IP address of the instance. + - `macaddress` - (String) The MAC address of the instance. Deprecated please use `mac_address` instead. - `mac_address` - (String) The MAC address of the instance. - - `network_id` - (String) The network ID of the instance. - - `network_name` - (String) The network name of the instance. - - `type` - (String) The type of the network. + - `network_id` - (String) The network ID of the instance. + - `network_name` - (String) The network name of the instance. + - `type` - (String) The type of the network. - `pin_policy` - (String) The pinning policy of the instance. - `placement_group_id`- (String) The ID of the placement group that the instance is a member. @@ -84,6 +84,7 @@ In addition to all argument reference list, you can access the following attribu - `shared_processor_pool`- (String) The name of the shared processor pool for the instance. - `shared_processor_pool_id` - (String) The ID of the shared processor pool for the instance. - `status` - (String) The status of the instance. + - `storage_connection` - (String) The storage connection type for the instance - `storage_pool` - (String) The storage Pool where server is deployed. - `storage_pool_affinity` - (Boolean) Indicates if all volumes attached to the server must reside in the same storage pool. - `storage_type` - (String) The storage type where server is deployed. diff --git a/website/docs/r/pi_instance.html.markdown b/website/docs/r/pi_instance.html.markdown index efc06f6aab..31cc69a15f 100644 --- a/website/docs/r/pi_instance.html.markdown +++ b/website/docs/r/pi_instance.html.markdown @@ -113,7 +113,7 @@ Review the argument references that you can specify for your resource. - `pi_storage_pool` - (Optional, String) Storage Pool for server deployment; if provided then `pi_affinity_policy` will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage pool for a custom image (an imported image or an image that is created from a VM capture) defaults to the storage pool the image was created in. - `pi_storage_pool_affinity` - (Optional, Boolean) Indicates if all volumes attached to the server must reside in the same storage pool. The default value is `true`. To attach data volumes from a different storage pool (mixed storage) set to `false` and use `pi_volume_attach` resource. Once set to `false`, cannot be set back to `true` unless all volumes attached reside in the same storage type and pool. - `pi_storage_type` - (Optional, String) - Storage type for server deployment; If storage type is not provided the storage type will default to `tier3`. To get a list of available storage types, please use the [ibm_pi_storage_types_capacity](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/pi_storage_types_capacity) data source. -- `pi_storage_connection` - (Optional, String) - Storage Connectivity Group (SCG) for server deployment. Only supported value is `vSCSI`. +- `pi_storage_connection` - (Optional, String) - Storage Connectivity Group (SCG) for server deployment. Supported values are `vSCSI`, `maxVolumeSupport`. - `pi_sys_type` - (Optional, String) The type of system on which to create the VM (e880/e980/e1080/s922/s1022). - Supported SAP system types are (e880/e980/e1080). - `pi_user_data` - (Optional, String) The user data `cloud-init` to pass to the instance during creation. It can be a base64 encoded or an unencoded string. If it is an unencoded string, the provider will encode it before it passing it down.