mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-28 23:02:12 +03:00
demo-15 updates
This commit is contained in:
@@ -18,7 +18,7 @@ resource "aws_autoscaling_group" "example-autoscaling" {
|
|||||||
|
|
||||||
tag {
|
tag {
|
||||||
key = "Name"
|
key = "Name"
|
||||||
value = "ec2-container"
|
value = "ec2 instance"
|
||||||
propagate_at_launch = true
|
propagate_at_launch = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,21 +9,6 @@ resource "aws_autoscaling_policy" "example-cpu-policy" {
|
|||||||
policy_type = "SimpleScaling"
|
policy_type = "SimpleScaling"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_sns_topic" "example-cpu-sns" {
|
|
||||||
name = "sg-cpu-sns"
|
|
||||||
display_name = "example ASG SNS topic"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_autoscaling_notification" "example-notify" {
|
|
||||||
group_names = ["${aws_autoscaling_group.example-autoscaling.name}"]
|
|
||||||
topic_arn = "${aws_sns_topic.example-cpu-sns.arn}"
|
|
||||||
notifications = [
|
|
||||||
"autoscaling:EC2_INSTANCE_LAUNCH",
|
|
||||||
"autoscaling:EC2_INSTANCE_TERMINATE",
|
|
||||||
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_cloudwatch_metric_alarm" "example-cpu-alarm" {
|
resource "aws_cloudwatch_metric_alarm" "example-cpu-alarm" {
|
||||||
alarm_name = "example-cpu-alarm"
|
alarm_name = "example-cpu-alarm"
|
||||||
alarm_description = "example-cpu-alarm"
|
alarm_description = "example-cpu-alarm"
|
||||||
@@ -53,21 +38,6 @@ resource "aws_autoscaling_policy" "example-cpu-policy-scaledown" {
|
|||||||
policy_type = "SimpleScaling"
|
policy_type = "SimpleScaling"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_sns_topic" "example-cpu-sns-scaledown" {
|
|
||||||
name = "sg-cpu-sns-scaledown"
|
|
||||||
display_name = "example ASG SNS topic scaledown"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_autoscaling_notification" "example-notify-scaledown" {
|
|
||||||
group_names = ["${aws_autoscaling_group.example-autoscaling.name}"]
|
|
||||||
topic_arn = "${aws_sns_topic.example-cpu-sns-scaledown.arn}"
|
|
||||||
notifications = [
|
|
||||||
"autoscaling:EC2_INSTANCE_LAUNCH",
|
|
||||||
"autoscaling:EC2_INSTANCE_TERMINATE",
|
|
||||||
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_cloudwatch_metric_alarm" "example-cpu-alarm-scaledown" {
|
resource "aws_cloudwatch_metric_alarm" "example-cpu-alarm-scaledown" {
|
||||||
alarm_name = "example-cpu-alarm-scaledown"
|
alarm_name = "example-cpu-alarm-scaledown"
|
||||||
alarm_description = "example-cpu-alarm-scaledown"
|
alarm_description = "example-cpu-alarm-scaledown"
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Uncomment if you want to have autoscaling notifications
|
||||||
|
|
||||||
|
#resource "aws_sns_topic" "example-sns" {
|
||||||
|
# name = "sg-sns"
|
||||||
|
# display_name = "example ASG SNS topic"
|
||||||
|
#} # email subscription is currently unsupported in terraform and can be done using the AWS Web Console
|
||||||
|
#
|
||||||
|
#resource "aws_autoscaling_notification" "example-notify" {
|
||||||
|
# group_names = ["${aws_autoscaling_group.example-autoscaling.name}"]
|
||||||
|
# topic_arn = "${aws_sns_topic.example-sns.arn}"
|
||||||
|
# notifications = [
|
||||||
|
# "autoscaling:EC2_INSTANCE_LAUNCH",
|
||||||
|
# "autoscaling:EC2_INSTANCE_TERMINATE",
|
||||||
|
# "autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
|
||||||
|
# ]
|
||||||
|
#}
|
||||||
Reference in New Issue
Block a user