Skip to main content

Module: kv-store

This module is a key/value store for storing configuration data that should be shared among terraform root modules. The backend for this key/value store is a generic Artifactory repository.

Introduction

Usage

For a complete example, see examples/complete.

For automated tests of the complete example using bats and Terratest (which tests and deploys the example on AWS), see test.


module "example" {
source = "cloudposse/kv-store/artifactory"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

set = {
"key1" = {value = "value1", sensative = false }
"key2" = {value = "value2", sensative = true }
}

context = module.label.this
}

Quick Start

Here's how to get started...

Examples

Here is an example of using this module:

Variables

Required Variables

artifactory_auth_token (string) required

The authentication token to use when accessing artifactory. Getting this value from the environment is supported
with JFROG_ACCESS_TOKEN or ARTIFACTORY_ACCESS_TOKEN variables.


artifactory_base_uri (string) required

The base URI for artifactory.

artifactory_repository (string) required

The name of the artifactory repository.

key_label_order (list(string)) required

The order in which the labels (ID elements) appear in the full key path. For example, if you want a key path to
look like /{namespace}/{tenant}/{stage}/{environment}/name, you would set this varibale to
["namespace", "tenant", "stage", "environment", "name"].


Optional Variables

get optional

A map of keys to read from the key/value store. The key_path, namespace,
tenant, stage, environment, and name are derived from context by default,
but can be overridden by specifying a value in the map.



Type:

map(object(
{
key_path = optional(string),
properties = optional(map(string))
}
)
)

Default value: { }

get_by_path optional

A map of keys to read from the key/value store. The key_path, namespace,
tenant, stage, environment, and name are derived from context by default,
but can be overridden by specifying a value in the map.



Type:

map(object(
{
key_path = optional(string),
properties = optional(map(string))
}
)
)

Default value: { }

key_prefix (string) optional

The prefix to use for the key path. This is useful for storing all keys for a module under a common prefix.


Default value: ""

set optional

A map of key-value pairs to write to the key/value store. The key_path,
namespace, tenant, stage, environment, and name are derived from context by
default, but can be overridden by specifying a value in the map.



Type:

map(object(
{
key_path = optional(string),
value = string,
sensitive = bool,
properties = optional(map(string))
}
)
)

Default value: { }

Context Variables

The following variables are defined in the context.tf file of this module and part of the terraform-null-label pattern.

Outputs

values

the values retrieved with the kv store

Dependencies

Requirements

  • terraform, version: >= 1.0
  • artifactory, version: >= 10
  • context, version: >= 0.0.0
  • restapi, version: >= 1

Providers

  • artifactory, version: >= 10
  • context, version: >= 0.0.0
  • restapi, version: >= 1

Resources

The following resources are used by this module:

Data Sources

The following data sources are used by this module: