@@ -142,6 +142,16 @@ CIDR-formatted string.`,
142142 },
143143 },
144144 },
145+ "keepalive_interval" : {
146+ Type : schema .TypeInt ,
147+ Optional : true ,
148+ Description : `The interval in seconds between BGP keepalive messages that are sent to the peer.
149+ Hold time is three times the interval at which keepalive messages are sent, and the hold time is the
150+ maximum number of seconds allowed to elapse between successive keepalive messages that BGP receives from a peer.
151+ BGP will use the smaller of either the local hold time value or the peer's hold time value as the hold time for
152+ the BGP connection between the two peers. If set, this value must be between 20 and 60. The default is 20.` ,
153+ Default : 20 ,
154+ },
145155 },
146156 },
147157 },
@@ -523,6 +533,8 @@ func flattenComputeRouterBgp(v interface{}, d *schema.ResourceData, config *Conf
523533 flattenComputeRouterBgpAdvertisedGroups (original ["advertisedGroups" ], d , config )
524534 transformed ["advertised_ip_ranges" ] =
525535 flattenComputeRouterBgpAdvertisedIpRanges (original ["advertisedIpRanges" ], d , config )
536+ transformed ["keepalive_interval" ] =
537+ flattenComputeRouterBgpKeepaliveInterval (original ["keepaliveInterval" ], d , config )
526538 return []interface {}{transformed }
527539}
528540func flattenComputeRouterBgpAsn (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
@@ -577,6 +589,23 @@ func flattenComputeRouterBgpAdvertisedIpRangesDescription(v interface{}, d *sche
577589 return v
578590}
579591
592+ func flattenComputeRouterBgpKeepaliveInterval (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
593+ // Handles the string fixed64 format
594+ if strVal , ok := v .(string ); ok {
595+ if intVal , err := stringToFixed64 (strVal ); err == nil {
596+ return intVal
597+ }
598+ }
599+
600+ // number values are represented as float64
601+ if floatVal , ok := v .(float64 ); ok {
602+ intVal := int (floatVal )
603+ return intVal
604+ }
605+
606+ return v // let terraform core handle it otherwise
607+ }
608+
580609func flattenComputeRouterEncryptedInterconnectRouter (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
581610 return v
582611}
@@ -641,6 +670,13 @@ func expandComputeRouterBgp(v interface{}, d TerraformResourceData, config *Conf
641670 transformed ["advertisedIpRanges" ] = transformedAdvertisedIpRanges
642671 }
643672
673+ transformedKeepaliveInterval , err := expandComputeRouterBgpKeepaliveInterval (original ["keepalive_interval" ], d , config )
674+ if err != nil {
675+ return nil , err
676+ } else if val := reflect .ValueOf (transformedKeepaliveInterval ); val .IsValid () && ! isEmptyValue (val ) {
677+ transformed ["keepaliveInterval" ] = transformedKeepaliveInterval
678+ }
679+
644680 return transformed , nil
645681}
646682
@@ -693,6 +729,10 @@ func expandComputeRouterBgpAdvertisedIpRangesDescription(v interface{}, d Terraf
693729 return v , nil
694730}
695731
732+ func expandComputeRouterBgpKeepaliveInterval (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
733+ return v , nil
734+ }
735+
696736func expandComputeRouterEncryptedInterconnectRouter (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
697737 return v , nil
698738}
0 commit comments