Skip to content

Commit 6595cc8

Browse files
author
mikatong
committed
add test case
1 parent e49453d commit 6595cc8

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

tencentcloud/services/cvm/resource_tc_instance_test.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,3 +2931,67 @@ resource "tencentcloud_instance" "cvm_with_orderly_sg" {
29312931
orderly_security_groups = ["sg-cm7fbbf3", "sg-kensue7b", "sg-05f7wnhn"]
29322932
}
29332933
`
2934+
2935+
func TestAccTencentCloudInstanceResourceHPC(t *testing.T) {
2936+
t.Parallel()
2937+
resource.Test(t, resource.TestCase{
2938+
PreCheck: func() {
2939+
acctest.AccPreCheck(t)
2940+
},
2941+
Providers: acctest.AccProviders,
2942+
CheckDestroy: testAccCheckCvmInstanceDestroy,
2943+
Steps: []resource.TestStep{
2944+
{
2945+
Config: testAccTencentCloudInstanceHPC,
2946+
Check: resource.ComposeTestCheckFunc(
2947+
testAccCheckCvmInstanceExists("tencentcloud_instance.hpc"),
2948+
resource.TestCheckResourceAttr("tencentcloud_instance.hpc", "instance_status", "RUNNING"),
2949+
resource.TestCheckResourceAttrSet("tencentcloud_instance.hpc", "hpc_cluster_id"),
2950+
),
2951+
},
2952+
},
2953+
})
2954+
}
2955+
2956+
const testAccTencentCloudInstanceHPC = `
2957+
locals {
2958+
availability_zone = "ap-shanghai-5"
2959+
instance_type = "HCCS5.24XLARGE384"
2960+
}
2961+
2962+
resource "tencentcloud_cvm_hpc_cluster" "hpc_cluster" {
2963+
zone = local.availability_zone
2964+
name = "terraform-test"
2965+
remark = "create for test"
2966+
}
2967+
2968+
data "tencentcloud_images" "default" {
2969+
instance_type = local.instance_type
2970+
}
2971+
2972+
resource "tencentcloud_vpc" "vpc" {
2973+
cidr_block = "10.0.0.0/16"
2974+
name = "vpc"
2975+
}
2976+
2977+
resource "tencentcloud_subnet" "subnet" {
2978+
vpc_id = tencentcloud_vpc.vpc.id
2979+
availability_zone = local.availability_zone
2980+
name = "subnet"
2981+
cidr_block = "10.0.1.0/24"
2982+
}
2983+
2984+
resource "tencentcloud_instance" "hpc" {
2985+
instance_name = "tf-example"
2986+
availability_zone = local.availability_zone
2987+
image_id = data.tencentcloud_images.default.images.0.image_id
2988+
instance_type = local.instance_type
2989+
system_disk_type = "LOCAL_BASIC"
2990+
system_disk_size = 440
2991+
hostname = "user"
2992+
project_id = 0
2993+
vpc_id = tencentcloud_vpc.vpc.id
2994+
subnet_id = tencentcloud_subnet.subnet.id
2995+
hpc_cluster_id = tencentcloud_cvm_hpc_cluster.hpc_cluster.id
2996+
}
2997+
`

0 commit comments

Comments
 (0)