1234567891011121314151617181920212223242526272829303132333435363738 |
- data "template_file" "cloud-init" {
- count = var.interconnects_count
- # Should these be in a common directory? I suspect they'd be reusable
- template = "${file("${path.module}/cloud-init/cloud-init.tpl")}"
- vars = {
- hostname = "interconnect-${count.index}"
- fqdn = "interconnect-${count.index}.${var.dns_info["private"]["zone"]}"
- saltmaster = "salt-master.${ var.dns_public["name"] }"
- environment = var.environment
- aws_partition = var.aws_partition
- aws_partition_alias = var.aws_partition_alias
- interconnect_id = count.index
- vpc_cidr = var.security_vpc_cidr
- }
- }
- # Render a multi-part cloud-init config making use of the part
- # above, and other source files
- data "template_cloudinit_config" "cloud-init" {
- count = var.interconnects_count
- 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[count.index].rendered}"
- }
- # Additional parts as needed
- #part {
- # content_type = "text/x-shellscript"
- # content = "ffbaz"
- #}
- }
|