Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix deprecation warning for is_enabled #10

Merged
merged 2 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_archive"></a> [archive](#requirement\_archive) | >=2.4.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.32.0 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >=3.5.1 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_archive"></a> [archive](#provider\_archive) | >=2.4.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.32.0 |
| <a name="provider_random"></a> [random](#provider\_random) | >=3.5.1 |

## Modules
Expand Down
2 changes: 1 addition & 1 deletion examples/01_default_configuration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Create a MSK status monitor with only a tag attached.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~>1.5 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~>5.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~>5.32 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion examples/01_default_configuration/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~>5.0"
version = "~>5.32"
}
}
}
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ resource "aws_cloudwatch_event_rule" "rds_health_lambda_schedule" {
name = "rds-health-eventbridge-rule-${random_id.id.hex}"
description = "Scheduled execution of the RDS monitor"
schedule_expression = var.schedule_expression
is_enabled = true
state = "ENABLED"
tags = var.tags
}

Expand Down Expand Up @@ -147,5 +147,5 @@ resource "aws_cloudwatch_metric_alarm" "this" {
}

locals {
rds_names = var.enable_cloudwatch_alarms ? sort([for arn in var.rds_arns : element(split("/", arn), 1)]) : []
rds_names = var.enable_cloudwatch_alarms ? sort([for arn in var.rds_arns : element(split(":", arn), 6)]) : []
}
14 changes: 11 additions & 3 deletions tests/defaults.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,31 @@ run "eventbridge_default_schedule_expression" {
command = plan

assert {
condition = aws_cloudwatch_event_rule.msk_health_lambda_schedule.schedule_expression == "rate(5 minutes)"
condition = aws_cloudwatch_event_rule.rds_health_lambda_schedule.schedule_expression == "rate(5 minutes)"
error_message = "Schedule expression is not matching expected default value of rate(5 minutes)."
}
}

run "eventbridge_default_is_enabled" {
command = plan

assert {
condition = aws_cloudwatch_event_rule.rds_health_lambda_schedule.state == "ENABLED"
error_message = "CloudWatch EventBride rule state is not matching state of ENABLED"
}
}
##
# The default value for CloudWatch Alarm property treat_missing_data should be set to breaching.
##
run "aws_cloudwatch_metric_alarm_default_treat_missing_data" {
command = plan
variables {
cluster_arns = ["arn:aws:kafka:eu-central-1:123456789012:cluster/test/ee779f75-92da-44a3-9f78-3b1af1053651-4"]
rds_arns = ["arn:aws:rds:eu-central-1:012345678901:db:my-rds-instance"]
enable_cloudwatch_alarms = true
}

assert {
condition = aws_cloudwatch_metric_alarm.this["test"].treat_missing_data == "breaching"
condition = aws_cloudwatch_metric_alarm.this["my-rds-instance"].treat_missing_data == "breaching"
error_message = "The default value for treat_missing_data is not set to breaching."
}
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = ">= 5.0"
version = ">= 5.32.0"
}
random = {
source = "hashicorp/random"
Expand Down