-users-client`. | `string` | `null` | no |
| [app\_clients](#input\_app\_clients) | List of Cognito application clients to create. This wrapper intentionally supports the shared-resources OAuth client pattern rather than the full upstream clients surface. | list(object({
name = optional(string)
callback_urls = list(string)
logout_urls = optional(list(string), [])
default_redirect_uri = optional(string)
generate_secret = optional(bool, true)
auth_session_validity = optional(number, 3)
enable_propagate_additional_user_context_data = optional(bool, false)
id_token_validity = optional(number, 1) # hours (Cognito default unit)
refresh_token_validity = optional(number, 30) # days (Cognito default unit)
prevent_user_existence_errors = optional(string)
enable_token_revocation = optional(bool, true)
})) | `[]` | no |
+| [application\_role](#input\_application\_role) | The role the application is performing | `string` | `"General"` | no |
| [attribute\_names](#input\_attribute\_names) | Compatibility list of simple string schema attributes. Used to derive string\_schemas when string\_schemas is empty. | `list(string)` | [
"acr",
"amr",
"email",
"idassurancelevel",
"nhsid_nrbac_roles",
"bcss_username",
"sid",
"uid"
]
| no |
-| [aws\_region](#input\_aws\_region) | AWS region used for derived Cognito hosted UI outputs. | `string` | `"eu-west-2"` | 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 |
+| [aws\_region](#input\_aws\_region) | The AWS region | `string` | `"eu-west-2"` | no |
| [bootstrap\_users](#input\_bootstrap\_users) | Optional list of bootstrap Cognito users to create. This covers the current BCSS stack pattern where initial training or shared users are provisioned during stack deployment. | list(object({
uuid = string
bcss_username = string
id_assurance_level = string
rbac_role = string
user_password = optional(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,
"project": null,
"regex_replace_chars": null,
"region": null,
"service": null,
"stack": null,
"tags": {},
"terraform_source": null,
"workspace": null
} | no |
| [create](#input\_create) | Determines whether Cognito resources will be created. | `bool` | `true` | no |
+| [data\_classification](#input\_data\_classification) | Used to identify the data classification of the resource, e.g 1-5 | `string` | `"n/a"` | no |
+| [data\_type](#input\_data\_type) | The tag data\_type | `string` | `"None"` | no |
| [deletion\_protection](#input\_deletion\_protection) | Deletion protection setting for the user pool. Valid values are ACTIVE and INACTIVE. | `string` | `"INACTIVE"` | 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 |
| [domain](#input\_domain) | Optional Cognito user pool domain prefix. Defaults to `module.this.id`. | `string` | `null` | no |
-| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources. | `bool` | `null` | no |
-| [environment](#input\_environment) | Environment identifier used by the shared tags module. | `string` | `null` | no |
+| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
+| [environment](#input\_environment) | ID element. Usually used to indicate role, e.g. 'prd', 'dev', 'test', 'preprod', 'prod', 'uat' | `string` | `null` | no |
+| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no |
+| [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.
Does not affect keys of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no |
+| [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
+| [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
Default value: `lower`. | `string` | `null` | no |
+| [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.
Default is to include all labels.
Tags with empty values will not be included in the `tags` output.
Set to `[]` to suppress all generated tags.
**Notes:**
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | [
"default"
]
| no |
| [message\_action](#input\_message\_action) | Message action for bootstrap Cognito user creation. Defaults to SUPPRESS to match the current BCSS stacks. | `string` | `"SUPPRESS"` | no |
| [mfa\_configuration](#input\_mfa\_configuration) | MFA setting for the user pool. Valid values are ON, OFF, or OPTIONAL. | `string` | `"OFF"` | no |
-| [name](#input\_name) | Name identifier used by the shared tags module. | `string` | `null` | no |
+| [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
+| [on\_off\_pattern](#input\_on\_off\_pattern) | Used to turn resources on and off based on a time pattern | `string` | `"n/a"` | no |
+| [owner](#input\_owner) | The name and or NHS.net email address of the service owner | `string` | `"None"` | no |
| [password\_policy](#input\_password\_policy) | Password policy for the Cognito user pool. | object({
minimum_length = optional(number, 8)
require_lowercase = optional(bool, true)
require_numbers = optional(bool, true)
require_symbols = optional(bool, true)
require_uppercase = optional(bool, true)
temporary_password_validity_days = optional(number, 7)
password_history_size = optional(number, 0)
}) | `{}` | no |
-| [project](#input\_project) | Project identifier used by the shared tags module. | `string` | `null` | no |
+| [project](#input\_project) | ID element. A project identifier, indicating the name or role of the project the resource is for, such as `website` or `api` | `string` | `null` | no |
+| [public\_facing](#input\_public\_facing) | Whether this resource is public facing | `bool` | `false` | no |
| [recovery\_mechanisms](#input\_recovery\_mechanisms) | Account recovery mechanisms for the user pool. Defaults to email only. Avoid including verified\_phone\_number unless an explicit sms\_configuration SNS caller role is provided — doing so forces iam:PassRole on the caller role which may be denied by restrictive IAM policies. | list(object({
name = string
priority = number
})) | [
{
"name": "verified_email",
"priority": 1
}
]
| no |
-| [service](#input\_service) | Service identifier used by the shared tags module. | `string` | `null` | no |
-| [tags](#input\_tags) | Additional tags merged with any tags supplied through the context object. | `map(string)` | `{}` | no |
+| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
+| [region](#input\_region) | ID element \_(Rarely used, not included by default)\_. Usually an abbreviation of the selected AWS region e.g. 'uw2', 'ew2' or 'gbl' for resources like IAM roles that have no region | `string` | `null` | no |
+| [service](#input\_service) | ID element. Usually an abbreviation of your service directorate name, e.g. 'bcss' or 'csms', to help ensure generated IDs are globally unique | `string` | `null` | no |
+| [service\_category](#input\_service\_category) | The tag service\_category | `string` | `"n/a"` | no |
+| [stack](#input\_stack) | ID element. The name of the stack/component, e.g. `database`, `web`, `waf`, `eks` | `string` | `null` | no |
+| [tag\_version](#input\_tag\_version) | Used to identify the tagging version in use | `string` | `"1.0"` | no |
+| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to the caller module path when not set. | `string` | `null` | no |
+| [tool](#input\_tool) | The tool used to deploy the resource | `string` | `"Terraform"` | no |
| [user\_email](#input\_user\_email) | Email attribute applied to bootstrap Cognito users. | `string` | `"nhsdigital.axe@nhs.net"` | no |
| [user\_password](#input\_user\_password) | Fallback password for bootstrap Cognito users when an individual bootstrap\_users entry does not provide user\_password. | `string` | `"changeme"` | no |
| [user\_pool\_name](#input\_user\_pool\_name) | Override for the Cognito user pool name. Defaults to `-users-pool`. | `string` | `null` | no |
| [user\_pool\_tier](#input\_user\_pool\_tier) | Cognito User Pool tier. LITE avoids iam:PassRole requirements from ESSENTIALS/PLUS threat-protection features. Valid values: LITE, ESSENTIALS, PLUS. | `string` | `"LITE"` | no |
+| [workspace](#input\_workspace) | ID element. The Terraform workspace, to help ensure generated IDs are unique across workspaces | `string` | `null` | no |
## Outputs
diff --git a/infrastructure/modules/cognito/context.tf b/infrastructure/modules/cognito/context.tf
index 0e99c0b4..e934a84f 100644
--- a/infrastructure/modules/cognito/context.tf
+++ b/infrastructure/modules/cognito/context.tf
@@ -22,37 +22,38 @@
#
module "this" {
- source = "git::https://github.com/NHSDigital/screening-terraform-modules-aws.git//infrastructure/modules/tags?ref=v2.6.0"
-
- enabled = coalesce(var.enabled, lookup(var.context, "enabled", true))
- service = coalesce(var.service, lookup(var.context, "service", null))
- project = coalesce(var.project, lookup(var.context, "project", null))
- region = lookup(var.context, "region", null)
- environment = coalesce(var.environment, lookup(var.context, "environment", null))
- stack = lookup(var.context, "stack", null)
- workspace = lookup(var.context, "workspace", null)
- name = coalesce(var.name, lookup(var.context, "name", null))
- delimiter = lookup(var.context, "delimiter", null)
- attributes = lookup(var.context, "attributes", [])
- tags = merge(lookup(var.context, "tags", {}), var.tags)
- additional_tag_map = lookup(var.context, "additional_tag_map", {})
- label_order = lookup(var.context, "label_order", [])
- regex_replace_chars = lookup(var.context, "regex_replace_chars", null)
- id_length_limit = lookup(var.context, "id_length_limit", null)
- label_key_case = lookup(var.context, "label_key_case", null)
- label_value_case = lookup(var.context, "label_value_case", null)
- terraform_source = coalesce(var.terraform_source, lookup(var.context, "terraform_source", null), path.module)
- descriptor_formats = lookup(var.context, "descriptor_formats", {})
- labels_as_tags = toset(lookup(var.context, "labels_as_tags", ["unset"]))
+ source = "../tags"
+
+ enabled = var.enabled
+ service = var.service
+ project = var.project
+ region = var.region
+ environment = var.environment
+ stack = var.stack
+ workspace = var.workspace
+ name = var.name
+ delimiter = var.delimiter
+ attributes = var.attributes
+ tags = var.tags
+ additional_tag_map = var.additional_tag_map
+ label_order = var.label_order
+ regex_replace_chars = var.regex_replace_chars
+ id_length_limit = var.id_length_limit
+ label_key_case = var.label_key_case
+ label_value_case = var.label_value_case
+ terraform_source = coalesce(var.terraform_source, path.module)
+ descriptor_formats = var.descriptor_formats
+ labels_as_tags = var.labels_as_tags
context = var.context
}
+# Copy contents of screening-terraform-modules-aws/tags/variables.tf here
+# tflint-ignore: terraform_unused_declarations
variable "aws_region" {
type = string
- description = "AWS region used for derived Cognito hosted UI outputs."
+ description = "The AWS region"
default = "eu-west-2"
-
validation {
condition = contains(["eu-west-1", "eu-west-2", "us-east-1"], var.aws_region)
error_message = "AWS Region must be one of eu-west-1, eu-west-2, us-east-1"
@@ -81,7 +82,14 @@ variable "context" {
label_value_case = null
terraform_source = null
descriptor_formats = {}
- labels_as_tags = ["unset"]
+ # Note: we have to use [] instead of null for unset lists due to
+ # https://github.com/hashicorp/terraform/issues/28137
+ # which was not fixed until Terraform 1.0.0,
+ # but we want the default to be all the labels in `label_order`
+ # and we want users to be able to prevent all tag generation
+ # by setting `labels_as_tags` to `[]`, so we need
+ # a different sentinel to indicate "default"
+ labels_as_tags = ["unset"]
}
description = <<-EOT
Single object for setting entire context at once.
@@ -111,35 +119,258 @@ variable "terraform_source" {
variable "enabled" {
type = bool
default = null
- description = "Set to false to prevent the module from creating any resources."
+ description = "Set to false to prevent the module from creating any resources"
}
variable "service" {
type = string
default = null
- description = "Service identifier used by the shared tags module."
+ description = "ID element. Usually an abbreviation of your service directorate name, e.g. 'bcss' or 'csms', to help ensure generated IDs are globally unique"
}
-variable "project" {
+variable "region" {
type = string
default = null
- description = "Project identifier used by the shared tags module."
+ description = "ID element _(Rarely used, not included by default)_. Usually an abbreviation of the selected AWS region e.g. 'uw2', 'ew2' or 'gbl' for resources like IAM roles that have no region"
}
+variable "project" {
+ type = string
+ default = null
+ description = "ID element. A project identifier, indicating the name or role of the project the resource is for, such as `website` or `api`"
+}
+variable "stack" {
+ type = string
+ default = null
+ description = "ID element. The name of the stack/component, e.g. `database`, `web`, `waf`, `eks`"
+}
+variable "workspace" {
+ type = string
+ default = null
+ description = "ID element. The Terraform workspace, to help ensure generated IDs are unique across workspaces"
+}
variable "environment" {
type = string
default = null
- description = "Environment identifier used by the shared tags module."
+ description = "ID element. Usually used to indicate role, e.g. 'prd', 'dev', 'test', 'preprod', 'prod', 'uat'"
}
variable "name" {
type = string
default = null
- description = "Name identifier used by the shared tags module."
+ description = <<-EOT
+ ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
+ This is the only ID element not also included as a `tag`.
+ The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input.
+ EOT
+}
+
+variable "delimiter" {
+ type = string
+ default = null
+ description = <<-EOT
+ Delimiter to be used between ID elements.
+ Defaults to `-` (hyphen). Set to `""` to use no delimiter at all.
+ EOT
+}
+
+variable "attributes" {
+ type = list(string)
+ default = []
+ description = <<-EOT
+ 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.
+ EOT
+}
+
+variable "labels_as_tags" {
+ type = set(string)
+ default = ["default"]
+ description = <<-EOT
+ Set of labels (ID elements) to include as tags in the `tags` output.
+ Default is to include all labels.
+ Tags with empty values will not be included in the `tags` output.
+ Set to `[]` to suppress all generated tags.
+ **Notes:**
+ The value of the `name` tag, if included, will be the `id`, not the `name`.
+ Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
+ changed in later chained modules. Attempts to change it will be silently ignored.
+ EOT
}
variable "tags" {
type = map(string)
default = {}
- description = "Additional tags merged with any tags supplied through the context object."
+ description = <<-EOT
+ Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
+ Neither the tag keys nor the tag values will be modified by this module.
+ EOT
+}
+
+variable "additional_tag_map" {
+ type = map(string)
+ default = {}
+ description = <<-EOT
+ 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.
+ EOT
+}
+
+variable "label_order" {
+ type = list(string)
+ default = null
+ description = <<-EOT
+ The order in which the labels (ID elements) appear in the `id`.
+ Defaults to ["namespace", "environment", "stage", "name", "attributes"].
+ You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present.
+ EOT
}
+
+variable "regex_replace_chars" {
+ type = string
+ default = null
+ description = <<-EOT
+ Terraform regular expression (regex) string.
+ Characters matching the regex will be removed from the ID elements.
+ If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits.
+ EOT
+}
+
+variable "id_length_limit" {
+ type = number
+ default = null
+ description = <<-EOT
+ Limit `id` to this many characters (minimum 6).
+ Set to `0` for unlimited length.
+ Set to `null` for keep the existing setting, which defaults to `0`.
+ Does not affect `id_full`.
+ EOT
+ validation {
+ condition = var.id_length_limit == null ? true : var.id_length_limit >= 6 || var.id_length_limit == 0
+ error_message = "The id_length_limit must be >= 6 if supplied (not null), or 0 for unlimited length."
+ }
+}
+
+variable "label_key_case" {
+ type = string
+ default = null
+ description = <<-EOT
+ Controls the letter case of the `tags` keys (label names) for tags generated by this module.
+ Does not affect keys of tags passed in via the `tags` input.
+ Possible values: `lower`, `title`, `upper`.
+ Default value: `title`.
+ EOT
+
+ validation {
+ condition = var.label_key_case == null ? true : contains(["lower", "title", "upper"], var.label_key_case)
+ error_message = "Allowed values: `lower`, `title`, `upper`."
+ }
+}
+
+variable "label_value_case" {
+ type = string
+ default = null
+ description = <<-EOT
+ Controls the letter case of ID elements (labels) as included in `id`,
+ set as tag values, and output by this module individually.
+ Does not affect values of tags passed in via the `tags` input.
+ Possible values: `lower`, `title`, `upper` and `none` (no transformation).
+ Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
+ Default value: `lower`.
+ EOT
+
+ validation {
+ condition = var.label_value_case == null ? true : contains(["lower", "title", "upper", "none"], var.label_value_case)
+ error_message = "Allowed values: `lower`, `title`, `upper`, `none`."
+ }
+}
+
+variable "descriptor_formats" {
+ type = any
+ default = {}
+ description = <<-EOT
+ 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).
+ EOT
+}
+
+variable "owner" {
+ type = string
+ description = "The name and or NHS.net email address of the service owner"
+ default = "None"
+}
+
+variable "tag_version" {
+ type = string
+ description = "Used to identify the tagging version in use"
+ default = "1.0"
+}
+
+variable "data_classification" {
+ type = string
+ description = "Used to identify the data classification of the resource, e.g 1-5"
+ default = "n/a"
+ validation {
+ condition = contains(["n/a", "1", "2", "3", "4", "5"], var.data_classification)
+ error_message = "Data Classification must be \"n/a\" or between 1-5"
+ }
+}
+
+variable "data_type" {
+ type = string
+ description = "The tag data_type"
+ default = "None"
+ validation {
+ condition = contains(["None", "PCD", "PID", "Anonymised", "UserAccount", "Audit"], var.data_type)
+ error_message = "Data Type must be one of None, PCD, PID, Anonymised, UserAccount, Audit"
+ }
+}
+
+
+variable "public_facing" {
+ type = bool
+ description = "Whether this resource is public facing"
+ default = false
+}
+
+variable "service_category" {
+ type = string
+ description = "The tag service_category"
+ default = "n/a"
+ validation {
+ condition = contains(["n/a", "Bronze", "Silver", "Gold", "Platinum"], var.service_category)
+ error_message = "The Service Category must be one of n/a, Bronze, Silver, Gold, Platinum"
+ }
+}
+variable "on_off_pattern" {
+ type = string
+ description = "Used to turn resources on and off based on a time pattern"
+ default = "n/a"
+}
+
+variable "application_role" {
+ type = string
+ description = "The role the application is performing"
+ default = "General"
+}
+
+variable "tool" {
+ type = string
+ description = "The tool used to deploy the resource"
+ default = "Terraform"
+}
+
+#### End of copy of screening-terraform-modules-aws/tags/variables.tf
diff --git a/infrastructure/modules/dynamodb/context.tf b/infrastructure/modules/dynamodb/context.tf
index 9a4652b0..e934a84f 100644
--- a/infrastructure/modules/dynamodb/context.tf
+++ b/infrastructure/modules/dynamodb/context.tf
@@ -22,7 +22,6 @@
#
module "this" {
- # tflint-ignore: terraform_module_pinned_source
source = "../tags"
enabled = var.enabled
diff --git a/infrastructure/modules/ec2-instance/context.tf b/infrastructure/modules/ec2-instance/context.tf
index 9a618553..e934a84f 100644
--- a/infrastructure/modules/ec2-instance/context.tf
+++ b/infrastructure/modules/ec2-instance/context.tf
@@ -24,6 +24,7 @@
module "this" {
source = "../tags"
+ enabled = var.enabled
service = var.service
project = var.project
region = var.region
diff --git a/infrastructure/modules/ecs-service/README.md b/infrastructure/modules/ecs-service/README.md
index 98627006..467c1d41 100644
--- a/infrastructure/modules/ecs-service/README.md
+++ b/infrastructure/modules/ecs-service/README.md
@@ -424,7 +424,7 @@ No resources.
| [tasks\_iam\_role\_statements](#input\_tasks\_iam\_role\_statements) | A map of IAM policy statements for custom permission usage | list(object({
sid = optional(string)
actions = optional(list(string))
not_actions = optional(list(string))
effect = optional(string)
resources = optional(list(string))
not_resources = optional(list(string))
principals = optional(list(object({
type = string
identifiers = list(string)
})))
not_principals = optional(list(object({
type = string
identifiers = list(string)
})))
condition = optional(list(object({
test = string
values = list(string)
variable = string
})))
})) | `null` | no |
| [tasks\_iam\_role\_tags](#input\_tasks\_iam\_role\_tags) | A map of additional tags to add to the IAM role created | `map(string)` | `{}` | no |
| [tasks\_iam\_role\_use\_name\_prefix](#input\_tasks\_iam\_role\_use\_name\_prefix) | Determines whether the IAM role name (`tasks_iam_role_name`) is used as a prefix | `bool` | `true` | no |
-| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to this module path. | `string` | `null` | no |
+| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to the caller module path when not set. | `string` | `null` | no |
| [timeouts](#input\_timeouts) | Create, update, and delete timeout configurations for the service | object({
create = optional(string)
delete = optional(string)
update = optional(string)
}) | `null` | no |
| [tool](#input\_tool) | The tool used to deploy the resource | `string` | `"Terraform"` | no |
| [track\_latest](#input\_track\_latest) | Whether should track latest `ACTIVE` task definition on AWS or the one created with the resource stored in state. Useful in the event the task definition is modified outside of this resource | `bool` | `true` | no |
diff --git a/infrastructure/modules/ecs-service/context.tf b/infrastructure/modules/ecs-service/context.tf
index 62befcb0..e934a84f 100644
--- a/infrastructure/modules/ecs-service/context.tf
+++ b/infrastructure/modules/ecs-service/context.tf
@@ -113,7 +113,7 @@ variable "context" {
variable "terraform_source" {
type = string
default = null
- description = "Source location to record in the Terraform_source tag. Defaults to this module path."
+ description = "Source location to record in the Terraform_source tag. Defaults to the caller module path when not set."
}
variable "enabled" {
diff --git a/infrastructure/modules/efs/context.tf b/infrastructure/modules/efs/context.tf
index 9a4652b0..e934a84f 100644
--- a/infrastructure/modules/efs/context.tf
+++ b/infrastructure/modules/efs/context.tf
@@ -22,7 +22,6 @@
#
module "this" {
- # tflint-ignore: terraform_module_pinned_source
source = "../tags"
enabled = var.enabled
diff --git a/infrastructure/modules/network-firewall/README.md b/infrastructure/modules/network-firewall/README.md
index 00e2600d..2e8f2647 100644
--- a/infrastructure/modules/network-firewall/README.md
+++ b/infrastructure/modules/network-firewall/README.md
@@ -414,7 +414,7 @@ resource "aws_networkfirewall_rule_group" "shared_threat_feed" {
| [subnet\_change\_protection](#input\_subnet\_change\_protection) | Prevent changes to the associated subnets. | `bool` | `true` | no |
| [tag\_version](#input\_tag\_version) | Used to identify the tagging version in use | `string` | `"1.0"` | no |
| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
-| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to this module path. | `string` | `null` | no |
+| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to the caller module path when not set. | `string` | `null` | no |
| [tool](#input\_tool) | The tool used to deploy the resource | `string` | `"Terraform"` | no |
| [vpc\_id](#input\_vpc\_id) | The ID of the VPC where the Network Firewall will be deployed. | `string` | n/a | yes |
| [workspace](#input\_workspace) | ID element. The Terraform workspace, to help ensure generated IDs are unique across workspaces | `string` | `null` | no |
diff --git a/infrastructure/modules/network-firewall/context.tf b/infrastructure/modules/network-firewall/context.tf
index 62befcb0..e934a84f 100644
--- a/infrastructure/modules/network-firewall/context.tf
+++ b/infrastructure/modules/network-firewall/context.tf
@@ -113,7 +113,7 @@ variable "context" {
variable "terraform_source" {
type = string
default = null
- description = "Source location to record in the Terraform_source tag. Defaults to this module path."
+ description = "Source location to record in the Terraform_source tag. Defaults to the caller module path when not set."
}
variable "enabled" {
diff --git a/infrastructure/modules/r53/context.tf b/infrastructure/modules/r53/context.tf
index 9a4652b0..e934a84f 100644
--- a/infrastructure/modules/r53/context.tf
+++ b/infrastructure/modules/r53/context.tf
@@ -22,7 +22,6 @@
#
module "this" {
- # tflint-ignore: terraform_module_pinned_source
source = "../tags"
enabled = var.enabled
diff --git a/infrastructure/modules/rds/README.md b/infrastructure/modules/rds/README.md
index ded4b9ad..a2f2986a 100644
--- a/infrastructure/modules/rds/README.md
+++ b/infrastructure/modules/rds/README.md
@@ -376,7 +376,7 @@ When migrating from `../../modules/rds` in the bcss repo to this shared module,
| [subnet\_ids](#input\_subnet\_ids) | List of VPC subnet IDs for the DB subnet group | `list(string)` | n/a | yes |
| [tag\_version](#input\_tag\_version) | Used to identify the tagging version in use | `string` | `"1.0"` | no |
| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
-| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to this module path. | `string` | `null` | no |
+| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to the caller module path when not set. | `string` | `null` | no |
| [timeouts](#input\_timeouts) | Terraform resource management timeouts for the DB instance | object({
create = optional(string)
update = optional(string)
delete = optional(string)
}) | `null` | no |
| [tool](#input\_tool) | The tool used to deploy the resource | `string` | `"Terraform"` | no |
| [username](#input\_username) | Username for the master DB user | `string` | n/a | yes |
diff --git a/infrastructure/modules/rds/context.tf b/infrastructure/modules/rds/context.tf
index 62befcb0..e934a84f 100644
--- a/infrastructure/modules/rds/context.tf
+++ b/infrastructure/modules/rds/context.tf
@@ -113,7 +113,7 @@ variable "context" {
variable "terraform_source" {
type = string
default = null
- description = "Source location to record in the Terraform_source tag. Defaults to this module path."
+ description = "Source location to record in the Terraform_source tag. Defaults to the caller module path when not set."
}
variable "enabled" {
diff --git a/infrastructure/modules/sqs/context.tf b/infrastructure/modules/sqs/context.tf
index 9a4652b0..e934a84f 100644
--- a/infrastructure/modules/sqs/context.tf
+++ b/infrastructure/modules/sqs/context.tf
@@ -22,7 +22,6 @@
#
module "this" {
- # tflint-ignore: terraform_module_pinned_source
source = "../tags"
enabled = var.enabled
diff --git a/infrastructure/modules/ssm-parameter/README.md b/infrastructure/modules/ssm-parameter/README.md
index 6b25b394..469b2200 100644
--- a/infrastructure/modules/ssm-parameter/README.md
+++ b/infrastructure/modules/ssm-parameter/README.md
@@ -343,7 +343,7 @@ The following constraints are enforced at `plan` time and prevent invalid config
| [stack](#input\_stack) | ID element. The name of the stack/component, e.g. `database`, `web`, `waf`, `eks` | `string` | `null` | no |
| [tag\_version](#input\_tag\_version) | Used to identify the tagging version in use | `string` | `"1.0"` | no |
| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no |
-| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to this module path. | `string` | `null` | no |
+| [terraform\_source](#input\_terraform\_source) | Source location to record in the Terraform\_source tag. Defaults to the caller module path when not set. | `string` | `null` | no |
| [tier](#input\_tier) | Parameter tier to assign to the parameter. If not specified, will use the default parameter tier for the region. Valid tiers are Standard, Advanced, and Intelligent-Tiering. Downgrading an Advanced tier parameter to Standard will recreate the resource | `string` | `null` | no |
| [tool](#input\_tool) | The tool used to deploy the resource | `string` | `"Terraform"` | no |
| [type](#input\_type) | Type of the parameter. Valid types are `String`, `StringList` and `SecureString` | `string` | n/a | yes |
diff --git a/infrastructure/modules/ssm-parameter/context.tf b/infrastructure/modules/ssm-parameter/context.tf
index 62befcb0..e934a84f 100644
--- a/infrastructure/modules/ssm-parameter/context.tf
+++ b/infrastructure/modules/ssm-parameter/context.tf
@@ -113,7 +113,7 @@ variable "context" {
variable "terraform_source" {
type = string
default = null
- description = "Source location to record in the Terraform_source tag. Defaults to this module path."
+ description = "Source location to record in the Terraform_source tag. Defaults to the caller module path when not set."
}
variable "enabled" {
diff --git a/infrastructure/modules/vpc-endpoint/context.tf b/infrastructure/modules/vpc-endpoint/context.tf
index b644ebfb..e934a84f 100644
--- a/infrastructure/modules/vpc-endpoint/context.tf
+++ b/infrastructure/modules/vpc-endpoint/context.tf
@@ -1,6 +1,5 @@
# tflint-ignore-file: terraform_standard_module_structure, terraform_unused_declarations
#
-#
# ONLY EDIT THIS FILE IN github.com/NHSDigital/screening-terraform-modules-aws/infrastructure/modules/tags
# All other instances of this file should be a copy of that one
#
diff --git a/infrastructure/modules/vpc/context.tf b/infrastructure/modules/vpc/context.tf
index b644ebfb..e934a84f 100644
--- a/infrastructure/modules/vpc/context.tf
+++ b/infrastructure/modules/vpc/context.tf
@@ -1,6 +1,5 @@
# tflint-ignore-file: terraform_standard_module_structure, terraform_unused_declarations
#
-#
# ONLY EDIT THIS FILE IN github.com/NHSDigital/screening-terraform-modules-aws/infrastructure/modules/tags
# All other instances of this file should be a copy of that one
#
diff --git a/infrastructure/modules/waf/context.tf b/infrastructure/modules/waf/context.tf
index dd1e2a1f..e934a84f 100644
--- a/infrastructure/modules/waf/context.tf
+++ b/infrastructure/modules/waf/context.tf
@@ -82,7 +82,14 @@ variable "context" {
label_value_case = null
terraform_source = null
descriptor_formats = {}
- labels_as_tags = ["unset"]
+ # Note: we have to use [] instead of null for unset lists due to
+ # https://github.com/hashicorp/terraform/issues/28137
+ # which was not fixed until Terraform 1.0.0,
+ # but we want the default to be all the labels in `label_order`
+ # and we want users to be able to prevent all tag generation
+ # by setting `labels_as_tags` to `[]`, so we need
+ # a different sentinel to indicate "default"
+ labels_as_tags = ["unset"]
}
description = <<-EOT
Single object for setting entire context at once.
@@ -132,19 +139,16 @@ variable "project" {
default = null
description = "ID element. A project identifier, indicating the name or role of the project the resource is for, such as `website` or `api`"
}
-
variable "stack" {
type = string
default = null
description = "ID element. The name of the stack/component, e.g. `database`, `web`, `waf`, `eks`"
}
-
variable "workspace" {
type = string
default = null
description = "ID element. The Terraform workspace, to help ensure generated IDs are unique across workspaces"
}
-
variable "environment" {
type = string
default = null
@@ -158,7 +162,7 @@ variable "name" {
ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input.
- EOT
+ EOT
}
variable "delimiter" {
@@ -178,7 +182,7 @@ variable "attributes" {
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.
- EOT
+ EOT
}
variable "labels_as_tags" {
@@ -193,7 +197,7 @@ variable "labels_as_tags" {
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored.
- EOT
+ EOT
}
variable "tags" {
@@ -202,7 +206,7 @@ variable "tags" {
description = <<-EOT
Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module.
- EOT
+ EOT
}
variable "additional_tag_map" {
@@ -212,7 +216,7 @@ variable "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.
- EOT
+ EOT
}
variable "label_order" {
@@ -222,7 +226,7 @@ variable "label_order" {
The order in which the labels (ID elements) appear in the `id`.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present.
- EOT
+ EOT
}
variable "regex_replace_chars" {
@@ -244,7 +248,6 @@ variable "id_length_limit" {
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`.
EOT
-
validation {
condition = var.id_length_limit == null ? true : var.id_length_limit >= 6 || var.id_length_limit == 0
error_message = "The id_length_limit must be >= 6 if supplied (not null), or 0 for unlimited length."
@@ -301,7 +304,7 @@ variable "descriptor_formats" {
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).
- EOT
+ EOT
}
variable "owner" {
@@ -320,7 +323,6 @@ variable "data_classification" {
type = string
description = "Used to identify the data classification of the resource, e.g 1-5"
default = "n/a"
-
validation {
condition = contains(["n/a", "1", "2", "3", "4", "5"], var.data_classification)
error_message = "Data Classification must be \"n/a\" or between 1-5"
@@ -331,13 +333,13 @@ variable "data_type" {
type = string
description = "The tag data_type"
default = "None"
-
validation {
condition = contains(["None", "PCD", "PID", "Anonymised", "UserAccount", "Audit"], var.data_type)
error_message = "Data Type must be one of None, PCD, PID, Anonymised, UserAccount, Audit"
}
}
+
variable "public_facing" {
type = bool
description = "Whether this resource is public facing"
@@ -348,13 +350,11 @@ variable "service_category" {
type = string
description = "The tag service_category"
default = "n/a"
-
validation {
condition = contains(["n/a", "Bronze", "Silver", "Gold", "Platinum"], var.service_category)
error_message = "The Service Category must be one of n/a, Bronze, Silver, Gold, Platinum"
}
}
-
variable "on_off_pattern" {
type = string
description = "Used to turn resources on and off based on a time pattern"