Skip to content

Commit c8b295f

Browse files
Documentation update and test added
1 parent 649e48e commit c8b295f

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

ibm/service/vpc/resource_ibm_is_instance_template_test.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,3 +1532,75 @@ func testAccCheckIBMISInstanceTemplateWith_AllowedUse(vpcname, subnetname, sshna
15321532
`, templateName, apiVersion, bareMetalServer, instanceVal, apiVersion, bareMetalServer, instanceVal, acc.ISZoneName)
15331533

15341534
}
1535+
1536+
func TestAccIBMISInstanceTemplate_QoSMode(t *testing.T) {
1537+
randInt := acctest.RandIntRange(10, 100)
1538+
1539+
publicKey := strings.TrimSpace(`
1540+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVtuCfWKVGKaRmaRG6JQZY8YdxnDgGzVOK93IrV9R5Hl0JP1oiLLWlZQS2reAKb8lBqyDVEREpaoRUDjqDqXG8J/kR42FKN51su914pjSBc86wJ02VtT1Wm1zRbSg67kT+g8/T1jCgB5XBODqbcICHVP8Z1lXkgbiHLwlUrbz6OZkGJHo/M/kD1Eme8lctceIYNz/Ilm7ewMXZA4fsidpto9AjyarrJLufrOBl4MRVcZTDSJ7rLP982aHpu9pi5eJAjOZc7Og7n4ns3NFppiCwgVMCVUQbN5GBlWhZ1OsT84ZiTf+Zy8ew+Yg5T7Il8HuC7loWnz+esQPf0s3xhC/kTsGgZreIDoh/rxJfD67wKXetNSh5RH/n5BqjaOuXPFeNXmMhKlhj9nJ8scayx/wsvOGuocEIkbyJSLj3sLUU403OafgatEdnJOwbqg6rUNNF5RIjpJpL7eEWlKIi1j9LyhmPJ+fEO7TmOES82VpCMHpLbe4gf/MhhJ/Xy8DKh9s= root@ffd8363b1226
1541+
`)
1542+
vpcName := fmt.Sprintf("tf-testvpc%d", randInt)
1543+
subnetName := fmt.Sprintf("tf-testsubnet%d", randInt)
1544+
templateName := fmt.Sprintf("tf-testtemplate%d", randInt)
1545+
sshKeyName := fmt.Sprintf("tf-testsshkey%d", randInt)
1546+
qosMode := "pooled"
1547+
resource.Test(t, resource.TestCase{
1548+
PreCheck: func() { acc.TestAccPreCheck(t) },
1549+
Providers: acc.TestAccProviders,
1550+
CheckDestroy: testAccCheckIBMISInstanceTemplateDestroy,
1551+
Steps: []resource.TestStep{
1552+
{
1553+
Config: testAccCheckIBMISInstanceTemplateConfig_QoSMode(vpcName, subnetName, sshKeyName, publicKey, templateName, qosMode),
1554+
Check: resource.ComposeTestCheckFunc(
1555+
resource.TestCheckResourceAttr(
1556+
"ibm_is_instance_template.instancetemplate1", "name", templateName),
1557+
resource.TestCheckResourceAttrSet(
1558+
"ibm_is_instance_template.instancetemplate1", "profile"),
1559+
resource.TestCheckResourceAttr(
1560+
"ibm_is_instance_template.instancetemplate1", "volume_bandwidth_qos_mode", qosMode),
1561+
),
1562+
},
1563+
},
1564+
})
1565+
}
1566+
1567+
func testAccCheckIBMISInstanceTemplateConfig_QoSMode(vpcName, subnetName, sshKeyName, publicKey, templateName, qosMode string) string {
1568+
return fmt.Sprintf(`
1569+
resource "ibm_is_vpc" "vpc2" {
1570+
name = "%s"
1571+
}
1572+
1573+
resource "ibm_is_subnet" "subnet2" {
1574+
name = "%s"
1575+
vpc = ibm_is_vpc.vpc2.id
1576+
zone = "us-south-2"
1577+
ipv4_cidr_block = "10.240.64.0/28"
1578+
}
1579+
1580+
resource "ibm_is_ssh_key" "sshkey" {
1581+
name = "%s"
1582+
public_key = "%s"
1583+
}
1584+
1585+
data "ibm_is_images" "is_images" {
1586+
}
1587+
1588+
resource "ibm_is_instance_template" "instancetemplate1" {
1589+
name = "%s"
1590+
image = data.ibm_is_images.is_images.images.0.id
1591+
profile = "bx2-8x32"
1592+
1593+
primary_network_interface {
1594+
subnet = ibm_is_subnet.subnet2.id
1595+
}
1596+
1597+
vpc = ibm_is_vpc.vpc2.id
1598+
zone = "us-south-2"
1599+
keys = [ibm_is_ssh_key.sshkey.id]
1600+
volume_bandwidth_qos_mode = "%s"
1601+
}
1602+
1603+
1604+
`, vpcName, subnetName, sshKeyName, publicKey, templateName, qosMode)
1605+
1606+
}

website/docs/r/is_instance.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ Review the argument references that you can specify for your resource.
955955
**&#x2022;** `gpu.memory` - (integer) The overall amount of GPU memory in GiB (gibibytes). </br>
956956
**&#x2022;** `gpu.model` - (string) The GPU model. </br>
957957
**&#x2022;** `enable_secure_boot` - (boolean) Indicates whether secure boot is enabled. </br>
958-
- `volume_bandwidth_qos_mode` - (Optional, String) The volume bandwidth QoS mode to use for this virtual server instance.
958+
- `volume_bandwidth_qos_mode` - (Optional, String) The volume bandwidth QoS mode to use for this virtual server instance. The specified value must be listed in the instance profile's volume_bandwidth_qos_modes. If unspecified, the default volume bandwidth QoS mode from the profile will be used.
959959
- `vpc` - (Required, Forces new resource, String) The ID of the VPC where you want to create the instance. When using `instance_template`, `vpc` is not required.
960960
- `zone` - (Required, Forces new resource, String) The name of the VPC zone where you want to create the instance. When using `instance_template`, `zone` is not required.
961961

website/docs/r/is_instance_template.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ Review the argument references that you can specify for your resource.
534534
535535
~>**Note:**
536536
`volume_attachments` provides either `volume` with a storage volume ID, or `volume_prototype` to create a new volume. If you plan to use this template with instance group, provide the `volume_prototype`. Instance group does not support template with existing storage volume IDs.
537+
- `volume_bandwidth_qos_mode` - (Optional, String) The volume bandwidth QoS mode to use for this virtual server instance. The specified value must be listed in the instance profile's volume_bandwidth_qos_modes. If unspecified, the default volume bandwidth QoS mode from the profile will be used.
537538
- `vpc` - (Required, String) The VPC ID that the instance templates needs to be created.
538539
- `user_data` - (Optional, String) The user data provided for the instance.
539540
- `zone` - (Required, String) The name of the zone.

0 commit comments

Comments
 (0)