diff --git a/README.md b/README.md index 4ef4386..8e41142 100644 --- a/README.md +++ b/README.md @@ -270,8 +270,10 @@ No resources. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.
This is for some rare cases where resources want additional configuration of tags
and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no | +| [append\_list\_enabled](#input\_append\_list\_enabled) | A boolean flag to enable/disable appending lists instead of overwriting them. | `bool` | `false` | no | | [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,
in the order they appear in the list. New attributes are appended to the
end of the list. The elements of the list are joined by the `delimiter`
and treated as a single ID element. | `list(string)` | `[]` | no | | [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. | `any` |
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
| no | +| [deep\_copy\_list\_enabled](#input\_deep\_copy\_list\_enabled) | A boolean flag to enable/disable merging of list elements one by one. | `bool` | `false` | no | | [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | | [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
`labels` is a list of labels, in order, to pass to `format()` function.
Label values will be normalized before being passed to `format()` so they will be
identical to how they appear in `id`.
Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no | | [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | diff --git a/docs/terraform.md b/docs/terraform.md index ef13ff2..e3b7339 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -38,8 +38,10 @@ No resources. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.
This is for some rare cases where resources want additional configuration of tags
and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no | +| [append\_list\_enabled](#input\_append\_list\_enabled) | A boolean flag to enable/disable appending lists instead of overwriting them. | `bool` | `false` | no | | [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,
in the order they appear in the list. New attributes are appended to the
end of the list. The elements of the list are joined by the `delimiter`
and treated as a single ID element. | `list(string)` | `[]` | no | | [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. | `any` |
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
| no | +| [deep\_copy\_list\_enabled](#input\_deep\_copy\_list\_enabled) | A boolean flag to enable/disable merging of list elements one by one. | `bool` | `false` | no | | [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | | [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
`labels` is a list of labels, in order, to pass to `format()` function.
Label values will be normalized before being passed to `format()` so they will be
identical to how they appear in `id`.
Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no | | [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | diff --git a/main.tf b/main.tf index 7d047d4..19bd3eb 100644 --- a/main.tf +++ b/main.tf @@ -8,6 +8,8 @@ module "yaml_config_1" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -23,6 +25,8 @@ module "yaml_config_2" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -38,6 +42,8 @@ module "yaml_config_3" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -53,6 +59,8 @@ module "yaml_config_4" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -68,6 +76,8 @@ module "yaml_config_5" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -83,6 +93,8 @@ module "yaml_config_6" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -98,6 +110,8 @@ module "yaml_config_7" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -113,6 +127,8 @@ module "yaml_config_8" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -128,6 +144,8 @@ module "yaml_config_9" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } @@ -143,6 +161,8 @@ module "yaml_config_10" { list_config_paths = var.list_config_paths parameters = var.parameters remote_config_selector = var.remote_config_selector + append_list_enabled = var.append_list_enabled + deep_copy_list_enabled = var.deep_copy_list_enabled context = module.this.context } diff --git a/variables.tf b/variables.tf index 9342eb6..cd621f2 100644 --- a/variables.tf +++ b/variables.tf @@ -51,3 +51,15 @@ variable "map_configs" { description = "List of existing configurations of map type. Deep-merging of the existing map configs takes precedence over the map configs loaded from YAML files" default = [] } + +variable "append_list_enabled" { + type = bool + description = "A boolean flag to enable/disable appending lists instead of overwriting them." + default = false +} + +variable "deep_copy_list_enabled" { + type = bool + description = "A boolean flag to enable/disable merging of list elements one by one." + default = false +}