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:
examples/complete
- complete example of using this module
Variables
Required Variables
artifactory_auth_token
(string
) requiredThe 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
) requiredThe base URI for artifactory.
artifactory_repository
(string
) requiredThe name of the artifactory repository.
key_label_order
(list(string)
) requiredThe 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
optionalA 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
optionalA 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
) optionalThe prefix to use for the key path. This is useful for storing all keys for a module under a common prefix.
Default value:
""
set
optionalA 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.
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:
restapi_object.write_kv_pair
(resource)
Data Sources
The following data sources are used by this module:
artifactory_file.read_kv_pair
(data source)artifactory_file.read_kv_path_file
(data source)artifactory_file_list.read_kv_path
(data source)context_config.this
(data source)