Skip to content

Commit 098f879

Browse files
committed
tailscale: fix acceptance test failure on tailnet key resource
Updates #cleanup Signed-off-by: Percy Wegmann <[email protected]>
1 parent bc60c24 commit 098f879

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

docs/resources/tailnet_key.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ resource "tailscale_tailnet_key" "sample_key" {
3434
- `recreate_if_invalid` (String) Determines whether the key should be created again if it becomes invalid. By default, reusable keys will be recreated, but single-use keys will not. Possible values: 'always', 'never'.
3535
- `reusable` (Boolean) Indicates if the key is reusable or single-use. Defaults to `false`.
3636
- `tags` (Set of String) List of tags to apply to the machines authenticated by the key.
37+
- `user_id` (String) ID of the user who created this key, empty for keys created by OAuth clients.
3738

3839
### Read-Only
3940

tailscale/resource_tailnet_key.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ func resourceTailnetKey() *schema.Resource {
102102
}
103103
},
104104
},
105+
"user_id": {
106+
Type: schema.TypeString,
107+
Optional: true,
108+
Description: "ID of the user who created this key, empty for keys created by OAuth clients.",
109+
Computed: true,
110+
},
105111
},
106112
}
107113
}
@@ -257,5 +263,9 @@ func resourceTailnetKeyRead(ctx context.Context, d *schema.ResourceData, m inter
257263
return diagnosticsError(err, "Failed to set 'invalid'")
258264
}
259265

266+
if err = d.Set("user_id", key.UserID); err != nil {
267+
return diagnosticsError(err, "Failed to set 'user_id'")
268+
}
269+
260270
return nil
261271
}

tailscale/resource_tailnet_key_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ func TestAccTailscaleTailnetKey(t *testing.T) {
213213
// don't compare IDs
214214
actual.ID = ""
215215

216+
// don't compare user IDs
217+
actual.UserID = ""
218+
216219
if err := assertEqual(expected, actual, "wrong key"); err != nil {
217220
return err
218221
}

0 commit comments

Comments
 (0)