Created
February 7, 2016 23:53
-
-
Save yakaas/6d2d1682d74d719a0304 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
| resource "aws_ebs_volume" "elasticsearch_master" { | |
| count = 3 | |
| availability_zone = "${lookup(var.azs, count.index)}" | |
| size = 8 | |
| type = "gp2" | |
| tags { | |
| Name = "elasticsearch_master_az${count.index}.${var.env_name}" | |
| } | |
| } | |
| resource "template_file" "elasticsearch_mount_vol_sh" { | |
| filename = "${path.module}/elasticsearch_mount_vol.sh" | |
| count = 3 | |
| vars { | |
| volume_id = "${element(aws_ebs_volume.elasticsearch_master.*.id, count.index)}" | |
| lsblk_name = "xvdf" | |
| device_name = "/dev/xvdf" | |
| mount_point = "/esvolume" | |
| } | |
| } | |
| ----- | |
| resource "aws_instance" "elasticsearch_master" { | |
| count = 3 | |
| ... | |
| user_data = <<SCRIPT | |
| #!/bin/bash | |
| # Attach and Mount ES EBS volume | |
| ${element(template_file.elasticsearch_mount_vol_sh.*.rendered, count.index)} | |
| SCRIPT | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment