StepBee opened a new issue #11:
URL: https://github.com/apache/cloudstack-terraform-provider/issues/11
Version: 0.4.0-pre
module: cloudstack_instance
task: update SSH keypair
When updating the SSH keypair for an instance, which is part of a project,
the project is not specified as a parameter for the API call to
resetSSHKeyForVirtualMachine.
The request to update the ssh keypair is failing, because the ssh key, which
is part of the project, can't be found.
From the cloudstack log:
```
2021-10-25 15:34:02,652 DEBUG [c.c.a.ApiServlet]
(qtp197964393-838:ctx-95199a92 ctx-fe922f62 ctx-683fc1a2) (logid:adb0062b)
===END=== 195.81.221.4 -- GET
apiKey=xxxxx&command=resetSSHKeyForVirtualMachine&id=xxxxx-ee31-4094-8ecb-xxxxx&keypair=my-ssh-key&response=json&signature=xxxxx
BxSbLg%3D
2021-10-25 15:34:02,867 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl]
(API-Job-Executor-57:ctx-a83c91d6 job-5516) (logid:6decd161) Complete async
job-5516, jobStatus: FAILED, resultCode: 530, result: org.
2021-10-25 15:34:02,867 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl]
(API-Job-Executor-57:ctx-a83c91d6 job-5516) (logid:6decd161) Complete async
job-5516, jobStatus: FAILED, resultCode: 530, result: org.a
pache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"431","errortext":"A
key pair with name 'my-ssh-key' does not exist for account xxxx in specified
domain id"}
```
A fix from my perspective could look like:
terraform-provider-cloudstack/cloudstack/resource_cloudstack_instance.go
```
func resourceCloudStackInstanceUpdate
..
if d.HasChange("keypair") {
...
```
line 575 adding
```
if err := setProjectid(p, cs, d); err != nil {
return err
}
```
Tested it successfully with a local build.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]