data "template_file" "cloud-init" { # Should these be in a common directory? I suspect they'd be reusable template = file("${path.module}/cloud-init/cloud-init.tpl") vars = { prefix = var.prefix zone = var.dns_info["private"]["zone"] splunk_prefix = var.prefix environment = var.environment salt_master = var.salt_master proxy = var.proxy aws_partition = var.aws_partition aws_partition_alias = var.aws_partition_alias aws_region = var.aws_region } } # Render a multi-part cloud-init config making use of the part # above, and other source files data "template_cloudinit_config" "cloud-init" { gzip = true base64_encode = true # Main cloud-config configuration file. part { filename = "init.cfg" content_type = "text/cloud-config" content = data.template_file.cloud-init.rendered } part { content_type = "text/cloud-boothook" content = file("${path.module}/cloud-init/nvme-setup.sh") } part { content_type = "text/cloud-boothook" content = file("${path.module}/cloud-init/opt_splunk.boothook") } }