-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
I m getting an error while doing gcp.ImportSSHKeyE
which is mentioning that the projectId is missing, after analyzing the code I made the following local modification and this worked. I m not sure if I am missing maybe some local configuration but form the examples I saw it doesn't seem so.
Problematic function: https://github.com/gruntwork-io/terratest/blob/master/modules/gcp/oslogin.go#L41
func ImportSSHKeyE(t t.TestingT, user, project, key string) error {
ctx := context.Background()
service, err := gcp.NewOSLoginServiceE(t)
if err != nil {
return err
}
parent := fmt.Sprintf("users/%s", user)
sshPublicKey := &oslogin.SshPublicKey{
Key: key,
}
_, err = service.Users.ImportSshPublicKey(parent, sshPublicKey).ProjectId(project).Context(ctx).Do()
if err != nil {
return err
}
return nil
}