11package tencentcloud
22
33import (
4+ "fmt"
45 "testing"
56
7+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
68 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
79)
810
911// go test -i; go test -test.run TestAccTencentCloudSsmSshKeyPairSecretResource_basic -v
1012func TestAccTencentCloudSsmSshKeyPairSecretResource_basic (t * testing.T ) {
1113 t .Parallel ()
14+ rName := fmt .Sprintf ("tf-testacc-kms-key-%s" , acctest .RandString (13 ))
1215 resource .Test (t , resource.TestCase {
1316 PreCheck : func () {
1417 testAccPreCheck (t )
1518 },
1619 Providers : testAccProviders ,
1720 Steps : []resource.TestStep {
1821 {
19- Config : testAccSsmSshKeyPairSecret ,
22+ Config : fmt . Sprintf ( testAccSsmSshKeyPairSecret , rName ) ,
2023 Check : resource .ComposeTestCheckFunc (
2124 resource .TestCheckResourceAttr ("tencentcloud_ssm_ssh_key_pair_secret.example" , "description" , "desc." ),
2225 resource .TestCheckResourceAttr ("tencentcloud_ssm_ssh_key_pair_secret.example" , "status" , "Disabled" ),
2326 ),
2427 },
2528 {
26- Config : testAccSsmSshKeyPairSecretUpdate ,
29+ Config : fmt . Sprintf ( testAccSsmSshKeyPairSecretUpdate , rName ) ,
2730 Check : resource .ComposeTestCheckFunc (
2831 resource .TestCheckResourceAttr ("tencentcloud_ssm_ssh_key_pair_secret.example" , "description" , "update desc." ),
2932 resource .TestCheckResourceAttr ("tencentcloud_ssm_ssh_key_pair_secret.example" , "status" , "Enabled" ),
@@ -41,7 +44,7 @@ func TestAccTencentCloudSsmSshKeyPairSecretResource_basic(t *testing.T) {
4144
4245const testAccSsmSshKeyPairSecret = `
4346resource "tencentcloud_kms_key" "example" {
44- alias = "tf-example-kms-key-test "
47+ alias = "%s "
4548 description = "example of kms key"
4649 key_rotation_enabled = false
4750 is_enabled = true
@@ -68,7 +71,7 @@ resource "tencentcloud_ssm_ssh_key_pair_secret" "example" {
6871
6972const testAccSsmSshKeyPairSecretUpdate = `
7073resource "tencentcloud_kms_key" "example" {
71- alias = "tf-example-kms-key-test "
74+ alias = "%s "
7275 description = "example of kms key"
7376 key_rotation_enabled = false
7477 is_enabled = true
0 commit comments