Assigning two different element types to a variable of type "map" causes an error
The four variables (module inputs) of type map
mostly permit different types to be assigned to different elements, meaning the assigned type is incorrect and will cause Terraform errors. There are also some issues around default values (compared to the README).
This was found during implementation of https://gitlab.developers.cam.ac.uk/uis/devops/webcms/infrastructure/-/merge_requests/4 . Attempting to change the value of minimum_age
in the project using this module resulted in the following error:
│ on monitoring.tf line 43, in module "monitoring":
│ 43: tls_check = {
│ 44: # Enable alerting. Default: true
│ 45: alert_enabled = true
│ 46: # Minimum age of certificate. Default is 30 days.
│ 47: minimum_age = 13 # days
│ 48: }
│
│ The given value is not suitable for module.monitoring.var.tls_check declared at /terraform_data/modules/monitoring/variables.tf:76,1-21: all
│ map elements must have the same type.
Additionally, the default value of 30 days in the documentation isn't the same as the 27 in code.
Edited by Dave Hart