standalone.tf 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. data "aws_ami" "standalone_ami" {
  2. most_recent = true
  3. filter {
  4. name = "name"
  5. values = ["FTD-Splunk-Standalone"]
  6. }
  7. owners = ["${data.aws_caller_identity.current.account_id}"]
  8. }
  9. resource "aws_instance" "splunk_standalone" {
  10. ami = "${data.aws_ami.standalone_ami.id}"
  11. instance_type = "i3.large"
  12. key_name = "Fred-IO"
  13. vpc_security_group_ids = ["${aws_security_group.splunk_standalone.id}"]
  14. subnet_id = "${data.terraform_remote_state.network.outputs.subnet0_id}"
  15. associate_public_ip_address = true
  16. iam_instance_profile = "Splunk-EC2-Standalone"
  17. ebs_optimized = true
  18. root_block_device {
  19. volume_type = "gp2"
  20. volume_size = "10"
  21. encrypted = true
  22. kms_key_id = "alias/splunk_standalone_ebs"
  23. }
  24. ebs_block_device {
  25. device_name = "/dev/xvdb"
  26. volume_type = "gp2"
  27. volume_size = 20
  28. delete_on_termination = true
  29. encrypted = true
  30. kms_key_id = "alias/splunk_standalone_ebs"
  31. }
  32. ebs_block_device {
  33. device_name = "/dev/xvdc"
  34. volume_type = "gp2"
  35. volume_size = 2
  36. delete_on_termination = true
  37. encrypted = true
  38. kms_key_id = "alias/splunk_standalone_ebs"
  39. }
  40. tags = {
  41. Name = "Splunk Standalone"
  42. }
  43. }
  44. resource "aws_security_group" "splunk_standalone" {
  45. name = "splunk_standalone"
  46. description = "Basic Splunk Ports"
  47. vpc_id = "${data.terraform_remote_state.network.outputs.vpc_id}"
  48. ingress {
  49. from_port = 22
  50. to_port = 22
  51. protocol = "tcp"
  52. cidr_blocks = ["0.0.0.0/0"]
  53. description = "SSH from any"
  54. }
  55. ingress {
  56. from_port = 80
  57. to_port = 80
  58. protocol = "tcp"
  59. cidr_blocks = ["0.0.0.0/0"]
  60. description = "HTTP from any"
  61. }
  62. ingress {
  63. from_port = 443
  64. to_port = 443
  65. protocol = "tcp"
  66. cidr_blocks = ["0.0.0.0/0"]
  67. description = "HTTPS from any"
  68. }
  69. ingress {
  70. from_port = 8000
  71. to_port = 8000
  72. protocol = "tcp"
  73. cidr_blocks = ["0.0.0.0/0"]
  74. description = "Splunk from any"
  75. }
  76. egress {
  77. from_port = 0
  78. to_port = 0
  79. protocol = -1
  80. cidr_blocks = ["0.0.0.0/0"]
  81. description = "To Any"
  82. }
  83. }
  84. output "standalone_public_ip" {
  85. value = aws_instance.splunk_standalone.public_ip
  86. }