-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provider/aws: Add docs for autoscaling_policy + cloudwatch_metric_alarm
- Loading branch information
1 parent
05f4b9b
commit 14f4e5f
Showing
5 changed files
with
137 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
website/source/docs/providers/aws/r/autoscaling_policy.html.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
layout: "aws" | ||
page_title: "AWS: aws_autoscaling_policy" | ||
sidebar_current: "docs-aws-resource-autoscaling-policy" | ||
description: |- | ||
Provides an AutoScaling Scaling Group resource. | ||
--- | ||
|
||
# aws\_autoscaling\_policy | ||
|
||
Provides an AutoScaling Scaling Policy resource. | ||
|
||
~> **NOTE:** You may want to omit `desired_capacity` attribute from attached `aws_autoscaling_group` | ||
when using autoscaling policies. It's good practice to pick either | ||
[manual](http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-manual-scaling.html) | ||
or [dynamic](http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-scale-based-on-demand.html) | ||
(policy-based) scaling. | ||
|
||
## Example Usage | ||
``` | ||
resource "aws_autoscaling_policy" "bat" { | ||
name = "foobar3-terraform-test" | ||
scaling_adjustment = 4 | ||
adjustment_type = "ChangeInCapacity" | ||
cooldown = 300 | ||
autoscaling_group_name = "${aws_autoscaling_group.bar.name}" | ||
} | ||
resource "aws_autoscaling_group" "bar" { | ||
availability_zones = ["us-east-1a"] | ||
name = "foobar3-terraform-test" | ||
max_size = 5 | ||
min_size = 2 | ||
health_check_grace_period = 300 | ||
health_check_type = "ELB" | ||
force_delete = true | ||
launch_configuration = "${aws_launch_configuration.foo.name}" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `name` - (Required) The name of the policy. | ||
* `autoscaling_group_name` - (Required) The name or ARN of the group. | ||
* `adjustment_type` - (Required) Specifies whether the `scaling_adjustment` is an absolute number or a percentage of the current capacity. Valid values are `ChangeInCapacity`, `ExactCapacity`, and `PercentChangeInCapacity`. | ||
* `scaling_adjustment` - (Required) The number of instances by which to scale. `adjustment_type` determines the interpretation of this number (e.g., as an absolute number or as a percentage of the existing Auto Scaling group size). A positive increment adds to the current capacity and a negative value removes from the current capacity. | ||
* `cooldown` - (Optional) The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. | ||
* `min_adjustment_step` - (Optional) Used with `adjustment_type` with the value `PercentChangeInCapacity`, the scaling policy changes the `desired_capacity` of the Auto Scaling group by at least the number of instances specified in the value. | ||
|
||
## Attribute Reference | ||
* `arn` - The ARN assigned by AWS to the scaling policy. |
75 changes: 75 additions & 0 deletions
75
website/source/docs/providers/aws/r/cloudwatch_metric_alarm.html.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
layout: "aws" | ||
page_title: "AWS: cloudwatch_metric_alarm" | ||
sidebar_current: "docs-aws-resource-cloudwatch-metric-alarm" | ||
description: |- | ||
Provides an AutoScaling Scaling Group resource. | ||
--- | ||
|
||
# aws\_cloudwatch\_metric\_alarm | ||
|
||
Provides a CloudWatch Metric Alarm resource. | ||
|
||
## Example Usage | ||
``` | ||
resource "aws_cloudwatch_metric_alarm" "foobar" { | ||
alarm_name = "terraform-test-foobar5" | ||
comparison_operator = "GreaterThanOrEqualToThreshold" | ||
evaluation_periods = "2" | ||
metric_name = "CPUUtilization" | ||
namespace = "AWS/EC2" | ||
period = "120" | ||
statistic = "Average" | ||
threshold = "80" | ||
alarm_description = "This metric monitor ec2 cpu utilization" | ||
insufficient_data_actions = [] | ||
} | ||
``` | ||
|
||
## Example in Conjuction with Scaling Policies | ||
``` | ||
resource "aws_autoscaling_policy" "bat" { | ||
name = "foobar3-terraform-test" | ||
scaling_adjustment = 4 | ||
adjustment_type = "ChangeInCapacity" | ||
cooldown = 300 | ||
autoscaling_group_name = "${aws_autoscaling_group.bar.name}" | ||
} | ||
resource "aws_cloudwatch_metric_alarm" "bat" { | ||
alarm_name = "terraform-test-foobar5" | ||
comparison_operator = "GreaterThanOrEqualToThreshold" | ||
evaluation_periods = "2" | ||
metric_name = "CPUUtilization" | ||
namespace = "AWS/EC2" | ||
period = "120" | ||
statistic = "Average" | ||
threshold = "80" | ||
alarm_description = "This metric monitor ec2 cpu utilization" | ||
alarm_actions = ["${aws_autoscaling_policy.bat.arn}"] | ||
} | ||
``` | ||
## Argument Reference | ||
|
||
See [related part of AWS Docs](http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricAlarm.html) | ||
for details about valid values. | ||
|
||
The following arguments are supported: | ||
|
||
* `alarm_name` - (Required) The descriptive name for the alarm. This name must be unique within the user's AWS account | ||
* `comparison_operator` - (Required) The arithmetic operation to use when comparing the specified Statistic and Threshold. The specified Statistic value is used as the first operand. Either of the following is supported: `GreaterThanOrEqualToThreshold`, `GreaterThanThreshold`, `LessThanThreshold`, `LessThanOrEqualToThreshold`. | ||
* `evaluation_periods` - (Required) The number of periods over which data is compared to the specified threshold. | ||
* `metric_name` - (Required) The name for the alarm's associated metric. | ||
See docs for [supported metrics]([valid metrics](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html)). | ||
* `namespace` - (Required) The namespace for the alarm's associated metric. | ||
* `period` - (Required) The period in seconds over which the specified `statistic` is applied. | ||
* `statistic` - (Required) The statistic to apply to the alarm's associated metric. | ||
Either of the following is supported: `SampleCount`, `Average`, `Sum`, `Minimum`, `Maximum` | ||
* `threshold` - (Required) The value against which the specified statistic is compared. | ||
* `actions_enabled` - (Optional) Indicates whether or not actions should be executed during any changes to the alarm's state. Defaults to `true`. | ||
* `alarm_actions` - (Optional) The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Number (ARN). | ||
* `alarm_description` - (Optional) The description for the alarm. | ||
* `dimensions` - (Optional) The dimensions for the alarm's associated metric. | ||
* `insufficient_data_actions` - (Optional) The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Number (ARN). | ||
* `ok_actions` - (Optional) The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Number (ARN). | ||
* `unit` - (Optional) The unit for the alarm's associated metric. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters