terraform-provider-hiera5

command module
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 4 Imported by: 0

README

Terraform Hiera 5 Provider

Go Report Card

This provider implements data sources that can be used to perform hierachical data lookups with Hiera.

This is useful for providing configuration values in an environment with a high level of dimensionality or for making values from an existing Puppet deployment available in Terraform.

It's based on Terraform hiera provider and SmilingNavern's fork

Goals

Requirements

Usage

Configuration

To configure the provider:

provider "hiera5" {
  # Optional
  config = "~/hiera.yaml"
  # Optional
  scope = {
    environment = "live"
    service     = "api"
    # Complex variables are supported using pdialect
    facts       = "{timezone=>'CET'}"
  }
  # Optional
  merge  = "deep"
}
Data Sources

This provider only implements data sources.

Hash

To retrieve a hash:

data "hiera5_hash" "aws_tags" {
    key = "aws_tags"
}

The following output parameters are returned:

  • id - matches the key
  • key - the queried key
  • value - the hash, represented as a map

Terraform doesn't support nested maps or other more complex data structures. Any keys containing nested elements won't be returned.

Array

To retrieve an array:

data "hiera5_array" "java_opts" {
    key = "java_opts"
}

The following output parameters are returned:

  • id - matches the key
  • key - the queried key
  • value - the array (list)
Value

To retrieve any other flat value:

data "hiera5" "aws_cloudwatch_enable" {
    key = "aws_cloudwatch_enable"
}

The following output parameters are returned:

  • id - matches the key
  • key - the queried key
  • value - the value

All values are returned as strings because Terraform doesn't implement other types like int, float or bool. The values will be implicitly converted into the appropriate type depending on usage.

Json

To retrieve anything JSON encoded:

data "hiera5_json" "aws_tags" {
    key = "aws_tags"
}

The following output parameters are returned:

  • id - matches the key
  • key - the queried key
  • value - the returned value, JSON encoded

As Terraform doesn't support nested maps or other more complex data structures this data source makes perfect fit dealing with complex values.

Example

Take a look at test-fixtures

Thanks to

Develpment

Requirements
  • Go 1.14+
Notes

This repository is vendored as recomended on Terraform's docs

Whishlist
  • Support overriding merge strategy in Data Sources
  • Support overriding scope variables in Data Sources

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL