diff --git a/website/source/docs/providers/aws/r/launch_configuration.html.markdown b/website/source/docs/providers/aws/r/launch_configuration.html.markdown index 85d45bcb0..849264018 100644 --- a/website/source/docs/providers/aws/r/launch_configuration.html.markdown +++ b/website/source/docs/providers/aws/r/launch_configuration.html.markdown @@ -24,8 +24,8 @@ resource "aws_launch_configuration" "as_conf" { Launch Configurations cannot be updated after creation with the Amazon Web Service API. In order to update a Launch Configuration, Terraform will -destroy the existing resource and create a replacement. If order to effectively -use a Launch Configuration resource with an[AutoScaling Group resource][1], +destroy the existing resource and create a replacement. In order to effectively +use a Launch Configuration resource with an [AutoScaling Group resource][1], it's recommend to omit the Launch Configuration `name` attribute, and specify `create_before_destroy` in a [lifecycle][2] block, as shown: @@ -53,6 +53,35 @@ With this setup Terraform generates a unique name for your Launch Configuration and can then update the AutoScaling Group without conflict before destroying the previous Launch Configuration. +## Using with Spot Instances + +Launch configurations can set the spot instance pricing to be used for the +Auto Scaling Group to reserve instances. Simply specifying the `spot_price` +parameter will set the price on the Launch Configuration which will attempt to +reserve your instances at this price. See the [AWS Spot Instance +documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html) +for more information or how to launch [Spot Instances][3] with Terraform. + +``` +resource "aws_launch_configuration" "as_conf" { + image_id = "ami-1234" + instance_type = "m1.small" + spot_price = "0.001" + lifecycle { + create_before_destroy = true + } +} + +resource "aws_autoscaling_group" "bar" { + name = "terraform-asg-example" + launch_configuration = "${aws_launch_configuration.as_conf.name}" + + lifecycle { + create_before_destroy = true + } +} +``` + ## Argument Reference The following arguments are supported: @@ -75,6 +104,7 @@ The following arguments are supported: instance. See [Block Devices](#block-devices) below for details. * `ephemeral_block_device` - (Optional) Customize Ephemeral (also known as "Instance Store") volumes on the instance. See [Block Devices](#block-devices) below for details. +* `spot_price` - (Optional) The price to use for reserving spot instances. ## Block devices @@ -139,3 +169,4 @@ The following attributes are exported: [1]: /docs/providers/aws/r/autoscaling_group.html [2]: /docs/configuration/resources.html#lifecycle +[3]: /docs/providers/aws/r/spot_instance_request.html