@@ -811,7 +811,25 @@ If logging is enabled, logs will be exported to Stackdriver.`,
811811 Type : schema .TypeBool ,
812812 Optional : true ,
813813 Description : `Whether to enable logging for the load balancer traffic served by this backend service.` ,
814- AtLeastOneOf : []string {"log_config.0.enable" , "log_config.0.sample_rate" },
814+ AtLeastOneOf : []string {"log_config.0.enable" , "log_config.0.sample_rate" , "log_config.0.optional_mode" },
815+ },
816+ "optional_fields" : {
817+ Type : schema .TypeList ,
818+ Computed : true ,
819+ Optional : true ,
820+ Description : `Specifies the fields to include in logging. This field can only be specified if logging is enabled for this backend service.` ,
821+ Elem : & schema.Schema {
822+ Type : schema .TypeString ,
823+ },
824+ },
825+ "optional_mode" : {
826+ Type : schema .TypeString ,
827+ Computed : true ,
828+ Optional : true ,
829+ ValidateFunc : verify .ValidateEnum ([]string {"INCLUDE_ALL_OPTIONAL" , "EXCLUDE_ALL_OPTIONAL" , "CUSTOM" , "" }),
830+ Description : `Specifies the optional logging mode for the load balancer traffic.
831+ Supported values: INCLUDE_ALL_OPTIONAL, EXCLUDE_ALL_OPTIONAL, CUSTOM. Possible values: ["INCLUDE_ALL_OPTIONAL", "EXCLUDE_ALL_OPTIONAL", "CUSTOM"]` ,
832+ AtLeastOneOf : []string {"log_config.0.enable" , "log_config.0.sample_rate" , "log_config.0.optional_mode" },
815833 },
816834 "sample_rate" : {
817835 Type : schema .TypeFloat ,
@@ -822,7 +840,7 @@ the field must be in [0, 1]. This configures the sampling rate of requests to th
822840where 1.0 means all logged requests are reported and 0.0 means no logged requests are reported.
823841The default value is 1.0.` ,
824842 Default : 1.0 ,
825- AtLeastOneOf : []string {"log_config.0.enable" , "log_config.0.sample_rate" },
843+ AtLeastOneOf : []string {"log_config.0.enable" , "log_config.0.sample_rate" , "log_config.0.optional_mode" },
826844 },
827845 },
828846 },
@@ -3408,6 +3426,10 @@ func flattenComputeRegionBackendServiceLogConfig(v interface{}, d *schema.Resour
34083426 flattenComputeRegionBackendServiceLogConfigEnable (original ["enable" ], d , config )
34093427 transformed ["sample_rate" ] =
34103428 flattenComputeRegionBackendServiceLogConfigSampleRate (original ["sampleRate" ], d , config )
3429+ transformed ["optional_mode" ] =
3430+ flattenComputeRegionBackendServiceLogConfigOptionalMode (original ["optionalMode" ], d , config )
3431+ transformed ["optional_fields" ] =
3432+ flattenComputeRegionBackendServiceLogConfigOptionalFields (original ["optionalFields" ], d , config )
34113433 return []interface {}{transformed }
34123434}
34133435func flattenComputeRegionBackendServiceLogConfigEnable (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
@@ -3418,6 +3440,14 @@ func flattenComputeRegionBackendServiceLogConfigSampleRate(v interface{}, d *sch
34183440 return v
34193441}
34203442
3443+ func flattenComputeRegionBackendServiceLogConfigOptionalMode (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3444+ return v
3445+ }
3446+
3447+ func flattenComputeRegionBackendServiceLogConfigOptionalFields (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
3448+ return v
3449+ }
3450+
34213451func flattenComputeRegionBackendServiceNetwork (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
34223452 if v == nil {
34233453 return v
@@ -4654,6 +4684,20 @@ func expandComputeRegionBackendServiceLogConfig(v interface{}, d tpgresource.Ter
46544684 transformed ["sampleRate" ] = transformedSampleRate
46554685 }
46564686
4687+ transformedOptionalMode , err := expandComputeRegionBackendServiceLogConfigOptionalMode (original ["optional_mode" ], d , config )
4688+ if err != nil {
4689+ return nil , err
4690+ } else if val := reflect .ValueOf (transformedOptionalMode ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
4691+ transformed ["optionalMode" ] = transformedOptionalMode
4692+ }
4693+
4694+ transformedOptionalFields , err := expandComputeRegionBackendServiceLogConfigOptionalFields (original ["optional_fields" ], d , config )
4695+ if err != nil {
4696+ return nil , err
4697+ } else if val := reflect .ValueOf (transformedOptionalFields ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
4698+ transformed ["optionalFields" ] = transformedOptionalFields
4699+ }
4700+
46574701 return transformed , nil
46584702}
46594703
@@ -4665,6 +4709,14 @@ func expandComputeRegionBackendServiceLogConfigSampleRate(v interface{}, d tpgre
46654709 return v , nil
46664710}
46674711
4712+ func expandComputeRegionBackendServiceLogConfigOptionalMode (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
4713+ return v , nil
4714+ }
4715+
4716+ func expandComputeRegionBackendServiceLogConfigOptionalFields (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
4717+ return v , nil
4718+ }
4719+
46684720func expandComputeRegionBackendServiceNetwork (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
46694721 f , err := tpgresource .ParseGlobalFieldValue ("networks" , v .(string ), "project" , d , config , true )
46704722 if err != nil {
0 commit comments