-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.tf
36 lines (31 loc) · 782 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
terraform {
required_version = ">= 0.13.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.14.1"
}
}
}
provider "aws" {
region = var.region
profile = var.profile
}
data "aws_instances" "instances_list" {
instance_tags = {
(var.tag_name) = var.tag_value
}
}
module instance_names {
for_each = toset(data.aws_instances.instances_list.ids)
source = "./ec2_alarm"
instance_id = each.key
region = var.region
profile = var.profile
tag_name = var.tag_name
tag_value = var.tag_value
threshold_ec2_cpu = var.threshold_ec2_cpu
threshold_ec2_disk = var.threshold_ec2_disk
threshold_ec2_mem = var.threshold_ec2_mem
alarm_actions = var.alarm_actions
}