@@ -14,6 +14,7 @@ import (
14
14
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
15
15
"github.com/stretchr/testify/require"
16
16
17
+ "github.com/coder/coder/v2/coderd/util/ptr"
17
18
"github.com/coder/coder/v2/codersdk"
18
19
"github.com/coder/terraform-provider-coderd/integration"
19
20
)
@@ -49,21 +50,21 @@ func TestAccTemplateDataSource(t *testing.T) {
49
50
Description :"An example template" ,
50
51
Icon :"/path/to/icon.png" ,
51
52
VersionID :version .ID ,
52
- DefaultTTLMillis :PtrTo ((10 * time .Hour ).Milliseconds ()),
53
- ActivityBumpMillis :PtrTo ((4 * time .Hour ).Milliseconds ()),
53
+ DefaultTTLMillis :ptr . Ref ((10 * time .Hour ).Milliseconds ()),
54
+ ActivityBumpMillis :ptr . Ref ((4 * time .Hour ).Milliseconds ()),
54
55
AutostopRequirement :& codersdk.TemplateAutostopRequirement {
55
56
DaysOfWeek : []string {"sunday" },
56
57
Weeks :1 ,
57
58
},
58
59
AutostartRequirement :& codersdk.TemplateAutostartRequirement {
59
60
DaysOfWeek : []string {"monday" ,"tuesday" ,"wednesday" ,"thursday" ,"friday" ,"saturday" ,"sunday" },
60
61
},
61
- AllowUserCancelWorkspaceJobs :PtrTo (true ),
62
- AllowUserAutostart :PtrTo (true ),
63
- AllowUserAutostop :PtrTo (true ),
64
- FailureTTLMillis :PtrTo ((1 * time .Hour ).Milliseconds ()),
65
- TimeTilDormantMillis :PtrTo ((7 * 24 * time .Hour ).Milliseconds ()),
66
- TimeTilDormantAutoDeleteMillis :PtrTo ((30 * 24 * time .Hour ).Milliseconds ()),
62
+ AllowUserCancelWorkspaceJobs :ptr . Ref (true ),
63
+ AllowUserAutostart :ptr . Ref (true ),
64
+ AllowUserAutostop :ptr . Ref (true ),
65
+ FailureTTLMillis :ptr . Ref ((1 * time .Hour ).Milliseconds ()),
66
+ TimeTilDormantMillis :ptr . Ref ((7 * 24 * time .Hour ).Milliseconds ()),
67
+ TimeTilDormantAutoDeleteMillis :ptr . Ref ((30 * 24 * time .Hour ).Milliseconds ()),
67
68
DisableEveryoneGroupAccess :true ,
68
69
RequireActiveVersion :true ,
69
70
})
@@ -93,9 +94,9 @@ func TestAccTemplateDataSource(t *testing.T) {
93
94
UpdateWorkspaceLastUsedAt :false ,
94
95
UpdateWorkspaceDormantAt :false ,
95
96
RequireActiveVersion :tpl .RequireActiveVersion ,
96
- DeprecationMessage :PtrTo ("This template is deprecated" ),
97
+ DeprecationMessage :ptr . Ref ("This template is deprecated" ),
97
98
DisableEveryoneGroupAccess :true ,
98
- MaxPortShareLevel :PtrTo (codersdk .WorkspaceAgentPortShareLevelOwner ),
99
+ MaxPortShareLevel :ptr . Ref (codersdk .WorkspaceAgentPortShareLevelOwner ),
99
100
})
100
101
require .NoError (t ,err )
101
102
@@ -153,8 +154,8 @@ func TestAccTemplateDataSource(t *testing.T) {
153
154
cfg := testAccTemplateDataSourceConfig {
154
155
URL :client .URL .String (),
155
156
Token :client .SessionToken (),
156
- OrganizationID :PtrTo (orgID .String ()),
157
- Name :PtrTo (tpl .Name ),
157
+ OrganizationID :ptr . Ref (orgID .String ()),
158
+ Name :ptr . Ref (tpl .Name ),
158
159
}
159
160
resource .Test (t , resource.TestCase {
160
161
IsUnitTest :true ,
@@ -173,7 +174,7 @@ func TestAccTemplateDataSource(t *testing.T) {
173
174
cfg := testAccTemplateDataSourceConfig {
174
175
URL :client .URL .String (),
175
176
Token :client .SessionToken (),
176
- ID :PtrTo (tpl .ID .String ()),
177
+ ID :ptr . Ref (tpl .ID .String ()),
177
178
}
178
179
resource .Test (t , resource.TestCase {
179
180
IsUnitTest :true ,
@@ -210,7 +211,7 @@ func TestAccTemplateDataSource(t *testing.T) {
210
211
cfg := testAccTemplateDataSourceConfig {
211
212
URL :client .URL .String (),
212
213
Token :client .SessionToken (),
213
- Name :PtrTo (tpl .Name ),
214
+ Name :ptr . Ref (tpl .Name ),
214
215
}
215
216
resource .Test (t , resource.TestCase {
216
217
IsUnitTest :true ,
@@ -250,7 +251,7 @@ data "coderd_template" "test" {
250
251
}`
251
252
252
253
funcMap := template.FuncMap {
253
- "orNull" :PrintOrNull ,
254
+ "orNull" :printOrNull ,
254
255
}
255
256
256
257
buf := strings.Builder {}