@@ -58,7 +58,6 @@ func New() *schema.Provider {
58
58
"coder_workspace" : {
59
59
Description : "Use this data source to get information for the active workspace build." ,
60
60
ReadContext : func (c context.Context , rd * schema.ResourceData , i interface {}) diag.Diagnostics {
61
- rd .SetId (uuid .NewString ())
62
61
transition := os .Getenv ("CODER_WORKSPACE_TRANSITION" )
63
62
if transition == "" {
64
63
// Default to start!
@@ -75,11 +74,21 @@ func New() *schema.Provider {
75
74
owner = "default"
76
75
}
77
76
_ = rd .Set ("owner" , owner )
77
+ ownerID := os .Getenv ("CODER_WORKSPACE_OWNER_ID" )
78
+ if ownerID == "" {
79
+ ownerID = uuid .Nil .String ()
80
+ }
81
+ _ = rd .Set ("owner_id" , ownerID )
78
82
name := os .Getenv ("CODER_WORKSPACE_NAME" )
79
83
if name == "" {
80
84
name = "default"
81
85
}
82
86
rd .Set ("name" , name )
87
+ id := os .Getenv ("CODER_WORKSPACE_ID" )
88
+ if id == "" {
89
+ id = uuid .NewString ()
90
+ }
91
+ rd .SetId (id )
83
92
return nil
84
93
},
85
94
Schema : map [string ]* schema.Schema {
@@ -98,6 +107,16 @@ func New() *schema.Provider {
98
107
Computed : true ,
99
108
Description : "Username of the workspace owner." ,
100
109
},
110
+ "owner_id" : {
111
+ Type : schema .TypeString ,
112
+ Computed : true ,
113
+ Description : "UUID of the workspace owner." ,
114
+ },
115
+ "id" : {
116
+ Type : schema .TypeString ,
117
+ Computed : true ,
118
+ Description : "UUID of the workspace." ,
119
+ },
101
120
"name" : {
102
121
Type : schema .TypeString ,
103
122
Computed : true ,
0 commit comments