I passed thenginx_config variable into the eks-monitoring module and the variable configuration does not match the underlying patterns/nginx modules input variable.
Error Seen
╷
│ Error: Invalid value for input variable
│
│ on .terraform/modules/eks_monitoring/modules/eks-monitoring/main.tf line 238, in module "nginx_monitoring":
│ 238: pattern_config = coalesce(var.nginx_config, local.nginx_pattern_config)
│
│ The given value is not suitable for
│ module.eks_monitoring.module.nginx_monitoring[0].var.pattern_config
│ declared at
│ .terraform/modules/eks_monitoring/modules/eks-monitoring/patterns/nginx/variables.tf:1,1-26:
│ map has no element for required attribute
│ "managed_prometheus_workspace_id".
╵
module "nginx_monitoring" {
source = "./patterns/nginx"
count = var.enable_nginx ? 1 : 0
pattern_config = coalesce(var.nginx_config, local.nginx_pattern_config) <---- Passes incorrect parameter if var.nginx_config is set
}
Additional Information
The nginx pattern module should be using `merge` instead of `coalesce` so that internal configurations are not lost.
Implementing the configuration is painful as well since all I needed was to set the `scrape_sample_limit` without overriding anything else.
I will open a PR to allow optional configuration of all nginx_config variable elements and pass the correct parameters to the submodule.
Welcome to the AWS Observability Accelerator
AWS Observability Accelerator Release version
2.12.0
What is your environment, configuration and the example used?
Terraform 1.7.2
Error occurs when running
terraform plan
What did you do and What did you see instead?
I passed the
nginx_config
variable into the eks-monitoring module and the variable configuration does not match the underlyingpatterns/nginx
modules input variable.Error Seen
EKS Monitoring Variable Definition
https://github.com/aws-observability/terraform-aws-observability-accelerator/blob/v2.12.0/modules/eks-monitoring/variables.tf#L340
Nginx Patterns Variable Definition
https://github.com/aws-observability/terraform-aws-observability-accelerator/blob/v2.12.0/modules/eks-monitoring/patterns/nginx/variables.tf#L1
Implementing Template
https://github.com/aws-observability/terraform-aws-observability-accelerator/blob/v2.12.0/modules/eks-monitoring/main.tf#L234
Additional Information