github.com/jsoriano/terraform@v0.6.7-0.20151026070445-8b70867fdd95/website/source/docs/providers/aws/r/autoscaling_group.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_autoscaling_group"
     4  sidebar_current: "docs-aws-resource-autoscaling-group"
     5  description: |-
     6    Provides an AutoScaling Group resource.
     7  ---
     8  
     9  # aws\_autoscaling\_group
    10  
    11  Provides an AutoScaling Group resource.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  resource "aws_autoscaling_group" "bar" {
    17    availability_zones = ["us-east-1a"]
    18    name = "foobar3-terraform-test"
    19    max_size = 5
    20    min_size = 2
    21    health_check_grace_period = 300
    22    health_check_type = "ELB"
    23    desired_capacity = 4
    24    force_delete = true
    25    launch_configuration = "${aws_launch_configuration.foobar.name}"
    26  
    27    tag {
    28      key = "foo"
    29      value = "bar"
    30      propagate_at_launch = true
    31    }
    32    tag {
    33      key = "lorem"
    34      value = "ipsum"
    35      propagate_at_launch = false
    36    }
    37  }
    38  ```
    39  
    40  ## Argument Reference
    41  
    42  The following arguments are supported:
    43  
    44  * `name` - (Required) The name of the auto scale group.
    45  * `max_size` - (Required) The maximum size of the auto scale group.
    46  * `min_size` - (Required) The minimum size of the auto scale group.
    47      (See also [Waiting for Capacity](#waiting-for-capacity) below.)
    48  * `availability_zones` - (Optional) A list of AZs to launch resources in.
    49     Required only if you do not specify any `vpc_zone_identifier`
    50  * `launch_configuration` - (Required) The name of the launch configuration to use.
    51  * `health_check_grace_period` - (Optional) Time after instance comes into service before checking health.
    52  * `health_check_type` - (Optional) "EC2" or "ELB". Controls how health checking is done.
    53  * `desired_capacity` - (Optional) The number of Amazon EC2 instances that
    54      should be running in the group. (See also [Waiting for
    55      Capacity](#waiting-for-capacity) below.)
    56  * `min_elb_capacity` - (Optional) Setting this will cause Terraform to wait
    57      for this number of healthy instances all attached load balancers.
    58      (See also [Waiting for Capacity](#waiting-for-capacity) below.)
    59  * `force_delete` - (Optional) Allows deleting the autoscaling group without waiting
    60     for all instances in the pool to terminate.  You can force an autoscaling group to delete
    61     even if it's in the process of scaling a resource. Normally, Terraform
    62     drains all the instances before deleting the group.  This bypasses that
    63     behavior and potentially leaves resources dangling.
    64  * `load_balancers` (Optional) A list of load balancer names to add to the autoscaling
    65     group names.
    66  * `vpc_zone_identifier` (Optional) A list of subnet IDs to launch resources in.
    67  * `termination_policies` (Optional) A list of policies to decide how the instances in the auto scale group should be terminated.
    68  * `tag` (Optional) A list of tag blocks. Tags documented below.
    69  * `wait_for_capacity_timeout` (Default: "10m") A maximum
    70    [duration](https://golang.org/pkg/time/#ParseDuration) that Terraform should
    71    wait for ASG instances to be healthy before timing out.  (See also [Waiting
    72    for Capacity](#waiting-for-capacity) below.) Setting this to "0" causes
    73    Terraform to skip all Capacity Waiting behavior.
    74  
    75  Tags support the following:
    76  
    77  * `key` - (Required) Key
    78  * `value` - (Required) Value
    79  * `propagate_at_launch` - (Required) Enables propagation of the tag to
    80     Amazon EC2 instances launched via this ASG
    81  
    82  ## Attributes Reference
    83  
    84  The following attributes are exported:
    85  
    86  * `id` - The autoscaling group name.
    87  * `availability_zones` - The availability zones of the autoscale group.
    88  * `min_size` - The minimum size of the autoscale group
    89  * `max_size` - The maximum size of the autoscale group
    90  * `default_cooldown` - Time between a scaling activity and the succeeding scaling activity.
    91  * `name` - The name of the autoscale group
    92  * `health_check_grace_period` - Time after instance comes into service before checking health.
    93  * `health_check_type` - "EC2" or "ELB". Controls how health checking is done.
    94  * `desired_capacity` -The number of Amazon EC2 instances that should be running in the group.
    95  * `launch_configuration` - The launch configuration of the autoscale group
    96  * `vpc_zone_identifier` - The VPC zone identifier
    97  * `load_balancers` (Optional) The load balancer names associated with the
    98     autoscaling group.
    99  
   100  <a id="waiting-for-capacity"></a>
   101  ## Waiting for Capacity
   102  
   103  A newly-created ASG is initially empty and begins to scale to `min_size` (or
   104  `desired_capacity`, if specified) by launching instances using the provided
   105  Launch Configuration. These instances take time to launch and boot.
   106  
   107  Terraform provides two mechanisms to help consistently manage ASG scale up
   108  time across dependent resources.
   109  
   110  #### Waiting for ASG Capacity
   111  
   112  The first is default behavior. Terraform waits after ASG creation for
   113  `min_size` (or `desired_capacity`, if specified) healthy instances to show up
   114  in the ASG before continuing.
   115  
   116  Terraform considers an instance "healthy" when the ASG reports `HealthStatus:
   117  "Healthy"` and `LifecycleState: "InService"`. See the [AWS AutoScaling
   118  Docs](https://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/AutoScalingGroupLifecycle.html)
   119  for more information on an ASG's lifecycle.
   120  
   121  Terraform will wait for healthy instances for up to
   122  `wait_for_capacity_timeout`. If ASG creation is taking more than a few minutes,
   123  it's worth investigating for scaling activity errors, which can be caused by
   124  problems with the selected Launch Configuration.
   125  
   126  Setting `wait_for_capacity_timeout` to `"0"` disables ASG Capacity waiting.
   127  
   128  #### Waiting for ELB Capacity
   129  
   130  The second mechanism is optional, and affects ASGs with attached Load
   131  Balancers. If `min_elb_capacity` is set, Terraform will wait for that number of
   132  Instances to be `"InService"` in all attached `load_balancers`. This can be
   133  used to ensure that service is being provided before Terraform moves on.
   134  
   135  As with ASG Capacity, Terraform will wait for up to `wait_for_capacity_timeout`
   136  (for `"InService"` instances. If ASG creation takes more than a few minutes,
   137  this could indicate one of a number of configuration problems. See the [AWS
   138  Docs on Load Balancer
   139  Troubleshooting](https://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/elb-troubleshooting.html)
   140  for more information.