amis.tf 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. locals {
  2. ami_map = {
  3. "base" = data.aws_ami.base.image_id,
  4. "minion" = data.aws_ami.minion.image_id,
  5. "master" = data.aws_ami.master.image_id,
  6. # "ubuntu1804" = data.aws_ami.ubuntu1804.image_id,
  7. }
  8. # We need some data from the block devices
  9. block_device_mappings = {
  10. "base" = {
  11. for bd in data.aws_ami.base.block_device_mappings:
  12. bd.device_name => bd
  13. }
  14. "minion" = {
  15. for bd in data.aws_ami.minion.block_device_mappings:
  16. bd.device_name => bd
  17. }
  18. "master" = {
  19. for bd in data.aws_ami.master.block_device_mappings:
  20. bd.device_name => bd
  21. }
  22. # "ubuntu1804" = data.aws_ami.ubuntu1804.image_id,
  23. }
  24. }
  25. data "aws_ami" "base" {
  26. most_recent = true
  27. owners = [ var.common_services_account ]
  28. filter {
  29. name = "virtualization-type"
  30. values = ["hvm"]
  31. }
  32. filter {
  33. name = "root-device-type"
  34. values = ["ebs"]
  35. }
  36. filter {
  37. name = "name"
  38. values = [ "MSOC_RedHat_Base_*" ]
  39. }
  40. }
  41. data "aws_ami" "minion" {
  42. most_recent = true
  43. owners = [ var.common_services_account ]
  44. filter {
  45. name = "virtualization-type"
  46. values = ["hvm"]
  47. }
  48. filter {
  49. name = "root-device-type"
  50. values = ["ebs"]
  51. }
  52. filter {
  53. name = "name"
  54. values = [ "MSOC_RedHat_Minion_*" ]
  55. }
  56. }
  57. data "aws_ami" "master" {
  58. most_recent = true
  59. owners = [ var.common_services_account ]
  60. filter {
  61. name = "virtualization-type"
  62. values = ["hvm"]
  63. }
  64. filter {
  65. name = "root-device-type"
  66. values = ["ebs"]
  67. }
  68. filter {
  69. name = "name"
  70. values = [ "MSOC_RedHat_Master_*" ]
  71. }
  72. }
  73. # Not presently in commercial
  74. #data "aws_ami" "ubuntu1804" {
  75. # most_recent = true
  76. # owners = [ var.common_services_account ]
  77. #
  78. # filter {
  79. # name = "virtualization-type"
  80. # values = ["hvm"]
  81. # }
  82. #
  83. # filter {
  84. # name = "root-device-type"
  85. # values = ["ebs"]
  86. # }
  87. #
  88. # filter {
  89. # name = "name"
  90. # values = [ "MSOC_Ubuntu_1804_*" ]
  91. # }
  92. #}