@@ -167,62 +167,6 @@ be a positive float value. If not defined, the default is 0.8.`,
167
167
The metric cannot have negative values.
168
168
169
169
The metric must have a value type of INT64 or DOUBLE.` ,
170
- },
171
- "filter" : {
172
- Type : schema .TypeString ,
173
- Optional : true ,
174
- Description : `A filter string to be used as the filter string for
175
- a Stackdriver Monitoring TimeSeries.list API call.
176
- This filter is used to select a specific TimeSeries for
177
- the purpose of autoscaling and to determine whether the metric
178
- is exporting per-instance or per-group data.
179
-
180
- You can only use the AND operator for joining selectors.
181
- You can only use direct equality comparison operator (=) without
182
- any functions for each selector.
183
- You can specify the metric in both the filter string and in the
184
- metric field. However, if specified in both places, the metric must
185
- be identical.
186
-
187
- The monitored resource type determines what kind of values are
188
- expected for the metric. If it is a gce_instance, the autoscaler
189
- expects the metric to include a separate TimeSeries for each
190
- instance in a group. In such a case, you cannot filter on resource
191
- labels.
192
-
193
- If the resource type is any other value, the autoscaler expects
194
- this metric to contain values that apply to the entire autoscaled
195
- instance group and resource label filtering can be performed to
196
- point autoscaler at the correct TimeSeries to scale upon.
197
- This is called a per-group metric for the purpose of autoscaling.
198
-
199
- If not specified, the type defaults to gce_instance.
200
-
201
- You should provide a filter that is selective enough to pick just
202
- one TimeSeries for the autoscaled group or for each of the instances
203
- (if you are using gce_instance resource type). If multiple
204
- TimeSeries are returned upon the query execution, the autoscaler
205
- will sum their respective values to obtain its scaling value.` ,
206
- },
207
- "single_instance_assignment" : {
208
- Type : schema .TypeFloat ,
209
- Optional : true ,
210
- Description : `If scaling is based on a per-group metric value that represents the
211
- total amount of work to be done or resource usage, set this value to
212
- an amount assigned for a single instance of the scaled group.
213
- The autoscaler will keep the number of instances proportional to the
214
- value of this metric, the metric itself should not change value due
215
- to group resizing.
216
-
217
- For example, a good metric to use with the target is
218
- 'pubsub.googleapis.com/subscription/num_undelivered_messages'
219
- or a custom metric exporting the total number of requests coming to
220
- your instances.
221
-
222
- A bad example would be a metric exporting an average or median
223
- latency, since this value can't include a chunk assignable to a
224
- single instance, it could be better used with utilization_target
225
- instead.` ,
226
170
},
227
171
"target" : {
228
172
Type : schema .TypeFloat ,
@@ -253,49 +197,6 @@ Stackdriver Monitoring metric. Possible values: ["GAUGE", "DELTA_PER_SECOND", "D
253
197
Description : `Defines operating mode for this policy.` ,
254
198
Default : "ON" ,
255
199
},
256
- "scale_down_control" : {
257
- Type : schema .TypeList ,
258
- Optional : true ,
259
- Description : `Defines scale down controls to reduce the risk of response latency
260
- and outages due to abrupt scale-in events` ,
261
- MaxItems : 1 ,
262
- Elem : & schema.Resource {
263
- Schema : map [string ]* schema.Schema {
264
- "max_scaled_down_replicas" : {
265
- Type : schema .TypeList ,
266
- Optional : true ,
267
- Description : `A nested object resource` ,
268
- MaxItems : 1 ,
269
- Elem : & schema.Resource {
270
- Schema : map [string ]* schema.Schema {
271
- "fixed" : {
272
- Type : schema .TypeInt ,
273
- Optional : true ,
274
- Description : `Specifies a fixed number of VM instances. This must be a positive
275
- integer.` ,
276
- AtLeastOneOf : []string {"autoscaling_policy.0.scale_down_control.0.max_scaled_down_replicas.0.fixed" , "autoscaling_policy.0.scale_down_control.0.max_scaled_down_replicas.0.percent" },
277
- },
278
- "percent" : {
279
- Type : schema .TypeInt ,
280
- Optional : true ,
281
- Description : `Specifies a percentage of instances between 0 to 100%, inclusive.
282
- For example, specify 80 for 80%.` ,
283
- AtLeastOneOf : []string {"autoscaling_policy.0.scale_down_control.0.max_scaled_down_replicas.0.fixed" , "autoscaling_policy.0.scale_down_control.0.max_scaled_down_replicas.0.percent" },
284
- },
285
- },
286
- },
287
- AtLeastOneOf : []string {"autoscaling_policy.0.scale_down_control.0.max_scaled_down_replicas" , "autoscaling_policy.0.scale_down_control.0.time_window_sec" },
288
- },
289
- "time_window_sec" : {
290
- Type : schema .TypeInt ,
291
- Optional : true ,
292
- Description : `How long back autoscaling should look when computing recommendations
293
- to include directives regarding slower scale down, as described above.` ,
294
- AtLeastOneOf : []string {"autoscaling_policy.0.scale_down_control.0.max_scaled_down_replicas" , "autoscaling_policy.0.scale_down_control.0.time_window_sec" },
295
- },
296
- },
297
- },
298
- },
299
200
"scale_in_control" : {
300
201
Type : schema .TypeList ,
301
202
Optional : true ,
@@ -789,8 +690,6 @@ func flattenComputeRegionAutoscalerAutoscalingPolicy(v interface{}, d *schema.Re
789
690
flattenComputeRegionAutoscalerAutoscalingPolicyCooldownPeriod (original ["coolDownPeriodSec" ], d , config )
790
691
transformed ["mode" ] =
791
692
flattenComputeRegionAutoscalerAutoscalingPolicyMode (original ["mode" ], d , config )
792
- transformed ["scale_down_control" ] =
793
- flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControl (original ["scaleDownControl" ], d , config )
794
693
transformed ["scale_in_control" ] =
795
694
flattenComputeRegionAutoscalerAutoscalingPolicyScaleInControl (original ["scaleInControl" ], d , config )
796
695
transformed ["cpu_utilization" ] =
@@ -858,87 +757,6 @@ func flattenComputeRegionAutoscalerAutoscalingPolicyMode(v interface{}, d *schem
858
757
return v
859
758
}
860
759
861
- func flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControl (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
862
- if v == nil {
863
- return nil
864
- }
865
- original := v .(map [string ]interface {})
866
- if len (original ) == 0 {
867
- return nil
868
- }
869
- transformed := make (map [string ]interface {})
870
- transformed ["max_scaled_down_replicas" ] =
871
- flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicas (original ["maxScaledDownReplicas" ], d , config )
872
- transformed ["time_window_sec" ] =
873
- flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlTimeWindowSec (original ["timeWindowSec" ], d , config )
874
- return []interface {}{transformed }
875
- }
876
- func flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicas (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
877
- if v == nil {
878
- return nil
879
- }
880
- original := v .(map [string ]interface {})
881
- if len (original ) == 0 {
882
- return nil
883
- }
884
- transformed := make (map [string ]interface {})
885
- transformed ["fixed" ] =
886
- flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasFixed (original ["fixed" ], d , config )
887
- transformed ["percent" ] =
888
- flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasPercent (original ["percent" ], d , config )
889
- return []interface {}{transformed }
890
- }
891
- func flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasFixed (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
892
- // Handles the string fixed64 format
893
- if strVal , ok := v .(string ); ok {
894
- if intVal , err := tpgresource .StringToFixed64 (strVal ); err == nil {
895
- return intVal
896
- }
897
- }
898
-
899
- // number values are represented as float64
900
- if floatVal , ok := v .(float64 ); ok {
901
- intVal := int (floatVal )
902
- return intVal
903
- }
904
-
905
- return v // let terraform core handle it otherwise
906
- }
907
-
908
- func flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasPercent (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
909
- // Handles the string fixed64 format
910
- if strVal , ok := v .(string ); ok {
911
- if intVal , err := tpgresource .StringToFixed64 (strVal ); err == nil {
912
- return intVal
913
- }
914
- }
915
-
916
- // number values are represented as float64
917
- if floatVal , ok := v .(float64 ); ok {
918
- intVal := int (floatVal )
919
- return intVal
920
- }
921
-
922
- return v // let terraform core handle it otherwise
923
- }
924
-
925
- func flattenComputeRegionAutoscalerAutoscalingPolicyScaleDownControlTimeWindowSec (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
926
- // Handles the string fixed64 format
927
- if strVal , ok := v .(string ); ok {
928
- if intVal , err := tpgresource .StringToFixed64 (strVal ); err == nil {
929
- return intVal
930
- }
931
- }
932
-
933
- // number values are represented as float64
934
- if floatVal , ok := v .(float64 ); ok {
935
- intVal := int (floatVal )
936
- return intVal
937
- }
938
-
939
- return v // let terraform core handle it otherwise
940
- }
941
-
942
760
func flattenComputeRegionAutoscalerAutoscalingPolicyScaleInControl (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
943
761
if v == nil {
944
762
return nil
@@ -1060,11 +878,9 @@ func flattenComputeRegionAutoscalerAutoscalingPolicyMetric(v interface{}, d *sch
1060
878
continue
1061
879
}
1062
880
transformed = append (transformed , map [string ]interface {}{
1063
- "name" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricName (original ["metric" ], d , config ),
1064
- "single_instance_assignment" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricSingleInstanceAssignment (original ["singleInstanceAssignment" ], d , config ),
1065
- "target" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricTarget (original ["utilizationTarget" ], d , config ),
1066
- "type" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricType (original ["utilizationTargetType" ], d , config ),
1067
- "filter" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricFilter (original ["filter" ], d , config ),
881
+ "name" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricName (original ["metric" ], d , config ),
882
+ "target" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricTarget (original ["utilizationTarget" ], d , config ),
883
+ "type" : flattenComputeRegionAutoscalerAutoscalingPolicyMetricType (original ["utilizationTargetType" ], d , config ),
1068
884
})
1069
885
}
1070
886
return transformed
@@ -1073,10 +889,6 @@ func flattenComputeRegionAutoscalerAutoscalingPolicyMetricName(v interface{}, d
1073
889
return v
1074
890
}
1075
891
1076
- func flattenComputeRegionAutoscalerAutoscalingPolicyMetricSingleInstanceAssignment (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1077
- return v
1078
- }
1079
-
1080
892
func flattenComputeRegionAutoscalerAutoscalingPolicyMetricTarget (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1081
893
return v
1082
894
}
@@ -1085,10 +897,6 @@ func flattenComputeRegionAutoscalerAutoscalingPolicyMetricType(v interface{}, d
1085
897
return v
1086
898
}
1087
899
1088
- func flattenComputeRegionAutoscalerAutoscalingPolicyMetricFilter (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1089
- return v
1090
- }
1091
-
1092
900
func flattenComputeRegionAutoscalerAutoscalingPolicyLoadBalancingUtilization (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1093
901
if v == nil {
1094
902
return nil
@@ -1225,13 +1033,6 @@ func expandComputeRegionAutoscalerAutoscalingPolicy(v interface{}, d tpgresource
1225
1033
transformed ["mode" ] = transformedMode
1226
1034
}
1227
1035
1228
- transformedScaleDownControl , err := expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControl (original ["scale_down_control" ], d , config )
1229
- if err != nil {
1230
- return nil , err
1231
- } else if val := reflect .ValueOf (transformedScaleDownControl ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1232
- transformed ["scaleDownControl" ] = transformedScaleDownControl
1233
- }
1234
-
1235
1036
transformedScaleInControl , err := expandComputeRegionAutoscalerAutoscalingPolicyScaleInControl (original ["scale_in_control" ], d , config )
1236
1037
if err != nil {
1237
1038
return nil , err
@@ -1286,70 +1087,6 @@ func expandComputeRegionAutoscalerAutoscalingPolicyMode(v interface{}, d tpgreso
1286
1087
return v , nil
1287
1088
}
1288
1089
1289
- func expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControl (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1290
- l := v .([]interface {})
1291
- if len (l ) == 0 || l [0 ] == nil {
1292
- return nil , nil
1293
- }
1294
- raw := l [0 ]
1295
- original := raw .(map [string ]interface {})
1296
- transformed := make (map [string ]interface {})
1297
-
1298
- transformedMaxScaledDownReplicas , err := expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicas (original ["max_scaled_down_replicas" ], d , config )
1299
- if err != nil {
1300
- return nil , err
1301
- } else if val := reflect .ValueOf (transformedMaxScaledDownReplicas ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1302
- transformed ["maxScaledDownReplicas" ] = transformedMaxScaledDownReplicas
1303
- }
1304
-
1305
- transformedTimeWindowSec , err := expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlTimeWindowSec (original ["time_window_sec" ], d , config )
1306
- if err != nil {
1307
- return nil , err
1308
- } else if val := reflect .ValueOf (transformedTimeWindowSec ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1309
- transformed ["timeWindowSec" ] = transformedTimeWindowSec
1310
- }
1311
-
1312
- return transformed , nil
1313
- }
1314
-
1315
- func expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicas (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1316
- l := v .([]interface {})
1317
- if len (l ) == 0 || l [0 ] == nil {
1318
- return nil , nil
1319
- }
1320
- raw := l [0 ]
1321
- original := raw .(map [string ]interface {})
1322
- transformed := make (map [string ]interface {})
1323
-
1324
- transformedFixed , err := expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasFixed (original ["fixed" ], d , config )
1325
- if err != nil {
1326
- return nil , err
1327
- } else if val := reflect .ValueOf (transformedFixed ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1328
- transformed ["fixed" ] = transformedFixed
1329
- }
1330
-
1331
- transformedPercent , err := expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasPercent (original ["percent" ], d , config )
1332
- if err != nil {
1333
- return nil , err
1334
- } else if val := reflect .ValueOf (transformedPercent ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1335
- transformed ["percent" ] = transformedPercent
1336
- }
1337
-
1338
- return transformed , nil
1339
- }
1340
-
1341
- func expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasFixed (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1342
- return v , nil
1343
- }
1344
-
1345
- func expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlMaxScaledDownReplicasPercent (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1346
- return v , nil
1347
- }
1348
-
1349
- func expandComputeRegionAutoscalerAutoscalingPolicyScaleDownControlTimeWindowSec (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1350
- return v , nil
1351
- }
1352
-
1353
1090
func expandComputeRegionAutoscalerAutoscalingPolicyScaleInControl (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1354
1091
l := v .([]interface {})
1355
1092
if len (l ) == 0 || l [0 ] == nil {
@@ -1465,13 +1202,6 @@ func expandComputeRegionAutoscalerAutoscalingPolicyMetric(v interface{}, d tpgre
1465
1202
transformed ["metric" ] = transformedName
1466
1203
}
1467
1204
1468
- transformedSingleInstanceAssignment , err := expandComputeRegionAutoscalerAutoscalingPolicyMetricSingleInstanceAssignment (original ["single_instance_assignment" ], d , config )
1469
- if err != nil {
1470
- return nil , err
1471
- } else if val := reflect .ValueOf (transformedSingleInstanceAssignment ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1472
- transformed ["singleInstanceAssignment" ] = transformedSingleInstanceAssignment
1473
- }
1474
-
1475
1205
transformedTarget , err := expandComputeRegionAutoscalerAutoscalingPolicyMetricTarget (original ["target" ], d , config )
1476
1206
if err != nil {
1477
1207
return nil , err
@@ -1486,13 +1216,6 @@ func expandComputeRegionAutoscalerAutoscalingPolicyMetric(v interface{}, d tpgre
1486
1216
transformed ["utilizationTargetType" ] = transformedType
1487
1217
}
1488
1218
1489
- transformedFilter , err := expandComputeRegionAutoscalerAutoscalingPolicyMetricFilter (original ["filter" ], d , config )
1490
- if err != nil {
1491
- return nil , err
1492
- } else if val := reflect .ValueOf (transformedFilter ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1493
- transformed ["filter" ] = transformedFilter
1494
- }
1495
-
1496
1219
req = append (req , transformed )
1497
1220
}
1498
1221
return req , nil
@@ -1502,10 +1225,6 @@ func expandComputeRegionAutoscalerAutoscalingPolicyMetricName(v interface{}, d t
1502
1225
return v , nil
1503
1226
}
1504
1227
1505
- func expandComputeRegionAutoscalerAutoscalingPolicyMetricSingleInstanceAssignment (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1506
- return v , nil
1507
- }
1508
-
1509
1228
func expandComputeRegionAutoscalerAutoscalingPolicyMetricTarget (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1510
1229
return v , nil
1511
1230
}
@@ -1514,10 +1233,6 @@ func expandComputeRegionAutoscalerAutoscalingPolicyMetricType(v interface{}, d t
1514
1233
return v , nil
1515
1234
}
1516
1235
1517
- func expandComputeRegionAutoscalerAutoscalingPolicyMetricFilter (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1518
- return v , nil
1519
- }
1520
-
1521
1236
func expandComputeRegionAutoscalerAutoscalingPolicyLoadBalancingUtilization (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1522
1237
l := v .([]interface {})
1523
1238
if len (l ) == 0 || l [0 ] == nil {
0 commit comments