Created
September 3, 2018 04:38
-
-
Save lawliet89/218c246ca5dc1751765a0e036f1452fa to your computer and use it in GitHub Desktop.
Terraform Demo Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_launch_configuration" "client" { | |
name_prefix = "${var.client_asg_name}" | |
image_id = "${data.aws_ami.ubuntu.image_id}" | |
instance_type = "${var.instance_type}" | |
user_data = "${data.template_file.client_user_data.rendered}" | |
associate_public_ip_address = false | |
security_groups = ["${aws_security_group.client.id}"] | |
root_block_device { | |
volume_type = "gp2" | |
volume_size = "8" | |
delete_on_termination = "true" | |
} | |
# SSH Access | |
key_name = "${var.ssh_key}" | |
# Important note: whenever using a launch configuration with an auto scaling group, you must set | |
# create_before_destroy = true. However, as soon as you set create_before_destroy = true in one resource, you must | |
# also set it in every resource that it depends on, or you'll get an error about cyclic dependencies (especially when | |
# removing resources). For more info, see: | |
# | |
# https://www.terraform.io/docs/providers/aws/r/launch_configuration.html | |
# https://terraform.io/docs/configuration/resources.html | |
lifecycle { | |
create_before_destroy = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment