blurringtool-ml-deployment/output.tf

26 lines
No EOL
1,000 B
HCL
Executable file

resource "local_file" "host_vars" {
count = var.host_info.host_count
filename = "${path.module}/ansible/host_vars/${format("${var.host_info.name}-%02d", count.index + 1)}/main.yml"
content = templatefile("${path.module}/tf_templates/host_vars.yml.tftpl", {
input_bucket = format("blurring-tool-%02d-bucket", count.index + 1)
output_bucket = "blurring-tool-output-bucket"
access_key = stackit_objectstorage_credential.blurringtool-credentials[count.index].access_key
secret_key = stackit_objectstorage_credential.blurringtool-credentials[count.index].secret_access_key
})
}
locals {
hosts = [for i in range(var.host_info.host_count) : {
hostname = format("${var.host_info.name}-%02d", i + 1)
public_ip = stackit_public_ip.public-ip[i].ip
}]
}
resource "local_file" "host_ini" {
count = var.host_info.host_count
filename = var.host_ini_outpath
content = templatefile("${path.module}/tf_templates/hosts.ini.tftpl", {
hosts = local.hosts
})
}