@@ -186,7 +186,7 @@ func TestAccTencentCloudInstanceWithKeyPair(t *testing.T) {
186186 CheckDestroy : testAccCheckInstanceDestroy ,
187187 Steps : []resource.TestStep {
188188 {
189- Config : testAccTencentCloudInstanceWithKeyPair ("tf_acc_test_key1 " ),
189+ Config : testAccTencentCloudInstanceWithKeyPair ("key_pair_0 " ),
190190 Check : resource .ComposeTestCheckFunc (
191191 testAccCheckTencentCloudDataSourceID (id ),
192192 testAccCheckTencentCloudInstanceExists (id ),
@@ -195,7 +195,7 @@ func TestAccTencentCloudInstanceWithKeyPair(t *testing.T) {
195195 ),
196196 },
197197 {
198- Config : testAccTencentCloudInstanceWithKeyPair ("tf_acc_test_key2 " ),
198+ Config : testAccTencentCloudInstanceWithKeyPair ("key_pair_1 " ),
199199 Check : resource .ComposeTestCheckFunc (
200200 testAccCheckTencentCloudDataSourceID (id ),
201201 testAccCheckTencentCloudInstanceExists (id ),
@@ -614,17 +614,22 @@ resource "tencentcloud_instance" "foo" {
614614func testAccTencentCloudInstanceWithKeyPair (keyName string ) string {
615615 return fmt .Sprintf (
616616 defaultInstanceVariable + `
617- resource "tencentcloud_key_pair" "foo " {
618- key_name = "%s "
617+ resource "tencentcloud_key_pair" "key_pair_0 " {
618+ key_name = "key_pair_0 "
619619 public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDjd8fTnp7Dcuj4mLaQxf9Zs/ORgUL9fQxRCNKkPgP1paTy1I513maMX126i36Lxxl3+FUB52oVbo/FgwlIfX8hyCnv8MCxqnuSDozf1CD0/wRYHcTWAtgHQHBPCC2nJtod6cVC3kB18KeV4U7zsxmwFeBIxojMOOmcOBuh7+trRw=="
620620}
621621
622+ resource "tencentcloud_key_pair" "key_pair_1" {
623+ key_name = "key_pair_1"
624+ public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzwYE6KI8uULEvSNA2k1tlsLtMDe+x1Saw6yL3V1mk9NFws0K2BshYqsnP/BlYiGZv/Nld5xmGoA9LupOcUpyyGGSHZdBrMx1Dz9ajewe7kGowRWwwMAHTlzh9+iqeg/v6P5vW6EwK4hpGWgv06vGs3a8CzfbHu1YRbZAO/ysp3ymdL+vGvw/vzC0T+YwPMisn9wFD5FTlJ+Em6s9PzxqR/41t4YssmCwUV78ZoYL8CyB0emuB8wALvcXbdUVxMxpBEHd5U6ZP5+HPxU2WFbWqiFCuErLIZRuxFw8L/Ot+JOyNnadN1XU4crYDX5cML1i/ExXKVIDoBaLtgAJOpyeP"
625+ }
626+
622627resource "tencentcloud_instance" "foo" {
623628 instance_name = var.instance_name
624629 availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
625630 image_id = data.tencentcloud_images.default.images.0.image_id
626631 instance_type = data.tencentcloud_instance_types.default.instance_types.0.instance_type
627- key_name = tencentcloud_key_pair.foo .id
632+ key_name = tencentcloud_key_pair.%s .id
628633 system_disk_type = "CLOUD_PREMIUM"
629634}
630635` ,
0 commit comments