Closed etiennedub closed 5 months ago
Since the end result is a single YAML file instead of one per prefix, I am wondering if it would be better in terms of user experience to define the hieradata per prefix as a single data structure in the main.tf instead of one per instance type. i.e.:
hieradata_prefix = <<EOT
login:
profile::base::packages: ['gcc', 'gfortran']
mgmt:
profile::ceph::client::share_name: "your-project-shared-fs"
EOT
Last bit of this comment: https://github.com/hashicorp/terraform/issues/21425#issuecomment-495680010 suggests uploading a directory content to handle multiple files.
Another option would be to have a resource "terraform_data"
per hieradata file.
Close #287
This PR allows for setting custom hieradata per group of instances sharing the same prefix.
It works by setting a new
prefix
fact on each instance. Then, all prefix hieradata are gathered in one file (prefix.yaml
) and copied tomgmt
. The hieradata are mapped based on the prefix and parsed accordingly by Puppet.This approach differs from the task definition in the issue. Initially, the idea was to copy one file per prefix, but Terraform provisioners don't support dynamic, and the number of files is only known at runtime.
See https://github.com/ComputeCanada/puppet-magic_castle/pull/324 for puppet logic