ec2.tf 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. data aws_ami "preauthorized" {
  2. most_recent = true
  3. owners = ["aws-marketplace"]
  4. filter {
  5. name = "product-code"
  6. values = [ "1mp9h4zd2ze4biqif5schqeyu" ]
  7. }
  8. filter {
  9. name = "name"
  10. values = [ "qVSA*" ]
  11. }
  12. }
  13. data aws_ami "standard" {
  14. most_recent = true
  15. owners = ["aws-marketplace"]
  16. filter {
  17. name = "product-code"
  18. values = [ "9hnn1m0a6jb7k2r1n9itk3jxu" ]
  19. }
  20. filter {
  21. name = "name"
  22. values = [ "qVSA*" ]
  23. }
  24. }
  25. resource aws_instance "qualys_scanner_preauthorized" {
  26. count = var.create_preauthorized_scanner == true ? 1 : 0
  27. ami = data.aws_ami.preauthorized.id
  28. instance_type = "t3.medium"
  29. subnet_id = element(module.vpc.private_subnets,0)
  30. user_data = base64encode("PERSCODE=${var.personalization_codes["preauthorized"]}")
  31. ebs_optimized = true
  32. vpc_security_group_ids = [
  33. "${module.qualys_scanner_sg.this_security_group_id}"
  34. ]
  35. credit_specification {
  36. cpu_credits = "unlimited"
  37. }
  38. tags = merge(var.tags,{"Name": "qualys-scanner-preauthorized"})
  39. volume_tags = merge(var.tags,{"Name": "qualys-scanner-preauthorized"})
  40. root_block_device {
  41. volume_size = 100
  42. volume_type = "gp2"
  43. encrypted = true
  44. }
  45. lifecycle {
  46. ignore_changes = [ ami ]
  47. }
  48. }
  49. resource aws_instance "qualys_scanner_standard" {
  50. count = var.create_standard_scanner == true ? 1 : 0
  51. ami = data.aws_ami.standard.id
  52. instance_type = "t3.medium"
  53. subnet_id = element(module.vpc.private_subnets,0)
  54. user_data = base64encode("PERSCODE=${var.personalization_codes["standard"]}")
  55. ebs_optimized = true
  56. vpc_security_group_ids = [
  57. "${module.qualys_scanner_sg.this_security_group_id}"
  58. ]
  59. credit_specification {
  60. cpu_credits = "unlimited"
  61. }
  62. tags = merge(var.tags,{"Name": "qualys-scanner-standard"})
  63. volume_tags = merge(var.tags,{"Name": "qualys-scanner-standard"})
  64. root_block_device {
  65. volume_size = 100
  66. volume_type = "gp2"
  67. encrypted = true
  68. }
  69. lifecycle {
  70. ignore_changes = [ ami ]
  71. }
  72. }