@@ -157,3 +157,44 @@ func testAccCheckScalewayAccountSSHKeyExists(tt *TestTools, n string) resource.T
157
157
return nil
158
158
}
159
159
}
160
+
161
+ func TestAccScalewayAccountSSHKey_ChangeResourceName (t * testing.T ) {
162
+ name := "TestAccScalewayAccountSSHKey_ChangeResourceName"
163
+ SSHKey := "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJEoOOgQBLJPs4g/XcPTKT82NywNPpxeuA20FlOPlpO [email protected] "
164
+ tt := NewTestTools (t )
165
+ defer tt .Cleanup ()
166
+
167
+ resource .ParallelTest (t , resource.TestCase {
168
+ PreCheck : func () { testAccPreCheck (t ) },
169
+ ProviderFactories : tt .ProviderFactories ,
170
+ CheckDestroy : testAccCheckScalewayAccountSSHKeyDestroy (tt ),
171
+ Steps : []resource.TestStep {
172
+ {
173
+ Config : `
174
+ resource "scaleway_account_ssh_key" "first" {
175
+ name = "` + name + `"
176
+ public_key = "\n\n` + SSHKey + `\n\n"
177
+ }
178
+ ` ,
179
+ Check : resource .ComposeTestCheckFunc (
180
+ testAccCheckScalewayAccountSSHKeyExists (tt , "scaleway_account_ssh_key.first" ),
181
+ resource .TestCheckResourceAttr ("scaleway_account_ssh_key.first" , "name" , name ),
182
+ resource .TestCheckResourceAttr ("scaleway_account_ssh_key.first" , "public_key" , SSHKey ),
183
+ ),
184
+ },
185
+ {
186
+ Config : `
187
+ resource "scaleway_account_ssh_key" "second" {
188
+ name = "` + name + `"
189
+ public_key = "\n\n` + SSHKey + `\n\n"
190
+ }
191
+ ` ,
192
+ Check : resource .ComposeTestCheckFunc (
193
+ testAccCheckScalewayAccountSSHKeyExists (tt , "scaleway_account_ssh_key.second" ),
194
+ resource .TestCheckResourceAttr ("scaleway_account_ssh_key.second" , "name" , name ),
195
+ resource .TestCheckResourceAttr ("scaleway_account_ssh_key.second" , "public_key" , SSHKey ),
196
+ ),
197
+ },
198
+ },
199
+ })
200
+ }
0 commit comments