Created
August 20, 2018 01:46
-
-
Save endofcake/59d004ec5fa01fe72a86002799058ed6 to your computer and use it in GitHub Desktop.
Creating a launch configuration in Terraform
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" "worker" { | |
# Launch Configurations cannot be updated after creation with the AWS API. | |
# In order to update a Launch Configuration, Terraform will destroy the | |
# existing resource and create a replacement. | |
# | |
# We're only setting the name_prefix here, | |
# Terraform will add a random string at the end to keep it unique. | |
name_prefix = "worker-" | |
image_id = "${data.aws_ami.amazon_linux.id}" | |
instance_type = "${var.worker_instance_type}" | |
security_groups = ["${aws_security_group.worker.id}"] | |
user_data = "${data.template_cloudinit_config.user_data.rendered}" | |
lifecycle { | |
create_before_destroy = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment