@@ -186,7 +186,7 @@ func TestAccTencentCloudInstanceWithKeyPair(t *testing.T) {
186
186
CheckDestroy : testAccCheckInstanceDestroy ,
187
187
Steps : []resource.TestStep {
188
188
{
189
- Config : testAccTencentCloudInstanceWithKeyPair ("tf_acc_test_key1 " ),
189
+ Config : testAccTencentCloudInstanceWithKeyPair ("key_pair_0 " ),
190
190
Check : resource .ComposeTestCheckFunc (
191
191
testAccCheckTencentCloudDataSourceID (id ),
192
192
testAccCheckTencentCloudInstanceExists (id ),
@@ -195,7 +195,7 @@ func TestAccTencentCloudInstanceWithKeyPair(t *testing.T) {
195
195
),
196
196
},
197
197
{
198
- Config : testAccTencentCloudInstanceWithKeyPair ("tf_acc_test_key2 " ),
198
+ Config : testAccTencentCloudInstanceWithKeyPair ("key_pair_1 " ),
199
199
Check : resource .ComposeTestCheckFunc (
200
200
testAccCheckTencentCloudDataSourceID (id ),
201
201
testAccCheckTencentCloudInstanceExists (id ),
@@ -614,17 +614,22 @@ resource "tencentcloud_instance" "foo" {
614
614
func testAccTencentCloudInstanceWithKeyPair (keyName string ) string {
615
615
return fmt .Sprintf (
616
616
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 "
619
619
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDjd8fTnp7Dcuj4mLaQxf9Zs/ORgUL9fQxRCNKkPgP1paTy1I513maMX126i36Lxxl3+FUB52oVbo/FgwlIfX8hyCnv8MCxqnuSDozf1CD0/wRYHcTWAtgHQHBPCC2nJtod6cVC3kB18KeV4U7zsxmwFeBIxojMOOmcOBuh7+trRw=="
620
620
}
621
621
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
+
622
627
resource "tencentcloud_instance" "foo" {
623
628
instance_name = var.instance_name
624
629
availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
625
630
image_id = data.tencentcloud_images.default.images.0.image_id
626
631
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
628
633
system_disk_type = "CLOUD_PREMIUM"
629
634
}
630
635
` ,
0 commit comments