Feature Request: Defining variables/locals inside a resource block
I trying to define some variables inside a resource so that it can be referred when needed and this resource block is in the loop so I can't define these as `locals` outside the resource. Is this possible in some way?: ```hcl resource "aws_cloudwatch_metric_alarm" "httpcode_target_5xx_count" { locals { len = "${length(data.aws_lb.this.target_group_arn_suffixes)}" current_index = "${element(data.aws_lb.this.target_group_arn_suffixes, count.index)}" current_thresold = "${var.target_5xx_thresold["$local.current_index"] != "" ? var.target_5xx_thresold["$local.current_index"] : "${var.lb_5xx_thresold}"}" } count = "${local.len}" alarm_name = "${var.prefix_resources}: ALB-5XX-ERROR: TARGET: ${replace(local.current_index,"/(targetgroup/)|(/\\w+$)/","")}" comparison_operator = "GreaterThanThreshold" evaluation_periods = "${local.evaluation_periods}" metric_name = "HTTPCode_Target_5XX_Count" namespace = "AWS/ApplicationELB" period = "300" statistic = "Sum" threshold = "${local.current_thresold}" treat_missing_data = "missing" alarm_description = "HTTPCode 5XX count for ${local.current_index} over ${local.current_thresold} last 300 seconds over 1 period(s)" alarm_actions = "${concat(var.notify_sns_arns, aws_sns_topic.opsgenie_sns_topic.arn)}" dimensions = { "TargetGroup" = "${lo
Posted by rahulwa on Mar 13, 2019, 4:15 PM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Feature Request: Defining variables/locals inside a resource block
I trying to define some variables inside a resource so that it can be referred when needed and this resource block is in the loop so I can't define these as `locals` outside the resource. Is this possible in some way?: ```hcl resource "aws_cloudwatch_metric_alarm" "httpcode_target_5xx_count" { locals { len = "${length(data.aws_lb.this.target_group_arn_suffixes)}" current_index = "${element(data.aws_lb.this.target_group_arn_suffixes, count.index)}" current_thresold = "${var.target_5xx_thresold["$local.current_index"] != "" ? var.target_5xx_thresold["$local.current_index"] : "${var.lb_5xx_thresold}"}" } count = "${local.len}" alarm_name = "${var.prefix_resources}: ALB-5XX-ERROR: TARGET: ${replace(local.current_index,"/(targetgroup/)|(/\\w+$)/","")}" comparison_operator = "GreaterThanThreshold" evaluation_periods = "${local.evaluation_periods}" metric_name = "HTTPCode_Target_5XX_Count" namespace = "AWS/ApplicationELB" period = "300" statistic = "Sum" threshold = "${local.current_thresold}" treat_missing_data = "missing" alarm_description = "HTTPCode 5XX count for ${local.current_index} over ${local.current_thresold} last 300 seconds over 1 period(s)" alarm_actions = "${concat(var.notify_sns_arns, aws_sns_topic.opsgenie_sns_topic.arn)}" dimensions = { "TargetGroup" = "${lo
Comments (0)
No comments yet. Start the discussion.