Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc6b112d

Browse files
committed
feat: Expose owner and workspace IDs to "coder_workspace"
This allows for simpler persistence of resources thatshouldn't be deleted when a user changes their name.
1 parent7e3d827 commitc6b112d

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

‎docs/data-sources/workspace.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ resource "kubernetes_pod" "dev" {
2424
<!-- schema generated by tfplugindocs-->
2525
##Schema
2626

27-
###Optional
28-
29-
-`id` (String) The ID of this resource.
30-
3127
###Read-Only
3228

29+
-`id` (String) UUID of the workspace.
3330
-`name` (String) Name of the workspace.
3431
-`owner` (String) Username of the workspace owner.
32+
-`owner_id` (String) UUID of the workspace owner.
3533
-`start_count` (Number) A computed count based on "transition" state. If "start", count will equal 1.
3634
-`transition` (String) Either "start" or "stop". Use this to start/stop resources with "count".
3735

‎internal/provider/provider.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,21 @@ func New() *schema.Provider {
7575
owner="default"
7676
}
7777
_=rd.Set("owner",owner)
78+
ownerID:=os.Getenv("CODER_WORKSPACE_OWNER_ID")
79+
ifownerID=="" {
80+
ownerID=uuid.Nil.String()
81+
}
82+
_=rd.Set("owner_id",ownerID)
7883
name:=os.Getenv("CODER_WORKSPACE_NAME")
7984
ifname=="" {
8085
name="default"
8186
}
8287
rd.Set("name",name)
88+
id:=os.Getenv("CODER_WORKSPACE_ID")
89+
ifid=="" {
90+
id=uuid.Nil.String()
91+
}
92+
_=rd.Set("id",id)
8393
returnnil
8494
},
8595
Schema:map[string]*schema.Schema{
@@ -98,6 +108,16 @@ func New() *schema.Provider {
98108
Computed:true,
99109
Description:"Username of the workspace owner.",
100110
},
111+
"owner_id": {
112+
Type:schema.TypeString,
113+
Computed:true,
114+
Description:"UUID of the workspace owner.",
115+
},
116+
"id": {
117+
Type:schema.TypeString,
118+
Computed:true,
119+
Description:"UUID of the workspace.",
120+
},
101121
"name": {
102122
Type:schema.TypeString,
103123
Computed:true,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp