-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.tf
52 lines (42 loc) · 1.61 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Managed By : CloudDrove
# Description : This Script is used to create Cloudwatch Alarms.
# Copyright @ CloudDrove. All Right Reserved.
#Module : Label
#Description : This terraform module is designed to generate consistent label names and tags
# for resources. You can use terraform-labels to implement a strict naming
# convention.
module "labels" {
source = "clouddrove/labels/aws"
version = "1.3.0"
enabled = var.enabled
name = var.name
environment = var.environment
label_order = var.label_order
managedby = var.managedby
}
#Module : CLOUDWATCH EVENT
#Description : Terraform module creates Cloudwatch Event on AWS.
resource "aws_cloudwatch_event_rule" "default" {
count = var.enabled == true ? 1 : 0
name = module.labels.id
description = var.description
event_pattern = var.event_pattern
schedule_expression = var.schedule_expression
role_arn = var.role_arn
is_enabled = var.is_enabled
tags = module.labels.tags
}
#Module : CLOUDWATCH EVENT TARGET
#Description : Terraform module creates Cloudwatch Event Target on AWS.
resource "aws_cloudwatch_event_target" "default" {
count = var.enabled == true ? 1 : 0
rule = aws_cloudwatch_event_rule.default.*.name[0]
target_id = var.target_id
arn = var.arn
input_path = var.input_path != "" ? var.input_path : null
role_arn = var.target_role_arn
input_transformer {
input_paths = var.input_path == "" ? var.input_paths : null
input_template = var.input_path == "" ? var.input_template : null
}
}