@@ -297,6 +297,13 @@ func resourceCloudFunctionsFunction() *schema.Resource {
297
297
Description : `URL which triggers function execution. Returned only if trigger_http is used.` ,
298
298
},
299
299
300
+ "https_trigger_security_level" : {
301
+ Type : schema .TypeString ,
302
+ Optional : true ,
303
+ Computed : true ,
304
+ Description : `The security level for the function. Defaults to SECURE_OPTIONAL. Valid only if trigger_http is used.` ,
305
+ },
306
+
300
307
"max_instances" : {
301
308
Type : schema .TypeInt ,
302
309
Optional : true ,
@@ -481,6 +488,7 @@ func resourceCloudFunctionsCreate(d *schema.ResourceData, meta interface{}) erro
481
488
function .EventTrigger = expandEventTrigger (v .([]interface {}), project )
482
489
} else if v , ok := d .GetOk ("trigger_http" ); ok && v .(bool ) {
483
490
function .HttpsTrigger = & cloudfunctions.HttpsTrigger {}
491
+ function .HttpsTrigger .SecurityLevel = d .Get ("https_trigger_security_level" ).(string )
484
492
} else {
485
493
return fmt .Errorf ("One of `event_trigger` or `trigger_http` is required: " +
486
494
"You must specify a trigger when deploying a new function." )
@@ -644,6 +652,9 @@ func resourceCloudFunctionsRead(d *schema.ResourceData, meta interface{}) error
644
652
if err := d .Set ("https_trigger_url" , function .HttpsTrigger .Url ); err != nil {
645
653
return fmt .Errorf ("Error setting https_trigger_url: %s" , err )
646
654
}
655
+ if err := d .Set ("https_trigger_security_level" , function .HttpsTrigger .SecurityLevel ); err != nil {
656
+ return fmt .Errorf ("Error setting https_trigger_security_level: %s" , err )
657
+ }
647
658
}
648
659
649
660
if err := d .Set ("event_trigger" , flattenEventTrigger (function .EventTrigger )); err != nil {
@@ -780,6 +791,11 @@ func resourceCloudFunctionsUpdate(d *schema.ResourceData, meta interface{}) erro
780
791
updateMaskArr = append (updateMaskArr , "eventTrigger" , "eventTrigger.failurePolicy.retry" )
781
792
}
782
793
794
+ if d .HasChange ("https_trigger_security_level" ) {
795
+ function .HttpsTrigger .SecurityLevel = d .Get ("https_trigger_security_level" ).(string )
796
+ updateMaskArr = append (updateMaskArr , "httpsTrigger" , "httpsTrigger.securityLevel" )
797
+ }
798
+
783
799
if d .HasChange ("docker_repository" ) {
784
800
function .Runtime = d .Get ("docker_repository" ).(string )
785
801
updateMaskArr = append (updateMaskArr , "dockerRepository" )
0 commit comments