@@ -285,6 +285,72 @@ func TestAccScalewayFunction_Deploy(t *testing.T) {
285285 })
286286}
287287
288+ func TestAccScalewayFunction_HTTPOption (t * testing.T ) {
289+ tt := NewTestTools (t )
290+ defer tt .Cleanup ()
291+
292+ resource .ParallelTest (t , resource.TestCase {
293+ PreCheck : func () { testAccPreCheck (t ) },
294+ ProviderFactories : tt .ProviderFactories ,
295+ CheckDestroy : testAccCheckScalewayFunctionDestroy (tt ),
296+ Steps : []resource.TestStep {
297+ {
298+ Config : `
299+ resource scaleway_function_namespace main {}
300+
301+ resource scaleway_function main {
302+ name = "foobar"
303+ namespace_id = scaleway_function_namespace.main.id
304+ runtime = "node14"
305+ privacy = "private"
306+ handler = "handler.handle"
307+ http_option = "enabled"
308+ }
309+ ` ,
310+ Check : resource .ComposeTestCheckFunc (
311+ testAccCheckScalewayFunctionExists (tt , "scaleway_function.main" ),
312+ resource .TestCheckResourceAttr ("scaleway_function.main" , "http_option" , function .FunctionHTTPOptionEnabled .String ()),
313+ ),
314+ },
315+ {
316+ Config : `
317+ resource scaleway_function_namespace main {}
318+
319+ resource scaleway_function main {
320+ name = "foobar"
321+ namespace_id = scaleway_function_namespace.main.id
322+ runtime = "node14"
323+ privacy = "private"
324+ handler = "handler.handle"
325+ http_option = "redirected"
326+ }
327+ ` ,
328+ Check : resource .ComposeTestCheckFunc (
329+ testAccCheckScalewayFunctionExists (tt , "scaleway_function.main" ),
330+ resource .TestCheckResourceAttr ("scaleway_function.main" , "http_option" , function .FunctionHTTPOptionRedirected .String ()),
331+ ),
332+ },
333+ {
334+ Config : `
335+ resource scaleway_function_namespace main {}
336+
337+ resource scaleway_function main {
338+ name = "foobar"
339+ namespace_id = scaleway_function_namespace.main.id
340+ runtime = "node14"
341+ privacy = "private"
342+ handler = "handler.handle"
343+ }
344+ ` ,
345+ Check : resource .ComposeTestCheckFunc (
346+ testAccCheckScalewayFunctionExists (tt , "scaleway_function.main" ),
347+ resource .TestCheckResourceAttr ("scaleway_function.main" , "http_option" , function .FunctionHTTPOptionEnabled .String ()),
348+ ),
349+ },
350+ },
351+ })
352+ }
353+
288354func testAccCheckScalewayFunctionExists (tt * TestTools , n string ) resource.TestCheckFunc {
289355 return func (state * terraform.State ) error {
290356 rs , ok := state .RootModule ().Resources [n ]
0 commit comments