github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/website/source/docs/providers/aws/r/autoscaling_lifecycle_hooks.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_autoscaling_lifecycle_hook" 4 sidebar_current: "docs-aws-resource-autoscaling-lifecycle-hook" 5 description: |- 6 Provides an AutoScaling Lifecycle Hooks resource. 7 --- 8 9 # aws\_autoscaling\_lifecycle\_hook 10 11 Provides an AutoScaling Lifecycle Hook resource. 12 13 ## Example Usage 14 15 ``` 16 resource "aws_autoscaling_group" "foobar" { 17 availability_zones = ["us-west-2a"] 18 name = "terraform-test-foobar5" 19 health_check_type = "EC2" 20 termination_policies = ["OldestInstance"] 21 tag { 22 key = "Foo" 23 value = "foo-bar" 24 propagate_at_launch = true 25 } 26 } 27 28 resource "aws_autoscaling_lifecycle_hook" "foobar" { 29 name = "foobar" 30 autoscaling_group_name = "${aws_autoscaling_group.foobar.name}" 31 default_result = "CONTINUE" 32 heartbeat_timeout = 2000 33 lifecycle_transition = "autoscaling:EC2_INSTANCE_LAUNCHING" 34 notification_metadata = <<EOF 35 { 36 "foo": "bar" 37 } 38 EOF 39 notification_target_arn = "arn:aws:sqs:us-east-1:444455556666:queue1*" 40 role_arn = "arn:aws:iam::123456789012:role/S3Access" 41 } 42 ``` 43 44 ## Argument Reference 45 46 The following arguments are supported: 47 48 * `name` - (Required) The name of the lifecycle hook. 49 * `autoscaling_group_name` - (Requred) The name of the Auto Scaling group to which you want to assign the lifecycle hook 50 * `default_result` - (Optional) Defines the action the Auto Scaling group should take when the lifecycle hook timeout elapses or if an unexpected failure occurs. 51 * `heartbeat_timeout` - (Optional) Defines the amount of time, in seconds, that can elapse before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action defined in the DefaultResult parameter 52 * `lifecycle_transition` - (Optional) The instance state to which you want to attach the lifecycle hook. For a list of lifecycle hook types, see [describe-lifecycle-hook-types](http://docs.aws.amazon.com/cli/latest/reference/autoscaling/describe-lifecycle-hook-types.html#examples) 53 * `notification_metadata` - (Optional) Contains additional information that you want to include any time Auto Scaling sends a message to the notification target. 54 * `notification_target_arn` - (Required) The ARN of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. 55 * `role_arn` - (Required) The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target.