Last active
November 30, 2018 13:05
-
-
Save mig5/b0e1b2192c9e3bae1a60191dd7eba132 to your computer and use it in GitHub Desktop.
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
### 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