Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lordnynex/cd8ec9aa5f9bd798038acc4413cef2e3 to your computer and use it in GitHub Desktop.
Save lordnynex/cd8ec9aa5f9bd798038acc4413cef2e3 to your computer and use it in GitHub Desktop.
### autoscale.tf
data "template_file" "userdata" {
template = "${file("templates/userdata.tpl")}"
vars {
region = "${var.region}"
file_system_id = "${aws_efs_file_system.prod-efs.id}"
}
}
resource "aws_launch_configuration" "mig5-prod-lc" {
# <snip..>
user_data = "${data.template_file.userdata.rendered}"
}
### templates/userdata.tpl
#cloud-config
package_upgrade: false
runcmd:
- echo "$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).${file_system_id}.efs.${region}.amazonaws.com:/ /var/www/shared nfs defaults,vers=4.1 0 0" >> /etc/fstab
- mount -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment