cloud-init.tf 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. data "template_file" "cloud-init" {
  2. count = var.interconnects_count
  3. # Should these be in a common directory? I suspect they'd be reusable
  4. template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
  5. vars = {
  6. hostname = "interconnect-${count.index}"
  7. fqdn = "interconnect-${count.index}.${var.dns_info["private"]["zone"]}"
  8. saltmaster = "salt-master.${ var.dns_public["name"] }"
  9. environment = var.environment
  10. aws_partition = var.aws_partition
  11. aws_partition_alias = var.aws_partition_alias
  12. interconnect_id = count.index
  13. vpc_cidr = var.security_vpc_cidr
  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. count = var.interconnects_count
  20. gzip = true
  21. base64_encode = true
  22. # Main cloud-config configuration file.
  23. part {
  24. filename = "init.cfg"
  25. content_type = "text/cloud-config"
  26. content = "${data.template_file.cloud-init[count.index].rendered}"
  27. }
  28. # Additional parts as needed
  29. #part {
  30. # content_type = "text/x-shellscript"
  31. # content = "ffbaz"
  32. #}
  33. }