Up-to-date reference of API arguments for AS policy you can get at documentation portal
opentelekomcloud_as_policy_v2¶
Manages a V2 AS Policy resource within OpenTelekomCloud.
Example Usage¶
AS Recurrence Policy¶
resource "opentelekomcloud_as_policy_v2" "policy_1" {
scaling_policy_name = "policy_create"
scaling_policy_type = "RECURRENCE"
scaling_resource_id = var.as_group
scaling_resource_type = "SCALING_GROUP"
scaling_policy_action {
operation = "ADD"
percentage = 15
}
scheduled_policy {
launch_time = "10:30"
recurrence_type = "Weekly"
recurrence_value = "1,3,5"
end_time = "2040-12-31T10:30Z"
}
}
AS Alarm Policy¶
resource "opentelekomcloud_as_policy_v2" "policy_1" {
scaling_policy_name = "policy_create"
scaling_policy_type = "ALARM"
scaling_resource_id = var.as_group
scaling_resource_type = "SCALING_GROUP"
alarm_id = var.alarm_id
scaling_policy_action {
operation = "ADD"
size = 1
}
cool_down_time = 900
}
Argument Reference¶
The following arguments are supported:
scaling_policy_name- (Required) The name of the AS policy. The name can contain letters, digits, underscores(_), and hyphens(-),and cannot exceed 64 characters.scaling_resource_id- (Required) The Scaling resource ID.scaling_resource_type- (Required) Specifies the scaling resource type. Valid values are:AS group:
SCALING_GROUPBandwidth:
BANDWIDTH
scaling_policy_type- (Required) The AS policy type. The values can be:ALARM- Indicates that the scaling action is triggered by an alarm. A value is returned foralarm_id, and no value is returned forscheduled_policy.SCHEDULED- Indicates that the scaling action is triggered as scheduled. A value is returned forscheduled_policy, and no value is returned foralarm_id,recurrence_type,recurrence_value,start_time, orend_time.RECURRENCE- Indicates that the scaling action is triggered periodically. Values are returned forscheduled_policy,recurrence_type,recurrence_value,start_time, andend_time, and no value is returned foralarm_id.
alarm_id- (Optional) Specifies the alarm rule ID. This parameter is mandatory whenscaling_policy_typeis set toALARM.scheduled_policy- (Optional) Specifies the periodic or scheduled AS policy. This parameter is mandatory whenscaling_policy_typeis set toSCHEDULEDorRECURRENCE. After this parameter is specified, the value ofalarm_iddoes not take effect. Thescheduled_policystructure is documented below.scaling_policy_action- (Optional) The action of the AS policy. Thescaling_policy_actionstructure is documented below.cool_down_time- (Optional) Specifies the cooldown period (in seconds).
The scheduled_policy block supports:
launch_time- (Required) The time when the scaling action is triggered. Ifscaling_policy_typeis set toSCHEDULED, the time format isYYYY-MM-DDThh:mmZ. Ifscaling_policy_typeis set toRECURRENCE, the time format ishh:mm.recurrence_type- (Optional) The periodic triggering type. This argument is mandatory whenscaling_policy_typeis set toRECURRENCE. The options includeDaily,Weekly, andMonthly.recurrence_value- (Optional) The frequency at which scaling actions are triggered.
-> When recurrence_type is set to Daily, this parameter does not take effect.
start_time- (Optional) The start time of the scaling action triggered periodically. The time format complies with UTC. The current time is used by default. The time format isYYYY-MM-DDThh:mmZ.end_time- (Optional) The end time of the scaling action triggered periodically. The time format complies with UTC. This argument is mandatory whenscaling_policy_typeis set toRECURRENCE. The time format isYYYY-MM-DDThh:mmZ.
The scaling_policy_action block supports:
operation- (Optional) The operation to be performed.If
scaling_resource_typeis set toSCALING_GROUP, the following operations are supported:ADD: indicates adding instances.REMOVE/REDUCE: indicates removing or reducing instances.SET: indicates setting the number of instances to a specified value.
If
scaling_resource_typeis set toBANDWIDTH, the following operations are supported:ADD: indicates adding instances.REDUCE: indicates reducing instances.SET: indicates setting the number of instances to a specified value.
size- (Optional) Specifies the operation size. The value is an integer from0to300. The default value is1. This parameter can be set to0only when operation is set toSET.If
scaling_resource_typeis set toSCALING_GROUP, this parameter indicates the number of instances. The value is an integer from0to300and the default value is1.If
scaling_resource_typeis set toBANDWIDTH, this parameter indicates the bandwidth (Mbit/s). The value is an integer from1to300and the default value is1.If
scaling_resource_typeis set toSCALING_GROUP, eithersizeorpercentagecan be set.
percentage- (Optional) Specifies the percentage of instances to be operated. If operation is set toADD,REMOVE, orREDUCE, the value of this parameter is an integer from1to20000.If operation is set to
SET, the value is an integer from0to20000.If
scaling_resource_typeis set toSCALING_GROUP, eithersizeorpercentagecan be set.If neither
sizenorpercentageis set, the default value ofsizeis1.If
scaling_resource_typeis set toBANDWIDTH,percentageis unavailable.
limits- (Optional) Specifies the operation restrictions.If
scaling_resource_typeis set toBANDWIDTHand operation is notSET, this parameter takes effect and the unit isMbit/s.If operation is set to
ADD, this parameter indicates the maximum bandwidth allowed.If operation is set to
REDUCE, this parameter indicates the minimum bandwidth allowed.
Attributes Reference¶
In addition to all arguments above, the following attributes are exported:
create_time- Specifies the time when an AS policy was created. The time format complies with UTC.metadata- Provides additional information. Themetadatastructure is documented below.
The metadata block supports:
bandwidth_share_type- Specifies the bandwidth sharing type in the bandwidth scaling policy.eip_id- Specifies the EIP ID for the bandwidth in the bandwidth scaling policy.eip_address- Specifies the EIP for the bandwidth in the bandwidth scaling policy.