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

Commit558b6a4

Browse files
feat: add 'hidden' field to 'coder_app' provider
1 parent286841d commit558b6a4

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

‎provider/app.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ func appResource() *schema.Resource {
187187
ForceNew:true,
188188
Optional:true,
189189
},
190+
"hidden": {
191+
Type:schema.TypeBool,
192+
Description:"Determines if the app is visible in the UI.",
193+
Default:false,
194+
ForceNew:true,
195+
Optional:true,
196+
},
190197
},
191198
}
192199
}

‎provider/app_test.go

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func TestApp(t *testing.T) {
4545
threshold = 6
4646
}
4747
order = 4
48+
hidden = false
4849
}
4950
`,
5051
Check:func(state*terraform.State)error {
@@ -66,6 +67,7 @@ func TestApp(t *testing.T) {
6667
"healthcheck.0.interval",
6768
"healthcheck.0.threshold",
6869
"order",
70+
"hidden",
6971
} {
7072
value:=resource.Primary.Attributes[key]
7173
t.Logf("%q = %q",key,value)
@@ -246,4 +248,75 @@ func TestApp(t *testing.T) {
246248
})
247249
}
248250
})
251+
252+
t.Run("Hidden",func(t*testing.T) {
253+
t.Parallel()
254+
255+
cases:= []struct {
256+
namestring
257+
configstring
258+
hiddenbool
259+
}{{
260+
name:"Is Hidden",
261+
config:`
262+
provider "coder" {}
263+
resource "coder_agent" "dev" {
264+
os = "linux"
265+
arch = "amd64"
266+
}
267+
resource "coder_app" "test" {
268+
agent_id = coder_agent.dev.id
269+
slug = "test"
270+
display_name = "Testing"
271+
url = "https://google.com"
272+
external = true
273+
hidden = true
274+
}
275+
`,
276+
hidden:true,
277+
}, {
278+
name:"Is Not Hidden",
279+
config:`
280+
provider "coder" {}
281+
resource "coder_agent" "dev" {
282+
os = "linux"
283+
arch = "amd64"
284+
}
285+
resource "coder_app" "test" {
286+
agent_id = coder_agent.dev.id
287+
slug = "test"
288+
display_name = "Testing"
289+
url = "https://google.com"
290+
external = true
291+
hidden = false
292+
}
293+
`,
294+
hidden:false,
295+
}}
296+
for_,tc:=rangecases {
297+
tc:=tc
298+
t.Run(tc.name,func(t*testing.T) {
299+
t.Parallel()
300+
resource.Test(t, resource.TestCase{
301+
Providers:map[string]*schema.Provider{
302+
"coder":provider.New(),
303+
},
304+
IsUnitTest:true,
305+
Steps: []resource.TestStep{{
306+
Config:tc.config,
307+
Check:func(state*terraform.State)error {
308+
require.Len(t,state.Modules,1)
309+
require.Len(t,state.Modules[0].Resources,2)
310+
resource:=state.Modules[0].Resources["coder_app.test"]
311+
require.NotNil(t,resource)
312+
require.Equal(t,strconv.FormatBool(tc.hidden),resource.Primary.Attributes["hidden"])
313+
returnnil
314+
},
315+
ExpectError:nil,
316+
}},
317+
})
318+
})
319+
}
320+
})
321+
249322
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp