No commit activity in last 3 years
No release in over 3 years
Hiera backend for retrieving CloudFormation resource metadata and parsing it as a JSON data source
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Gem Version Badge

hiera-cfn-metadata

A Hiera backend for retrieving CloudFormation resource metadata and parsing it as a JSON data source.

Configuration

You should modify hiera.yaml as follows:

:backends:
    - cfn_metadata

:hierarchy:
    - %{::environment}
    - common

:cfn_metadata:
    :region:   # parsed from AWS_REGION if not specified
    :stack:    # parsed from CFN_STACK if not specified
    :resource: # parsed from CFN_RESOURCE if not specified

The :stack should be either the full stack name or ARN. The :resource should be the logical resource ID from the CloudFormation template.

Metadata

The specified resource's metadata will be parsed and each key treated as a datasource in the hierarchy, e.g.:

"MyLaunchConfig": {
  "Type": "AWS::AutoScaling::LaunchConfiguration",
  "Properties": {
    ...
  },
  "Metadata": {
    "common": {
      "foo": "bar",
      "packages": ["wget"]
    },
    "staging": {
      "foo": "baz",
      "packages": ["nmap"]
    },
    "production": {
      "foo": "quux"
    }
  }

Each datasource is parsed identically to the standard JSON backend. All data types and lookups are supported.

Credentials

Currently only instance-identity based authentication is supported, similarly to how cfn-get-metadata implements it. The advantage is that the user, role or instance profile needn't require the cloudformation:DescribeStackResource IAM action.

This is undocumented by AWS but has been implemented based on the Python code in cfn-bootstrap.