cloud-init.tf 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. data "template_file" "cloud-init" {
  2. # Should these be in a common directory? I suspect they'd be reusable
  3. template = file("${path.module}/cloud-init/cloud-init.tpl")
  4. vars = {
  5. prefix = var.prefix
  6. zone = var.dns_info["private"]["zone"]
  7. splunk_prefix = var.prefix
  8. environment = var.environment
  9. salt_master = var.salt_master
  10. proxy = var.proxy
  11. aws_partition = var.aws_partition
  12. aws_partition_alias = var.aws_partition_alias
  13. aws_region = var.aws_region
  14. }
  15. }
  16. # Render a multi-part cloud-init config making use of the part
  17. # above, and other source files
  18. data "template_cloudinit_config" "cloud-init" {
  19. gzip = true
  20. base64_encode = true
  21. # Main cloud-config configuration file.
  22. part {
  23. filename = "init.cfg"
  24. content_type = "text/cloud-config"
  25. content = data.template_file.cloud-init.rendered
  26. }
  27. part {
  28. content_type = "text/cloud-boothook"
  29. content = file("${path.module}/cloud-init/nvme-setup.sh")
  30. }
  31. part {
  32. content_type = "text/cloud-boothook"
  33. content = file("${path.module}/cloud-init/opt_splunk.boothook")
  34. }
  35. }