File tree 3 files changed +22
-1
lines changed
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ resource "kubernetes_pod" "dev" {
26
26
27
27
### Read-Only
28
28
29
+ - ` access_port ` (Number) The access port of the Coder deployment provisioning this workspace.
29
30
- ` access_url ` (String) The access URL of the Coder deployment provisioning this workspace.
30
31
- ` id ` (String) UUID of the workspace.
31
32
- ` name ` (String) Name of the workspace.
Original file line number Diff line number Diff line change 8
8
"os"
9
9
"reflect"
10
10
"runtime"
11
+ "strconv"
11
12
"strings"
12
13
13
14
"github.com/google/uuid"
@@ -106,6 +107,19 @@ func New() *schema.Provider {
106
107
}
107
108
rd .Set ("access_url" , config .URL .String ())
108
109
110
+ rawPort := config .URL .Port ()
111
+ if rawPort == "" {
112
+ rawPort = "80"
113
+ if config .URL .Scheme == "https" {
114
+ rawPort = "443"
115
+ }
116
+ }
117
+ port , err := strconv .Atoi (rawPort )
118
+ if err != nil {
119
+ return diag .Errorf ("couldn't parse port %q" , port )
120
+ }
121
+ rd .Set ("access_port" , port )
122
+
109
123
return nil
110
124
},
111
125
Schema : map [string ]* schema.Schema {
@@ -114,6 +128,11 @@ func New() *schema.Provider {
114
128
Computed : true ,
115
129
Description : "The access URL of the Coder deployment provisioning this workspace." ,
116
130
},
131
+ "access_port" : {
132
+ Type : schema .TypeInt ,
133
+ Computed : true ,
134
+ Description : "The access port of the Coder deployment provisioning this workspace." ,
135
+ },
117
136
"start_count" : {
118
137
Type : schema .TypeInt ,
119
138
Computed : true ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ func TestWorkspace(t *testing.T) {
31
31
Steps : []resource.TestStep {{
32
32
Config : `
33
33
provider "coder" {
34
- url = "https://example.com"
34
+ url = "https://example.com:8080 "
35
35
}
36
36
data "coder_workspace" "me" {
37
37
}` ,
@@ -45,6 +45,7 @@ func TestWorkspace(t *testing.T) {
45
45
value := attribs ["transition" ]
46
46
require .NotNil (t , value )
47
47
t .Log (value )
48
+ require .Equal (t , "8080" , attribs ["access_port" ])
48
49
require .Equal (t , "owner123" , attribs ["owner" ])
49
50
require .
Equal (
t ,
"[email protected] " ,
attribs [
"owner_email" ])
50
51
return nil
You can’t perform that action at this time.
0 commit comments