aws-samples / aws-health-aware

AHA is an incident management & communication framework to provide real-time alert customers when there are active AWS event(s). For customers with AWS Organizations, customers can get aggregated active account level events of all the accounts in the Organization. Customers not using AWS Organizations still benefit alerting at the account level.
MIT No Attribution
348 stars 143 forks source link

Terraform_DEPLOY_AHA.tf: Terraform warns is_enabled deprecated #80

Open rkrenzis opened 6 months ago

rkrenzis commented 6 months ago

is_enabled is deprecated. Terraform 1.8.3 recommends using 'state' instead.

Terraform version: 1.8.3

AHA Version: 2.2.2

Affected Resources aws_cloudwatch_event_rule

Expected Behavior terraform validate or plan should complete without warnings

Actual Behavior

Output from terraform plan:

 Warning: Argument is deprecated
│ 
│   with aws_cloudwatch_event_rule.AHA-LambdaSchedule-PrimaryRegion,
│   on Terraform_DEPLOY_AHA.tf line 755, in resource "aws_cloudwatch_event_rule" "AHA-LambdaSchedule-PrimaryRegion":
│  755:   is_enabled          = true
│ 
│ Use "state" instead
|
│ (and 3 more similar warnings elsewhere)

Output from terraform validate -json formatted

Detail               Address                                                       Filename                 Line
------               -------                                                       --------                 ----
Use "state" instead  aws_cloudwatch_event_rule.AHA-LambdaSchedule-SecondaryRegion  Terraform_DEPLOY_AHA.tf  767
Use "state" instead  aws_cloudwatch_event_rule.AHA-LambdaSchedule-PrimaryRegion    Terraform_DEPLOY_AHA.tf  755

Additional remarks: terraform plan states 3 similar warnings when terraform validate -json reports only 2.

Terraform configuration:

# Terraform_DEPLOY_AHA.tf
# EventBridge - Schedule to run lambda
resource "aws_cloudwatch_event_rule" "AHA-LambdaSchedule-PrimaryRegion" {
  description         = "Lambda trigger Event"
  event_bus_name      = "default"
  is_enabled          = true
  name                = "AHA-LambdaSchedule-${random_string.resource_code.result}"
  schedule_expression = "rate(1 minute)"
  tags = {
    "Name" = "AHA-LambdaSchedule"
  }
}
resource "aws_cloudwatch_event_rule" "AHA-LambdaSchedule-SecondaryRegion" {
  count               = var.aha_secondary_region == "" ? 0 : 1
  provider            = aws.secondary_region
  description         = "Lambda trigger Event"
  event_bus_name      = "default"
  is_enabled          = true
  name                = "AHA-LambdaSchedule-${random_string.resource_code.result}"
  schedule_expression = "rate(1 minute)"
  tags = {
    "Name" = "AHA-LambdaSchedule"
  }
}

Steps to reproduce:

  1. Use terraform 1.8.3 on x86_64
  2. Follow directions to deploy Terraform_DEPLOY_AHA (AHA WITH AWS Organizations on Management Account using Terraform)
andrewcr7 commented 2 months ago

@rkrenzis If you have chance to try the update, let us know if it looks good to you. https://github.com/aws-samples/aws-health-aware/tree/terraform-updates