@@ -58,7 +58,6 @@ func New() *schema.Provider {
5858 "coder_workspace" : {
5959 Description : "Use this data source to get information for the active workspace build." ,
6060 ReadContext : func (c context.Context , rd * schema.ResourceData , i interface {}) diag.Diagnostics {
61- rd .SetId (uuid .NewString ())
6261 transition := os .Getenv ("CODER_WORKSPACE_TRANSITION" )
6362 if transition == "" {
6463 // Default to start!
@@ -75,11 +74,21 @@ func New() *schema.Provider {
7574 owner = "default"
7675 }
7776 _ = 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 )
7882 name := os .Getenv ("CODER_WORKSPACE_NAME" )
7983 if name == "" {
8084 name = "default"
8185 }
8286 rd .Set ("name" , name )
87+ id := os .Getenv ("CODER_WORKSPACE_ID" )
88+ if id == "" {
89+ id = uuid .NewString ()
90+ }
91+ rd .SetId (id )
8392 return nil
8493 },
8594 Schema : map [string ]* schema.Schema {
@@ -98,6 +107,16 @@ func New() *schema.Provider {
98107 Computed : true ,
99108 Description : "Username of the workspace owner." ,
100109 },
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+ },
101120 "name" : {
102121 Type : schema .TypeString ,
103122 Computed : true ,
0 commit comments