Skip to content

Commit

Permalink
Mark ssh key as force new (#3543) (#6433)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored May 20, 2020
1 parent b225f7a commit 1be3577
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/3543.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
os_login: Fixed `google_os_login_ssh_public_key` `key` field attempting to update in-place
```
11 changes: 1 addition & 10 deletions google/resource_os_login_ssh_public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func resourceOSLoginSSHPublicKey() *schema.Resource {
"key": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `Public key text in SSH format, defined by RFC4253 section 6.6.`,
},
"user": {
Expand Down Expand Up @@ -158,12 +159,6 @@ func resourceOSLoginSSHPublicKeyUpdate(d *schema.ResourceData, meta interface{})
config := meta.(*Config)

obj := make(map[string]interface{})
keyProp, err := expandOSLoginSSHPublicKeyKey(d.Get("key"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("key"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, keyProp)) {
obj["key"] = keyProp
}
expirationTimeUsecProp, err := expandOSLoginSSHPublicKeyExpirationTimeUsec(d.Get("expiration_time_usec"), d, config)
if err != nil {
return err
Expand All @@ -179,10 +174,6 @@ func resourceOSLoginSSHPublicKeyUpdate(d *schema.ResourceData, meta interface{})
log.Printf("[DEBUG] Updating SSHPublicKey %q: %#v", d.Id(), obj)
updateMask := []string{}

if d.HasChange("key") {
updateMask = append(updateMask, "key")
}

if d.HasChange("expiration_time_usec") {
updateMask = append(updateMask, "expirationTimeUsec")
}
Expand Down

0 comments on commit 1be3577

Please sign in to comment.