attempting to create a terraform module that is customized via terragrunt config, assuming the following configs:
main.tf
/* create the cloudwatch alarm */
resource "aws_cloudwatch_metric_alarm" "alarm" {
depends_on = [ aws_sns_topic.sns_alarm_topic ]
alarm_name = var.cw_alarm_name
comparison_operator = var.cw_comparison_operator
evaluation_periods = var.cw_eval_period
metric_name = var.cw_metric_name
namespace = var.cw_namespace
period = var.cw_period
statistic = var.cw_statistic
threshold = var.cw_alarm_threshold
alarm_description = var.cw_alarm_description
alarm_actions = [ aws_sns_topic.sns_alarm_topic.arn ]
ok_actions = [ aws_sns_topic.sns_alarm_topic.arn ]
insufficient_data_actions = []
treat_missing_data = var.cw_missing_data
dimensions = {
(var.dimension_list)
}
variables.tf (trimmed)
variable "dimension_list" {
description = "Dimensions variables in 'key = value' pairs"
default = null
type = map(string)
}
terragrunt.hc (trimmed)l:
dimension_list = {
Environment = "uat"
}
The issue is that to create a generic terraform module, I need the ability to replace the dimension assigned, which should be pulled in as a list from the terragrunt customization file.
When attempting to do the above, I get this error:
│ Error: Missing attribute value
│
│ on main.tf line 49, in resource “aws_cloudwatch_metric_alarm” “alarm”:
│ 48: dimensions = {
│ 49: (var.dimension_list)
│ 50: }
│
│ Expected an attribute value, introduced by an equals sign ("=").