@@ -224,7 +224,31 @@ func testAccCheckIBMPIInstanceReplicantConfig(name string) string {
224224 }
225225 ` , acc .Pi_cloud_instance_id , name , acc .Pi_image , acc .Pi_network_name , acc .Pi_volume_name )
226226}
227-
227+ func testAccCheckIBMPIInstanceStorageConnectionConfig (name , instanceHealthStatus string ) string {
228+ return fmt .Sprintf (`
229+ resource "ibm_pi_volume" "power_volume" {
230+ pi_cloud_instance_id = "%[1]s"
231+ pi_volume_size = 1
232+ pi_volume_name = "%[2]s"
233+ pi_volume_type = "tier3"
234+ }
235+ resource "ibm_pi_instance" "power_instance" {
236+ pi_cloud_instance_id = "%[1]s"
237+ pi_memory = "2"
238+ pi_processors = "1"
239+ pi_instance_name = "%[2]s"
240+ pi_proc_type = "shared"
241+ pi_image_id = "%[3]s"
242+ pi_sys_type = "s922"
243+ pi_network {
244+ network_id = "%[4]s"
245+ }
246+ pi_storage_connection = "%[5]s"
247+ pi_health_status = "%[6]s"
248+ pi_volume_ids = [ibm_pi_volume.power_volume.volume_id]
249+ }
250+ ` , acc .Pi_cloud_instance_id , name , acc .Pi_image , acc .Pi_network_name , acc .Pi_storage_connection , instanceHealthStatus )
251+ }
228252func testAccCheckIBMPIInstanceDestroy (s * terraform.State ) error {
229253 sess , err := acc .TestAccProvider .Meta ().(conns.ClientSession ).IBMPISession ()
230254 if err != nil {
@@ -305,7 +329,25 @@ func TestAccIBMPIInstanceBasic(t *testing.T) {
305329 },
306330 })
307331}
308-
332+ func TestAccIBMPIInstanceStorageConnection (t * testing.T ) {
333+ instanceRes := "ibm_pi_instance.power_instance"
334+ name := fmt .Sprintf ("tf-pi-instance-%d" , acctest .RandIntRange (10 , 100 ))
335+ resource .Test (t , resource.TestCase {
336+ PreCheck : func () { acc .TestAccPreCheck (t ) },
337+ Providers : acc .TestAccProviders ,
338+ CheckDestroy : testAccCheckIBMPIInstanceDestroy ,
339+ Steps : []resource.TestStep {
340+ {
341+ Config : testAccCheckIBMPIInstanceStorageConnectionConfig (name , helpers .PIInstanceHealthOk ),
342+ Check : resource .ComposeTestCheckFunc (
343+ testAccCheckIBMPIInstanceExists (instanceRes ),
344+ resource .TestCheckResourceAttr (instanceRes , "pi_instance_name" , name ),
345+ resource .TestCheckResourceAttr (instanceRes , "pi_storage_connection" , acc .Pi_storage_connection ),
346+ ),
347+ },
348+ },
349+ })
350+ }
309351func TestAccIBMPIInstanceDeploymentType (t * testing.T ) {
310352 instanceRes := "ibm_pi_instance.power_instance"
311353 name := fmt .Sprintf ("tf-pi-instance-%d" , acctest .RandIntRange (10 , 100 ))
0 commit comments