Skip to content

Commit 8b9f2ca

Browse files
fix: setting key_id, schemaVersion, website arguments
1 parent 3fa41d6 commit 8b9f2ca

File tree

5 files changed

+12
-16
lines changed

5 files changed

+12
-16
lines changed

github/resource_github_user_ssh_key.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ func resourceGithubUserSshKeyRead(ctx context.Context, d *schema.ResourceData, m
105105
}
106106

107107
// set computed fields
108-
if err = d.Set("key_id", userKey.GetID()); err != nil {
109-
return diag.FromErr(err)
110-
}
111108
if err = d.Set("etag", resp.Header.Get("ETag")); err != nil {
112109
return diag.FromErr(err)
113110
}
@@ -160,8 +157,9 @@ func resourceGithubUserSshKeyImport(ctx context.Context, d *schema.ResourceData,
160157
return nil, err
161158
}
162159

163-
d.SetId(strconv.FormatInt(key.GetID(), 10))
164-
160+
if err = d.Set("key_id", key.GetID()); err != nil {
161+
return nil, err
162+
}
165163
if err = d.Set("title", key.GetTitle()); err != nil {
166164
return nil, err
167165
}

github/resource_github_user_ssh_key_migration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
func resourceGithubUserSshKeyV0() *schema.Resource {
1313
return &schema.Resource{
14-
SchemaVersion: 1,
14+
SchemaVersion: 0,
1515
Schema: map[string]*schema.Schema{
1616
"title": {
1717
Type: schema.TypeString,

github/resource_github_user_ssh_signing_key.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,12 @@ func resourceGithubUserSshSigningKeyRead(ctx context.Context, d *schema.Resource
8282
client := meta.(*Owner).v3client
8383

8484
keyID := int64(d.Get("key_id").(int))
85-
userKey, resp, err := client.Users.GetSSHSigningKey(ctx, keyID)
85+
_, resp, err := client.Users.GetSSHSigningKey(ctx, keyID)
8686
if err != nil {
8787
return diag.FromErr(deleteResourceOn404AndSwallow304OtherwiseReturnError(err, d, "user SSH signing key (%d)", keyID))
8888
}
8989

9090
// set computed fields
91-
if err = d.Set("key_id", userKey.GetID()); err != nil {
92-
return diag.FromErr(err)
93-
}
9491
if err = d.Set("etag", resp.Header.Get("ETag")); err != nil {
9592
return diag.FromErr(err)
9693
}
@@ -131,8 +128,9 @@ func resourceGithubUserSshSigningKeyImport(ctx context.Context, d *schema.Resour
131128
return nil, err
132129
}
133130

134-
d.SetId(strconv.FormatInt(key.GetID(), 10))
135-
131+
if err = d.Set("key_id", key.GetID()); err != nil {
132+
return nil, err
133+
}
136134
if err = d.Set("title", key.GetTitle()); err != nil {
137135
return nil, err
138136
}

website/docs/r/user_ssh_key.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ resource "github_user_ssh_key" "example" {
2424

2525
The following arguments are supported:
2626

27-
* `id` - The ID of the SSH key
28-
* `url` - The URL of the SSH key
2927
* `title` - (Required) A descriptive name for the new key.
3028
* `key` - (Required) The public SSH key to add to your GitHub account.
3129

3230
## Attributes Reference
3331

3432
The following attributes are exported:
3533

36-
* `key_id` - The unique identifier of the SSH signing key.
34+
* `id` - The ID of the SSH key
35+
* `url` - The URL of the SSH key
36+
* `key_id` - The unique identifier of the SSH key.
3737
* `etag`
3838

3939
## Import

website/docs/r/user_ssh_signing_key.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ resource "github_user_ssh_signing_key" "example" {
2424

2525
The following arguments are supported:
2626

27-
* `id` - The ID of the SSH signing key
2827
* `title` - (Required) A descriptive name for the new key.
2928
* `key` - (Required) The public SSH signing key to add to your GitHub account.
3029

3130
## Attributes Reference
3231

3332
The following attributes are exported:
3433

34+
* `id` - The ID of the SSH signing key
3535
* `key_id` - The unique identifier of the SSH signing key.
3636
* `etag`
3737

0 commit comments

Comments
 (0)