Guest User

Untitled

a guest
Apr 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #############################
  2. # ec2 instance
  3. #############################
  4. resource "aws_instance" "my-cool-instance" {
  5. count = 1
  6.  
  7. ami = "${lookup(var.ami, var.region)}"
  8. instance_type = "t2.micro"
  9. key_name = "${var.key_pair_name}"
  10. ebs_optimized = true
  11. monitoring = true
  12. vpc_security_group_ids = ["${module.sg_allow_ssh_in.this_security_group_id}", "${module.sg_allow_all_out.this_security_group_id}", "${module.sg_allow_web_in.this_security_group_id}"]
  13. associate_public_ip_address = true
  14. subnet_id = "${module.vpc.public_subnets[0]}"
  15.  
  16. # os disk
  17. root_block_device {
  18. volume_size = "50"
  19. }
  20.  
  21. # tags (to provide name)
  22. tags = {
  23. Name = "magnifier-btc-dev${count.index}"
  24. }
  25. }
  26.  
  27. #############################
  28. # ebs vols and attach
  29. #############################
  30. resource "aws_ebs_volume" "data" {
  31. availability_zone = "${aws_instance.my-cool-instance.availability_zone}"
  32. type = "gp2"
  33. size = 128
  34. encrypted = true
  35. }
  36.  
  37. resource "aws_volume_attachment" "ebs_att" {
  38. device_name = "/dev/sdh"
  39. volume_id = "${aws_ebs_volume.data.id}"
  40. instance_id = "${aws_instance.my-cool-instance.id}"
  41. }
Add Comment
Please, Sign In to add comment