ansible-debops-infrastructure

DebOps and Ansible scripts to manage my infrastructure
git clone git://git.erethon.com/ansible-debops-infrastructure
Log | Files | Refs

commit 50832fd9b3fb0b87862b48624c799e1e312e24e4
parent ae12529208cc44fea483705a7be52693a97189fc
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Fri, 11 Oct 2019 00:44:34 +0300

libvirt_host: Randomize cloud-init.iso name

Diffstat:
terraform/infrastructure/modules/libvirt_host/main.tf | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/terraform/infrastructure/modules/libvirt_host/main.tf b/terraform/infrastructure/modules/libvirt_host/main.tf @@ -14,6 +14,11 @@ resource "libvirt_volume" "volume" { base_volume_id = (var.volume_source != "" ? libvirt_volume.base_volume[0].id : null) } +resource "random_pet" "random" { + count = (var.cloudinit_template != "" ? 1 : 0) + separator = "_" +} + data "template_file" "user_data" { count = (var.cloudinit_template != "" ? 1 : 0) template = var.cloudinit_template @@ -21,8 +26,8 @@ data "template_file" "user_data" { resource "libvirt_cloudinit_disk" "cloud_init" { count = (var.cloudinit_template != "" ? 1 : 0) - name = "cloud-init.iso" - user_data = "${data.template_file.user_data[count.index].rendered}" + name = "cloud-init-${random_pet.random[0].id}.iso" + user_data = data.template_file.user_data[count.index].rendered } resource "libvirt_domain" "libvirt_host" {