Skip to content

Commit fe64a76

Browse files
authored
Fix/ssm (#2444)
* fix/ssm * fix/ssm * fix/ssm * fix/ssm
1 parent 0087d44 commit fe64a76

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.changelog/2444.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_ssm_ssh_key_pair_secret: Fix ssh_key_name problem
3+
```

tencentcloud/services/ssm/resource_tc_ssm_ssh_key_pair_secret.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func ResourceTencentCloudSsmSshKeyPairSecret() *schema.Resource {
4949
},
5050
"ssh_key_name": {
5151
Optional: true,
52+
Computed: true,
5253
Type: schema.TypeString,
5354
Description: "Name of the SSH key pair, which only contains digits, letters and underscores and must start with a digit or letter. The maximum length is 25 characters.",
5455
},

tencentcloud/services/ssm/resource_tc_ssm_ssh_key_pair_secret_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ func TestAccTencentCloudSsmSshKeyPairSecretResource_basic(t *testing.T) {
6262
ImportStateVerify: true,
6363
ImportStateVerifyIgnore: []string{"clean_ssh_key"},
6464
},
65+
{
66+
Config: testAccSsmSshKeyPairSecretNoName,
67+
Check: resource.ComposeTestCheckFunc(
68+
resource.TestCheckResourceAttr("tencentcloud_ssm_ssh_key_pair_secret.example2", "description", "desc."),
69+
resource.TestCheckResourceAttr("tencentcloud_ssm_ssh_key_pair_secret.example2", "status", "Disabled"),
70+
),
71+
},
72+
{
73+
Config: testAccSsmSshKeyPairSecretNoNameUpdate,
74+
Check: resource.ComposeTestCheckFunc(
75+
resource.TestCheckResourceAttr("tencentcloud_ssm_ssh_key_pair_secret.example2", "description", "update desc."),
76+
resource.TestCheckResourceAttr("tencentcloud_ssm_ssh_key_pair_secret.example2", "status", "Enabled"),
77+
),
78+
},
79+
{
80+
ResourceName: "tencentcloud_ssm_ssh_key_pair_secret.example2",
81+
ImportState: true,
82+
ImportStateVerify: true,
83+
ImportStateVerifyIgnore: []string{"clean_ssh_key"},
84+
},
6585
},
6686
})
6787
}
@@ -149,3 +169,31 @@ resource "tencentcloud_ssm_ssh_key_pair_secret" "example1" {
149169
}
150170
}
151171
`
172+
173+
const testAccSsmSshKeyPairSecretNoName = `
174+
resource "tencentcloud_ssm_ssh_key_pair_secret" "example2" {
175+
secret_name = "tf-example-ssh-test-no-id"
176+
project_id = 0
177+
description = "desc."
178+
status = "Disabled"
179+
clean_ssh_key = true
180+
181+
tags = {
182+
createdBy = "terraform"
183+
}
184+
}
185+
`
186+
187+
const testAccSsmSshKeyPairSecretNoNameUpdate = `
188+
resource "tencentcloud_ssm_ssh_key_pair_secret" "example2" {
189+
secret_name = "tf-example-ssh-test-no-id"
190+
project_id = 0
191+
description = "update desc."
192+
status = "Enabled"
193+
clean_ssh_key = true
194+
195+
tags = {
196+
createdBy = "terraform"
197+
}
198+
}
199+
`

0 commit comments

Comments
 (0)