Skip to content

Latest commit

 

History

History
107 lines (96 loc) · 15.2 KB

README.md

File metadata and controls

107 lines (96 loc) · 15.2 KB

CloudWatch Module

  • Creating of alarms.
  • Creating of a composite alarm.
  • Creating of dashboard.
  • Creating of monitoring application for Synthetics Canaries.
  • Creating of log groups.

Requirements

Name Version
terraform >= 0.14
aws >= 3.61.0

Providers

Name Version
aws >= 3.61.0
null n/a
time n/a

Resources

Name Type
aws_cloudwatch_composite_alarm.composite_alarm resource
aws_cloudwatch_dashboard.cw_dashboard resource
aws_cloudwatch_log_group.log_group resource
aws_cloudwatch_log_stream.log_stream resource
aws_cloudwatch_metric_alarm.defalut resource
aws_cloudwatch_metric_alarm.default_dinamy resource
aws_cloudwatch_metric_alarm.expression resource
aws_synthetics_canary.canary_watch_service resource
null_resource.previous resource
time_sleep.wait_60_seconds resource

Inputs

Name Description Type Default Required
actions_enabled Indicates whether or not actions should be executed during any changes to the alarm's state. bool true no
alarm_actions The list of actions to execute when this alarm transitions into an ALARM state from any other state. list(any) [] no
alarm_description The description for the alarm. string "" no
alarm_list type = map(object({
alarm-cpu = {
alarm_name = "alarm_cpu"
alarm_description = "This metric monitors ec2 cpu utilization exceeding 70%"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = "60"
statistic = "Average"
# CPU Utilization threshold is set to 10 percent
threshold = "70"
alarm_actions = null
actions_enabled = null
insufficient_data_actions = null
ok_actions = null
dimensions = {
InstanceId = "i-082cb76ca0e5b43a7" OR
AutoScalingGroupName = "casper-aws-autoscaling"
}
}
}))
Required configuration for attach rule to Sg
any null no
alarm_name The descriptive name for the alarm. string "" no
com_actions_enabled (Optional, Forces new resource) Indicates whether actions should be executed during any changes to the alarm state of the composite alarm. Defaults to true. bool true no
com_alarm_actions (Optional) The set of actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an ARN. Up to 5 actions are allowed. list(any) [] no
com_alarm_description (Optional) The description for the composite alarm. string null no
com_alarm_name (Required) The name for the composite alarm. This name must be unique within the region. string null no
com_alarm_rule (Required) An expression that specifies which other alarms are to be evaluated to determine this composite alarm's state. For syntax, see Creating a Composite Alarm. The maximum length is 10240 characters. string "" no
comparison_operator The arithmetic operation to use when comparing the specified Statistic and Threshold. string "GreaterThanOrEqualToThreshold" no
create_composite_alarm Create alarm composite. bool false no
create_dashboard if true, enable create cloudwatch dashboard bool false no
create_log_group if true, enable create canary test bool false no
create_metric_alarm_expression Enable alarm with expression. bool true no
create_syn_canary if true, enable create canary test bool false no
dashboard_body (Required) The detailed information about the dashboard, including what widgets are included and their location on the dashboard. You can read more about the body structure in the documentation. string null no
dashboard_name (Required) The name of the dashboard. string null no
dimensions Dimensions for metrics. map {} no
enabled_basic Create a specific alarm, if true. bool false no
enabled_dinamy Creates a list of alarms, if true, consider the alarm_list variable. bool false no
evaluation_periods The number of periods over which data is compared to the specified threshold. number "60" no
instance_id The instance ID. string "" no
insufficient_data_actions The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. list(any) [] no
log_group_name Name to be used on Log Group created. string null no
log_stream_name Name to be used on Log Stream created. string null no
metric_name The name for the alarm's associated metric. string "CPUUtilization" no
namespace The namespace for the alarm's associated metric. string "AWS/EC2" no
ok_actions The list of actions to execute when this alarm transitions into an OK state from any other state. list(any) [] no
period The period in seconds over which the specified statistic is applied. number 120 no
query_expressions values for metric query expression. any
[
{
"expression": "ANOMALY_DETECTION_BAND(m1)",
"id": "e1",
"label": "CPUUtilization (Expected)",
"return_data": "true"
}
]
no
query_metrics values for metric query metrics. any
[
{
"dimensions": {
"InstanceId": "i-abc123"
},
"id": "m1",
"metric_name": "CPUUtilization",
"namespace": "AWS/EC2",
"period": "120",
"return_data": "true",
"stat": "Average",
"unit": "Count"
}
]
no
retention_days Days to keep data saved. number 3 no
statistic The statistic to apply to the alarm's associated metric. string "Average" no
syn_canary_name Name to be used on Canary Test created. string null no
syn_delete_lambda (Optional) Specifies whether to also delete the Lambda functions and layers used by this canary. The default is false bool false no
syn_handler (Required) Entry point to use for the source code when running the canary. This value must end with the string .handler string null no
syn_rc_active_tracing (Optional) Whether this canary is to use active AWS X-Ray tracing when it runs. You can enable active tracing only for canaries that use version syn-nodejs-2.0 or later for their canary runtime. bool false no
syn_rc_environment_variables (Optional) Map of environment variables that are accessible from the canary during execution. Please see AWS Docs for variables reserved for Lambda. map(any) null no
syn_rc_memory_in_mb (Optional) Maximum amount of memory available to the canary while it is running, in MB. The value you specify must be a multiple of 64. string null no
syn_rc_timeout_in_seconds (Optional) Number of seconds the canary is allowed to run before it must stop. If you omit this field, the frequency of the canary is used, up to a maximum of 840 (14 minutes). number 60 no
syn_role_arn Role ARN for S3 and Canary Connection string null no
syn_runtime_version (Required) Runtime version to use for the canary. Versions change often so consult the Amazon CloudWatch documentation for the latest valid versions. Values include syn-python-selenium-1.0, syn-nodejs-puppeteer-3.0, syn-nodejs-2.2, syn-nodejs-2.1, syn-nodejs-2.0, and syn-1.0. string null no
syn_s3_canary_bucket_name (Required) Location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. string null no
syn_s3_canary_file_bucket_name (Optional) Full bucket name which is used if your canary script is located in S3. The bucket must already exist. Specify the full bucket name including s3:// as the start of the bucket name. Conflicts with zip_file - Name to be used on Id bucket for read the code in Zip file. string null no
syn_s3_key_file S3 key of your script. Conflicts with zip_file. canary_zip_inline.zip string null no
syn_s3_version (Optional) S3 version ID of your script. Conflicts with zip_file. string null no
syn_sch_duration_in_seconds (Optional) Duration in seconds, for the canary to continue making regular runs according to the schedule in the Expression value. number null no
syn_sch_expression (Required) Rate expression or cron expression that defines how often the canary is to run. number 1 no
syn_start_canary (Optional) Whether to run or stop the canary. bool false no
syn_success_retention_period (Optional) Number of days to retain data about successful runs of this canary. If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days. number 3 no
threshold The value against which the specified statistic is compared. number 40 no
threshold_metric_id If this is an alarm based on an anomaly detection model, make this value match the ID of the ANOMALY_DETECTION_BAND function. string null no
treat_missing_data (Optional) Sets how this alarm is to handle missing data points. The following values are supported: missing, ignore, breaching and notBreaching. Defaults to missing. string "missing" no

Outputs

Name Description
cloudwatch_metric_alarm_arn The ARN of the Cloudwatch metric alarm.
cloudwatch_metric_alarm_id The ID of the Cloudwatch metric alarm.
log_group_arn The Amazon Resource Name (ARN) specifying the log group.
log_group_name The name of the log group.