Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. resource "aws_ebs_volume" "elasticsearch_master" {
  2. count = 3
  3. availability_zone = "${lookup(var.azs, count.index)}"
  4. size = 8
  5. type = "gp2"
  6. tags {
  7. Name = "elasticsearch_master_az${count.index}.${var.env_name}"
  8. }
  9. }
  10.  
  11. resource "template_file" "elasticsearch_mount_vol_sh" {
  12. filename = "${path.module}/elasticsearch_mount_vol.sh"
  13. count = 3
  14. vars {
  15. volume_id = "${element(aws_ebs_volume.elasticsearch_master.*.id, count.index)}"
  16. lsblk_name = "xvdf"
  17. device_name = "/dev/xvdf"
  18. mount_point = "/esvolume"
  19. }
  20. }
  21.  
  22.  
  23.  
  24. -----
  25.  
  26. resource "aws_instance" "elasticsearch_master" {
  27. count = 3
  28. ...
  29. user_data = <<SCRIPT
  30. #!/bin/bash
  31.  
  32. # Attach and Mount ES EBS volume
  33. ${element(template_file.elasticsearch_mount_vol_sh.*.rendered, count.index)}
  34.  
  35. SCRIPT
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement