Skip to content

Commit b082adf

Browse files
committed
add
1 parent 7f199d1 commit b082adf

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

tencentcloud/services/cvm/resource_tc_instance_test.go

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,75 @@ resource "tencentcloud_cbs_storage_attachment" "attachment_cbs_disk2" {
16801680
16811681
`
16821682

1683+
func TestAccTencentCloudInstanceResourceWithLocalDisk(t *testing.T) {
1684+
t.Parallel()
1685+
resource.Test(t, resource.TestCase{
1686+
PreCheck: func() {
1687+
acctest.AccPreCheck(t)
1688+
},
1689+
Providers: acctest.AccProviders,
1690+
CheckDestroy: testAccCheckCvmInstanceDestroy,
1691+
Steps: []resource.TestStep{
1692+
{
1693+
Config: testAccCvmInstanceResource_LocalDiskCreate,
1694+
Check: resource.ComposeTestCheckFunc(
1695+
testAccCheckCvmInstanceExists("tencentcloud_instance.local_disk"),
1696+
resource.TestCheckResourceAttr("tencentcloud_instance.local_disk", "instance_status", "RUNNING")),
1697+
},
1698+
},
1699+
})
1700+
}
1701+
1702+
const testAccCvmInstanceResource_LocalDiskCreate = `
1703+
data "tencentcloud_images" "default" {
1704+
image_type = ["PUBLIC_IMAGE"]
1705+
image_name_regex = "Final"
1706+
}
1707+
1708+
resource "tencentcloud_vpc" "vpc" {
1709+
name = "vpc"
1710+
cidr_block = "10.0.0.0/16"
1711+
}
1712+
1713+
resource "tencentcloud_subnet" "subnet" {
1714+
vpc_id = tencentcloud_vpc.vpc.id
1715+
name = "subnet"
1716+
cidr_block = "10.0.0.0/16"
1717+
availability_zone = "ap-guangzhou-6"
1718+
}
1719+
1720+
resource "tencentcloud_instance" "example" {
1721+
instance_name = "tf-example"
1722+
availability_zone = "ap-guangzhou-6"
1723+
image_id = data.tencentcloud_images.default.images.0.image_id
1724+
instance_type = "IT5.4XLARGE64"
1725+
system_disk_type = "LOCAL_BASIC"
1726+
system_disk_size = 50
1727+
hostname = "user"
1728+
project_id = 0
1729+
vpc_id = tencentcloud_vpc.vpc.id
1730+
subnet_id = tencentcloud_subnet.subnet.id
1731+
1732+
data_disks {
1733+
data_disk_type = "CLOUD_HSSD"
1734+
data_disk_size = 50
1735+
encrypt = false
1736+
data_disk_name = "tf-test1"
1737+
}
1738+
1739+
data_disks {
1740+
data_disk_type = "CLOUD_HSSD"
1741+
data_disk_size = 60
1742+
encrypt = false
1743+
data_disk_name = "tf-test2"
1744+
}
1745+
1746+
tags = {
1747+
tagKey = "tagValue"
1748+
}
1749+
}
1750+
`
1751+
16831752
func TestAccTencentCloudNeedFixInstancePostpaidToPrepaid(t *testing.T) {
16841753

16851754
id := "tencentcloud_instance.foo"

0 commit comments

Comments
 (0)