chriskuchin / terraform-provider-hiera5

MIT License
10 stars 3 forks source link

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:

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:

Value

To retrieve any other flat value:

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

The following output parameters are returned:

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:

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

Notes

This repository is vendored as recomended on Terraform's docs

Whishlist