terraform-aws-modules / terraform-aws-eventbridge

Terraform module to create AWS EventBridge resources πŸ‡ΊπŸ‡¦
https://registry.terraform.io/modules/terraform-aws-modules/eventbridge/aws
Other
143 stars 148 forks source link

Warning message from aws_cloudwatch_event_rule - `Use "state" instead` #103

Closed doctornkz-intelas closed 9 months ago

doctornkz-intelas commented 10 months ago

Description

I see a warning message related to aws_cloudwatch_event_rule after upgrading hashicorp/aws provider to 5.30.0 version. The message mentions a deprecated option I have no access to due a module abstraction.

Versions

Reproduction Code [Required]

module "eventbridge" {
  source  = "terraform-aws-modules/eventbridge/aws"
  version = "3.0.0"

  bus_name = "${var.company}-${var.account}-guard-duty-bus"

  rules = {
    orders = {
      description   = "Capture all order data"
      event_pattern = jsonencode({ "source" : ["aws.guardduty"], "detail-type" : ["GuardDuty Finding"] })
      enabled       = true
    }
  }

}

Steps to reproduce the behavior: I am not using workspaces, whole configuration is located in a flat directory. I deleted the local cache and did tf init after that. The issue is still there.

To reproduce:

  1. Upgrade aws provider from 5.0.x to 5.30.0
  2. Do tf init --upgrade
  3. Do tf plan
  4. We see a message
    β”‚ Warning: Argument is deprecated
    β”‚ 
    β”‚   with module.eventbridge.aws_cloudwatch_event_rule.this["orders"],
    β”‚   on .terraform/modules/eventbridge/main.tf line 91, in resource "aws_cloudwatch_event_rule" "this":
    β”‚   91:   is_enabled          = lookup(each.value, "enabled", true)
    β”‚ 
    β”‚ Use "state" instead

Expected behavior

I am expecting to see only the message No changes. Your infrastructure matches the configuration. because I am not changing anything in the code itself.

Actual behavior

After tf plan we see the warning message:

β”‚ Warning: Argument is deprecated
β”‚ 
β”‚   with module.eventbridge.aws_cloudwatch_event_rule.this["orders"],
β”‚   on .terraform/modules/eventbridge/main.tf line 91, in resource "aws_cloudwatch_event_rule" "this":
β”‚   91:   is_enabled          = lookup(each.value, "enabled", true)
β”‚ 
β”‚ Use "state" instead

I tried to investigate the issue but from what I see in the main branch the issue is related to the enabled attribute I have no access to.

doctornkz-intelas commented 9 months ago

Works perfectly:

module "eventbridge" {
  source  = "terraform-aws-modules/eventbridge/aws"
  version = "3.1.0"
  ...
    rules = {
    orders = {
      description   = "Capture all order data"
      event_pattern = jsonencode({ "source" : ["aws.guardduty"], "detail-type" : ["GuardDuty Finding"] })
      state         = "ENABLED"
    }
  }

output

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
github-actions[bot] commented 7 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.