Skip to content

Commit

Permalink
Remove template resource (#41)
Browse files Browse the repository at this point in the history
* Remove template resource

* support count
  • Loading branch information
simonrondelez authored Nov 22, 2022
1 parent 1a120a5 commit 988f677
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions puppet-userdata/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
data "template_file" "metadata_puppet" {
count = var.amount_of_instances
template = file("${path.module}/templates/metadata.tpl")

vars = {
number = count.index + 1
environment = var.environment == "production" ? "" : "-${var.environment}"
project = var.project == null ? "" : "-${var.project}"
customer = var.customer
function = var.function
puppetmaster = var.puppetmaster
domain = var.domain
}
locals {
metadatas = [
for n in range(var.amount_of_instances) : templatefile("${path.module}/templates/metadata.tftpl", {
number = n
environment = var.environment == "production" ? "" : "-${var.environment}"
project = var.project == null ? "" : "-${var.project}"
customer = var.customer
function = var.function
puppetmaster = var.puppetmaster
domain = var.domain
})
]
}
2 changes: 1 addition & 1 deletion puppet-userdata/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output "user_datas" {
value = data.template_file.metadata_puppet.*.rendered
value = local.metadatas
}
File renamed without changes.

0 comments on commit 988f677

Please sign in to comment.