@@ -321,6 +321,13 @@ is set to MANUAL_ONLY.`,
321
321
Defaults to 1200s if not set.` ,
322
322
Default : 1200 ,
323
323
},
324
+ "tcp_time_wait_timeout_sec" : {
325
+ Type : schema .TypeInt ,
326
+ Optional : true ,
327
+ Description : `Timeout (in seconds) for TCP connections that are in TIME_WAIT state.
328
+ Defaults to 120s if not set.` ,
329
+ Default : 120 ,
330
+ },
324
331
"tcp_transitory_idle_timeout_sec" : {
325
332
Type : schema .TypeInt ,
326
333
Optional : true ,
@@ -540,6 +547,12 @@ func resourceComputeRouterNatCreate(d *schema.ResourceData, meta interface{}) er
540
547
} else if v , ok := d .GetOkExists ("tcp_transitory_idle_timeout_sec" ); ! isEmptyValue (reflect .ValueOf (tcpTransitoryIdleTimeoutSecProp )) && (ok || ! reflect .DeepEqual (v , tcpTransitoryIdleTimeoutSecProp )) {
541
548
obj ["tcpTransitoryIdleTimeoutSec" ] = tcpTransitoryIdleTimeoutSecProp
542
549
}
550
+ tcpTimeWaitTimeoutSecProp , err := expandNestedComputeRouterNatTcpTimeWaitTimeoutSec (d .Get ("tcp_time_wait_timeout_sec" ), d , config )
551
+ if err != nil {
552
+ return err
553
+ } else if v , ok := d .GetOkExists ("tcp_time_wait_timeout_sec" ); ! isEmptyValue (reflect .ValueOf (tcpTimeWaitTimeoutSecProp )) && (ok || ! reflect .DeepEqual (v , tcpTimeWaitTimeoutSecProp )) {
554
+ obj ["tcpTimeWaitTimeoutSec" ] = tcpTimeWaitTimeoutSecProp
555
+ }
543
556
logConfigProp , err := expandNestedComputeRouterNatLogConfig (d .Get ("log_config" ), d , config )
544
557
if err != nil {
545
558
return err
@@ -702,6 +715,9 @@ func resourceComputeRouterNatRead(d *schema.ResourceData, meta interface{}) erro
702
715
if err := d .Set ("tcp_transitory_idle_timeout_sec" , flattenNestedComputeRouterNatTcpTransitoryIdleTimeoutSec (res ["tcpTransitoryIdleTimeoutSec" ], d , config )); err != nil {
703
716
return fmt .Errorf ("Error reading RouterNat: %s" , err )
704
717
}
718
+ if err := d .Set ("tcp_time_wait_timeout_sec" , flattenNestedComputeRouterNatTcpTimeWaitTimeoutSec (res ["tcpTimeWaitTimeoutSec" ], d , config )); err != nil {
719
+ return fmt .Errorf ("Error reading RouterNat: %s" , err )
720
+ }
705
721
if err := d .Set ("log_config" , flattenNestedComputeRouterNatLogConfig (res ["logConfig" ], d , config )); err != nil {
706
722
return fmt .Errorf ("Error reading RouterNat: %s" , err )
707
723
}
@@ -803,6 +819,12 @@ func resourceComputeRouterNatUpdate(d *schema.ResourceData, meta interface{}) er
803
819
} else if v , ok := d .GetOkExists ("tcp_transitory_idle_timeout_sec" ); ! isEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , tcpTransitoryIdleTimeoutSecProp )) {
804
820
obj ["tcpTransitoryIdleTimeoutSec" ] = tcpTransitoryIdleTimeoutSecProp
805
821
}
822
+ tcpTimeWaitTimeoutSecProp , err := expandNestedComputeRouterNatTcpTimeWaitTimeoutSec (d .Get ("tcp_time_wait_timeout_sec" ), d , config )
823
+ if err != nil {
824
+ return err
825
+ } else if v , ok := d .GetOkExists ("tcp_time_wait_timeout_sec" ); ! isEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , tcpTimeWaitTimeoutSecProp )) {
826
+ obj ["tcpTimeWaitTimeoutSec" ] = tcpTimeWaitTimeoutSecProp
827
+ }
806
828
logConfigProp , err := expandNestedComputeRouterNatLogConfig (d .Get ("log_config" ), d , config )
807
829
if err != nil {
808
830
return err
@@ -1104,6 +1126,20 @@ func flattenNestedComputeRouterNatTcpTransitoryIdleTimeoutSec(v interface{}, d *
1104
1126
return v
1105
1127
}
1106
1128
1129
+ func flattenNestedComputeRouterNatTcpTimeWaitTimeoutSec (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1130
+ if v == nil || isEmptyValue (reflect .ValueOf (v )) {
1131
+ return 120
1132
+ }
1133
+ // Handles the string fixed64 format
1134
+ if strVal , ok := v .(string ); ok {
1135
+ if intVal , err := stringToFixed64 (strVal ); err == nil {
1136
+ return intVal
1137
+ } // let terraform core handle it if we can't convert the string to an int.
1138
+ }
1139
+
1140
+ return v
1141
+ }
1142
+
1107
1143
func flattenNestedComputeRouterNatLogConfig (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1108
1144
if v == nil {
1109
1145
return nil
@@ -1335,6 +1371,10 @@ func expandNestedComputeRouterNatTcpTransitoryIdleTimeoutSec(v interface{}, d Te
1335
1371
return v , nil
1336
1372
}
1337
1373
1374
+ func expandNestedComputeRouterNatTcpTimeWaitTimeoutSec (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1375
+ return v , nil
1376
+ }
1377
+
1338
1378
func expandNestedComputeRouterNatLogConfig (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1339
1379
l := v .([]interface {})
1340
1380
if len (l ) == 0 || l [0 ] == nil {
0 commit comments