aws-health-aware icon indicating copy to clipboard operation
aws-health-aware copied to clipboard

Terraform_DEPLOY_AHA.tf: Terraform warns is_enabled deprecated

Open rkrenzis opened this issue 1 year ago • 1 comments
trafficstars

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)

rkrenzis avatar May 22 '24 06:05 rkrenzis

@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

andrewcr7 avatar Aug 28 '24 17:08 andrewcr7