@@ -255,12 +255,22 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVE
255255 },
256256 })
257257}
258-
259258func TestAccIBMISInstanceBootVolumeManager_all_update (t * testing.T ) {
260259 var vol string
260+ vpcname := fmt .Sprintf ("tf-vpc-%d" , acctest .RandIntRange (10 , 100 ))
261+ name := fmt .Sprintf ("tf-server-%d" , acctest .RandIntRange (10 , 100 ))
262+ volname := fmt .Sprintf ("tf-vol-%d" , acctest .RandIntRange (10 , 100 ))
263+ subnetname := fmt .Sprintf ("tfip-subnet-%d" , acctest .RandIntRange (10 , 100 ))
264+ profile := "10iops-tier"
265+ capacity := int64 (200 )
261266 tag1 := "env:prod"
262267 tag2 := "boot:unattached"
263268 tag3 := "delete:false"
269+ accesstag := "access:qa"
270+ publicKey := strings .TrimSpace (`
271+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKVmnMOlHKcZK8tpt3MP1lqOLAcqcJzhsvJcjscgVERRN7/9484SOBJ3HSKxxNG5JN8owAjy5f9yYwcUg+JaUVuytn5Pv3aeYROHGGg+5G346xaq3DAwX6Y5ykr2fvjObgncQBnuU5KHWCECO/4h8uWuwh/kfniXPVjFToc+gnkqA+3RKpAecZhFXwfalQ9mMuYGFxn+fwn8cYEApsJbsEmb0iJwPiZ5hjFC8wREuiTlhPHDgkBLOiycd20op2nXzDbHfCHInquEe/gYxEitALONxm0swBOwJZwlTDOB7C6y2dzlrtxr1L59m7pCkWI4EtTRLvleehBoj3u7jB4usR
272+ ` )
273+ sshname := fmt .Sprintf ("tf-sshname-%d" , acctest .RandIntRange (10 , 100 ))
264274 resource .Test (t , resource.TestCase {
265275 PreCheck : func () { acc .TestAccPreCheck (t ) },
266276 Providers : acc .TestAccProviders ,
@@ -293,7 +303,7 @@ func TestAccIBMISInstanceBootVolumeManager_all_update(t *testing.T) {
293303 ),
294304 },
295305 {
296- Config : testAccCheckIBMISInstanceBootVolumeManagerTagUpdateConfig ( tag1 , tag2 , "" ),
306+ Config : testAccCheckIBMISInstanceBootVolumeManagerAllUpdateConfig ( vpcname , subnetname , sshname , publicKey , name , "" , tag1 , tag2 , "" , "" , "" , 0 ),
297307 Check : resource .ComposeTestCheckFunc (
298308 testAccCheckIBMISVolumeExists ("ibm_is_instance_boot_volume_manager.boot" , vol ),
299309 resource .TestCheckResourceAttrSet (
@@ -317,11 +327,10 @@ func TestAccIBMISInstanceBootVolumeManager_all_update(t *testing.T) {
317327 resource .TestCheckResourceAttrSet (
318328 "ibm_is_instance_boot_volume_manager.boot" , "zone" ),
319329 resource .TestCheckResourceAttrSet ("ibm_is_instance_boot_volume_manager.boot" , "tags.#" ),
320- resource .TestCheckResourceAttr ("ibm_is_instance_boot_volume_manager.boot" , "tags.#" , "3" ),
321330 ),
322331 },
323332 {
324- Config : testAccCheckIBMISInstanceBootVolumeManagerTagUpdateConfig ( tag1 , tag2 , tag3 ),
333+ Config : testAccCheckIBMISInstanceBootVolumeManagerAllUpdateConfig ( vpcname , subnetname , sshname , publicKey , name , profile , tag1 , tag2 , tag3 , accesstag , volname , capacity ),
325334 Check : resource .ComposeTestCheckFunc (
326335 testAccCheckIBMISVolumeExists ("ibm_is_instance_boot_volume_manager.boot" , vol ),
327336 resource .TestCheckResourceAttrSet (
@@ -346,11 +355,17 @@ func TestAccIBMISInstanceBootVolumeManager_all_update(t *testing.T) {
346355 "ibm_is_instance_boot_volume_manager.boot" , "zone" ),
347356 resource .TestCheckResourceAttrSet ("ibm_is_instance_boot_volume_manager.boot" , "tags.#" ),
348357 resource .TestCheckResourceAttr ("ibm_is_instance_boot_volume_manager.boot" , "tags.#" , "3" ),
358+ resource .TestCheckResourceAttr ("ibm_is_instance_boot_volume_manager.boot" , "access_tags.#" , "1" ),
359+ resource .TestCheckResourceAttr ("ibm_is_instance_boot_volume_manager.boot" , "access_tags.#" , "1" ),
360+ resource .TestCheckResourceAttr ("ibm_is_instance_boot_volume_manager.boot" , "profile" , profile ),
361+ resource .TestCheckResourceAttr ("ibm_is_instance_boot_volume_manager.boot" , "name" , volname ),
362+ resource .TestCheckResourceAttr ("ibm_is_instance_boot_volume_manager.boot" , "capacity" , fmt .Sprintf ("%d" , capacity )),
349363 ),
350364 },
351365 },
352366 })
353367}
368+
354369func TestAccIBMISInstanceBootVolumeManager_name_update (t * testing.T ) {
355370 var vol string
356371 name1 := fmt .Sprintf ("tfbootvoluat-%d" , acctest .RandIntRange (10 , 100 ))
@@ -816,6 +831,50 @@ func testAccCheckIBMISInstanceBootVolumeManagerProfileUpdateConfig(vpcname, subn
816831 }
817832 ` , vpcname , subnetname , acc .ISZoneName , sshname , publicKey , name , acc .InstanceProfileName , acc .ISZoneName , acc .VSIUnattachedBootVolumeID , profile , profile )
818833
834+ }
835+ func testAccCheckIBMISInstanceBootVolumeManagerAllUpdateConfig (vpcname , subnetname , sshname , publicKey , name , profile , tag1 , tag2 , tag3 , accesstag , volname string , capacity int64 ) string {
836+ return fmt .Sprintf (
837+ `
838+ resource "ibm_is_vpc" "testacc_vpc" {
839+ name = "%s"
840+ }
841+
842+ resource "ibm_is_subnet" "testacc_subnet" {
843+ name = "%s"
844+ vpc = ibm_is_vpc.testacc_vpc.id
845+ zone = "%s"
846+ total_ipv4_address_count = 16
847+ }
848+
849+ resource "ibm_is_ssh_key" "testacc_sshkey" {
850+ name = "%s"
851+ public_key = "%s"
852+ }
853+
854+ resource "ibm_is_instance" "testacc_instance" {
855+ name = "%s"
856+ profile = "%s"
857+ boot_volume {
858+ volume_id = ibm_is_instance_boot_volume_manager.boot.id
859+ auto_delete_volume = false
860+ }
861+ primary_network_interface {
862+ subnet = ibm_is_subnet.testacc_subnet.id
863+ }
864+ vpc = ibm_is_vpc.testacc_vpc.id
865+ zone = "%s"
866+ keys = [ibm_is_ssh_key.testacc_sshkey.id]
867+ }
868+ resource "ibm_is_instance_boot_volume_manager" "boot" {
869+ volume_id = "%s"
870+ profile = "%s" == "" ? null : "%s"
871+ capacity = %d == 0 ? null : %d
872+ access_tags = "%s" == "" ? null : ["%s"]
873+ tags = "%s" == "" ? null : ["%s", "%s", "%s"]
874+ name = "%s" == "" ? null : "%s"
875+ }
876+ ` , vpcname , subnetname , acc .ISZoneName , sshname , publicKey , name , acc .InstanceProfileName , acc .ISZoneName , acc .VSIUnattachedBootVolumeID , profile , profile , capacity , capacity , accesstag , accesstag , tag3 , tag1 , tag2 , tag3 , volname , volname )
877+
819878}
820879
821880func testAccCheckIBMISInstanceBootVolumeManagerAttachmentDeleteConfig (vpcname , subnetname , sshname , publicKey , insname , capacityArray string ) string {
0 commit comments