@@ -214,6 +214,15 @@ func TestAccTencentCloudInstanceResource_WithKeyPairs(t *testing.T) {
214214 Providers : testAccProviders ,
215215 CheckDestroy : testAccCheckInstanceDestroy ,
216216 Steps : []resource.TestStep {
217+ {
218+ PreConfig : func () { testAccStepPreConfigSetTempAKSK (t , ACCOUNT_TYPE_COMMON ) },
219+ Config : testAccTencentCloudInstanceWithKeyPair_withoutKeyPair ,
220+ Check : resource .ComposeTestCheckFunc (
221+ testAccCheckTencentCloudDataSourceID (id ),
222+ testAccCheckTencentCloudInstanceExists (id ),
223+ resource .TestCheckResourceAttr (id , "instance_status" , "RUNNING" ),
224+ ),
225+ },
217226 {
218227 PreConfig : func () { testAccStepPreConfigSetTempAKSK (t , ACCOUNT_TYPE_COMMON ) },
219228 Config : testAccTencentCloudInstanceWithKeyPair (
@@ -938,6 +947,16 @@ resource "tencentcloud_instance" "foo" {
938947}
939948`
940949
950+ const testAccTencentCloudInstanceWithKeyPair_withoutKeyPair = defaultInstanceVariable + `
951+ resource "tencentcloud_instance" "foo" {
952+ instance_name = var.instance_name
953+ availability_zone = var.availability_cvm_zone
954+ image_id = data.tencentcloud_images.default.images.0.image_id
955+ instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
956+ system_disk_type = "CLOUD_PREMIUM"
957+ }
958+ `
959+
941960func testAccTencentCloudInstanceWithKeyPair (keyIds string ) string {
942961
943962 return fmt .Sprintf (
0 commit comments