Skip to content

Instantly share code, notes, and snippets.

@downspot
Created February 11, 2018 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save downspot/c01eb00255dca0bc3e7b58daceb03521 to your computer and use it in GitHub Desktop.
Save downspot/c01eb00255dca0bc3e7b58daceb03521 to your computer and use it in GitHub Desktop.
terraform cycle through instances, useful for adding alarms/names
resource "aws_cloudwatch_metric_alarm" "cpu_credits" {
count = 2
...
dimensions { InstanceId = "${element(list("i-07656896d6947814c", "i-042e664331a74e385"), count.index)}" }
dimensions { InstanceId = "${element(aws_instance.my_instance.*.id, count.index)}" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment