github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/website/source/docs/providers/aws/r/launch_configuration.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_launch_configuration"
     4  sidebar_current: "docs-aws-resource-launch-configuration"
     5  description: |-
     6    Provides a resource to create a new launch configuration, used for autoscaling groups.
     7  ---
     8  
     9  # aws\_launch\_configuration
    10  
    11  Provides a resource to create a new launch configuration, used for autoscaling groups.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  resource "aws_launch_configuration" "as_conf" {
    17      name = "web_config"
    18      image_id = "ami-1234"
    19      instance_type = "m1.small"
    20  }
    21  ```
    22  
    23  ## Using with AutoScaling Groups
    24  
    25  Launch Configurations cannot be updated after creation with the Amazon
    26  Web Service API. In order to update a Launch Configuration, Terraform will 
    27  destroy the existing resource and create a replacement. In order to effectively 
    28  use a Launch Configuration resource with an [AutoScaling Group resource][1], 
    29  it's recommend to omit the Launch Configuration `name` attribute, and 
    30  specify `create_before_destroy` in a [lifecycle][2] block, as shown:
    31  
    32  ```
    33  resource "aws_launch_configuration" "as_conf" {
    34      image_id = "ami-1234"
    35      instance_type = "m1.small"
    36  
    37      lifecycle {
    38        create_before_destroy = true
    39      }
    40  }
    41  
    42  resource "aws_autoscaling_group" "bar" {
    43      name = "terraform-asg-example"
    44      launch_configuration = "${aws_launch_configuration.as_conf.name}"
    45  
    46      lifecycle {
    47        create_before_destroy = true
    48      }
    49  }
    50  ```
    51  
    52  With this setup Terraform generates a unique name for your Launch
    53  Configuration and can then update the AutoScaling Group without conflict before
    54  destroying the previous Launch Configuration.
    55  
    56  ## Argument Reference
    57  
    58  The following arguments are supported:
    59  
    60  * `name` - (Optional) The name of the launch configuration. If you leave
    61    this blank, Terraform will auto-generate it.
    62  * `image_id` - (Required) The EC2 image ID to launch.
    63  * `instance_type` - (Required) The size of instance to launch.
    64  * `iam_instance_profile` - (Optional) The IAM instance profile to associate
    65       with launched instances.
    66  * `key_name` - (Optional) The key name that should be used for the instance.
    67  * `security_groups` - (Optional) A list of associated security group IDS.
    68  * `associate_public_ip_address` - (Optional) Associate a public ip address with an instance in a VPC.
    69  * `user_data` - (Optional) The user data to provide when launching the instance.
    70  * `enable_monitoring` - (Optional) Enables/disables detailed monitoring. This is enabled by default.
    71  * `ebs_optimized` - (Optional) If true, the launched EC2 instance will be EBS-optimized.
    72  * `block_device_mapping` - (Optional) A list of block devices to add. Their keys are documented below.
    73  
    74  <a id="block-devices"></a>
    75  ## Block devices
    76  
    77  Each of the `*_block_device` attributes controls a portion of the AWS
    78  Launch Configuration's "Block Device Mapping". It's a good idea to familiarize yourself with [AWS's Block Device
    79  Mapping docs](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html)
    80  to understand the implications of using these attributes.
    81  
    82  The `root_block_device` mapping supports the following:
    83  
    84  * `volume_type` - (Optional) The type of volume. Can be `"standard"`, `"gp2"`,
    85    or `"io1"`. (Default: `"standard"`).
    86  * `volume_size` - (Optional) The size of the volume in gigabytes.
    87  * `iops` - (Optional) The amount of provisioned
    88    [IOPS](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-io-characteristics.html).
    89    This must be set with a `volume_type` of `"io1"`.
    90  * `delete_on_termination` - (Optional) Whether the volume should be destroyed
    91    on instance termination (Default: `true`).
    92  
    93  Modifying any of the `root_block_device` settings requires resource
    94  replacement.
    95  
    96  Each `ebs_block_device` supports the following:
    97  
    98  * `device_name` - (Required) The name of the device to mount.
    99  * `snapshot_id` - (Optional) The Snapshot ID to mount.
   100  * `volume_type` - (Optional) The type of volume. Can be `"standard"`, `"gp2"`,
   101    or `"io1"`. (Default: `"standard"`).
   102  * `volume_size` - (Optional) The size of the volume in gigabytes.
   103  * `iops` - (Optional) The amount of provisioned
   104    [IOPS](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-io-characteristics.html).
   105    This must be set with a `volume_type` of `"io1"`.
   106  * `delete_on_termination` - (Optional) Whether the volume should be destroyed
   107    on instance termination (Default: `true`).
   108  
   109  Modifying any `ebs_block_device` currently requires resource replacement.
   110  
   111  Each `ephemeral_block_device` supports the following:
   112  
   113  * `device_name` - The name of the block device to mount on the instance.
   114  * `virtual_name` - The [Instance Store Device
   115    Name](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#InstanceStoreDeviceNames)
   116    (e.g. `"ephemeral0"`)
   117  
   118  Each AWS Instance type has a different set of Instance Store block devices
   119  available for attachment. AWS [publishes a
   120  list](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#StorageOnInstanceTypes)
   121  of which ephemeral devices are available on each type. The devices are always
   122  identified by the `virtual_name` in the format `"ephemeral{0..N}"`.
   123  
   124  ~> **NOTE:** Changes to `*_block_device` configuration of _existing_ resources
   125  cannot currently be detected by Terraform. After updating to block device
   126  configuration, resource recreation can be manually triggered by using the
   127  [`taint` command](/docs/commands/taint.html).
   128  
   129  ## Attributes Reference
   130  
   131  The following attributes are exported:
   132  
   133  * `id` - The ID of the launch configuration.
   134  
   135  [1]: /docs/providers/aws/r/autoscaling_group.html
   136  [2]: /docs/configuration/resources.html#lifecycle