@@ -372,6 +372,40 @@ supplied the value is interpreted as bytes.`,
372372 Optional : true ,
373373 Description : `The binary authorization policy to be checked when deploying the Cloud Run service.` ,
374374 },
375+ "direct_vpc_egress" : {
376+ Type : schema .TypeString ,
377+ Computed : true ,
378+ Optional : true ,
379+ ValidateFunc : verify .ValidateEnum ([]string {"VPC_EGRESS_ALL_TRAFFIC" , "VPC_EGRESS_PRIVATE_RANGES_ONLY" , "" }),
380+ Description : `Egress settings for direct VPC. If not provided, it defaults to VPC_EGRESS_PRIVATE_RANGES_ONLY. Possible values: ["VPC_EGRESS_ALL_TRAFFIC", "VPC_EGRESS_PRIVATE_RANGES_ONLY"]` ,
381+ },
382+ "direct_vpc_network_interface" : {
383+ Type : schema .TypeList ,
384+ Optional : true ,
385+ Description : `The Direct VPC network interface for the Cloud Function. Currently only a single Direct VPC is supported.` ,
386+ Elem : & schema.Resource {
387+ Schema : map [string ]* schema.Schema {
388+ "network" : {
389+ Type : schema .TypeString ,
390+ Optional : true ,
391+ Description : `The name of the VPC network to which the function will be connected. Specify either a VPC network or a subnet, or both. If you specify only a network, the subnet uses the same name as the network.` ,
392+ },
393+ "subnetwork" : {
394+ Type : schema .TypeString ,
395+ Optional : true ,
396+ Description : `The name of the VPC subnetwork that the Cloud Function resource will get IPs from. Specify either a VPC network or a subnet, or both. If both network and subnetwork are specified, the given VPC subnetwork must belong to the given VPC network. If subnetwork is not specified, the subnetwork with the same name with the network will be used.` ,
397+ },
398+ "tags" : {
399+ Type : schema .TypeList ,
400+ Optional : true ,
401+ Description : `Network tags applied to this Cloud Function resource.` ,
402+ Elem : & schema.Schema {
403+ Type : schema .TypeString ,
404+ },
405+ },
406+ },
407+ },
408+ },
375409 "environment_variables" : {
376410 Type : schema .TypeMap ,
377411 Computed : true ,
@@ -1280,6 +1314,10 @@ func flattenCloudfunctions2functionServiceConfig(v interface{}, d *schema.Resour
12801314 flattenCloudfunctions2functionServiceConfigVpcConnector (original ["vpcConnector" ], d , config )
12811315 transformed ["vpc_connector_egress_settings" ] =
12821316 flattenCloudfunctions2functionServiceConfigVpcConnectorEgressSettings (original ["vpcConnectorEgressSettings" ], d , config )
1317+ transformed ["direct_vpc_network_interface" ] =
1318+ flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterface (original ["directVpcNetworkInterface" ], d , config )
1319+ transformed ["direct_vpc_egress" ] =
1320+ flattenCloudfunctions2functionServiceConfigDirectVpcEgress (original ["directVpcEgress" ], d , config )
12831321 transformed ["ingress_settings" ] =
12841322 flattenCloudfunctions2functionServiceConfigIngressSettings (original ["ingressSettings" ], d , config )
12851323 transformed ["uri" ] =
@@ -1390,6 +1428,42 @@ func flattenCloudfunctions2functionServiceConfigVpcConnectorEgressSettings(v int
13901428 return v
13911429}
13921430
1431+ func flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterface (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1432+ if v == nil {
1433+ return v
1434+ }
1435+ l := v .([]interface {})
1436+ transformed := make ([]interface {}, 0 , len (l ))
1437+ for _ , raw := range l {
1438+ original := raw .(map [string ]interface {})
1439+ if len (original ) < 1 {
1440+ // Do not include empty json objects coming back from the api
1441+ continue
1442+ }
1443+ transformed = append (transformed , map [string ]interface {}{
1444+ "network" : flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceNetwork (original ["network" ], d , config ),
1445+ "subnetwork" : flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceSubnetwork (original ["subnetwork" ], d , config ),
1446+ "tags" : flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceTags (original ["tags" ], d , config ),
1447+ })
1448+ }
1449+ return transformed
1450+ }
1451+ func flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceNetwork (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1452+ return v
1453+ }
1454+
1455+ func flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceSubnetwork (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1456+ return v
1457+ }
1458+
1459+ func flattenCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceTags (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1460+ return v
1461+ }
1462+
1463+ func flattenCloudfunctions2functionServiceConfigDirectVpcEgress (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1464+ return v
1465+ }
1466+
13931467func flattenCloudfunctions2functionServiceConfigIngressSettings (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
13941468 return v
13951469}
@@ -2062,6 +2136,20 @@ func expandCloudfunctions2functionServiceConfig(v interface{}, d tpgresource.Ter
20622136 transformed ["vpcConnectorEgressSettings" ] = transformedVpcConnectorEgressSettings
20632137 }
20642138
2139+ transformedDirectVpcNetworkInterface , err := expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterface (original ["direct_vpc_network_interface" ], d , config )
2140+ if err != nil {
2141+ return nil , err
2142+ } else if val := reflect .ValueOf (transformedDirectVpcNetworkInterface ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
2143+ transformed ["directVpcNetworkInterface" ] = transformedDirectVpcNetworkInterface
2144+ }
2145+
2146+ transformedDirectVpcEgress , err := expandCloudfunctions2functionServiceConfigDirectVpcEgress (original ["direct_vpc_egress" ], d , config )
2147+ if err != nil {
2148+ return nil , err
2149+ } else if val := reflect .ValueOf (transformedDirectVpcEgress ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
2150+ transformed ["directVpcEgress" ] = transformedDirectVpcEgress
2151+ }
2152+
20652153 transformedIngressSettings , err := expandCloudfunctions2functionServiceConfigIngressSettings (original ["ingress_settings" ], d , config )
20662154 if err != nil {
20672155 return nil , err
@@ -2168,6 +2256,61 @@ func expandCloudfunctions2functionServiceConfigVpcConnectorEgressSettings(v inte
21682256 return v , nil
21692257}
21702258
2259+ func expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterface (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
2260+ if v == nil {
2261+ return nil , nil
2262+ }
2263+ l := v .([]interface {})
2264+ req := make ([]interface {}, 0 , len (l ))
2265+ for _ , raw := range l {
2266+ if raw == nil {
2267+ continue
2268+ }
2269+ original := raw .(map [string ]interface {})
2270+ transformed := make (map [string ]interface {})
2271+
2272+ transformedNetwork , err := expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceNetwork (original ["network" ], d , config )
2273+ if err != nil {
2274+ return nil , err
2275+ } else if val := reflect .ValueOf (transformedNetwork ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
2276+ transformed ["network" ] = transformedNetwork
2277+ }
2278+
2279+ transformedSubnetwork , err := expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceSubnetwork (original ["subnetwork" ], d , config )
2280+ if err != nil {
2281+ return nil , err
2282+ } else if val := reflect .ValueOf (transformedSubnetwork ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
2283+ transformed ["subnetwork" ] = transformedSubnetwork
2284+ }
2285+
2286+ transformedTags , err := expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceTags (original ["tags" ], d , config )
2287+ if err != nil {
2288+ return nil , err
2289+ } else if val := reflect .ValueOf (transformedTags ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
2290+ transformed ["tags" ] = transformedTags
2291+ }
2292+
2293+ req = append (req , transformed )
2294+ }
2295+ return req , nil
2296+ }
2297+
2298+ func expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceNetwork (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
2299+ return v , nil
2300+ }
2301+
2302+ func expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceSubnetwork (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
2303+ return v , nil
2304+ }
2305+
2306+ func expandCloudfunctions2functionServiceConfigDirectVpcNetworkInterfaceTags (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
2307+ return v , nil
2308+ }
2309+
2310+ func expandCloudfunctions2functionServiceConfigDirectVpcEgress (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
2311+ return v , nil
2312+ }
2313+
21712314func expandCloudfunctions2functionServiceConfigIngressSettings (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
21722315 return v , nil
21732316}
0 commit comments