terraform-aws-eventbridge icon indicating copy to clipboard operation
terraform-aws-eventbridge copied to clipboard

fix: Fix kinesis_target and kinesis_parameters dynamic blocks

Open mschuwalow opened this issue 1 year ago β€’ 1 comments

Description

Reopened #118 as the issue is still present. Let me know if you don't intend on merging these changes, then I'll stop reopening this one.

Motivation and Context

Target

Before this change the target configuration for kinesis partition seems to be intended to look like this:

kinesis_target = {
  partition_key_path = β€œ$.id”
}

Actually planning with this configuration present will error out though. Reason for this is that the for_each will assign the iterator to just [true] and subsequently try to access a field on it:

β”‚ Error: Invalid function argument
β”‚ 
β”‚   on ../../main.tf line 200, in resource "aws_cloudwatch_event_target" "this":
β”‚  200:       partition_key_path = lookup(kinesis_target.value, "partition_key_path", null)
β”‚     β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚     β”‚ kinesis_target.value is true
β”‚ 
β”‚ Invalid value for "inputMap" parameter: lookup() requires a map as the first argument.

After this change the configuration looks like this and works as intended (see examples):

partition_key_path = "$.id"

Schedule

Before this change the target configuration for kinesis partition key seems to be intended to look like this:

kinesis_parameters = {
  partition_key = β€œfoo”
}

Actually planning with this configuration present will error out though. Reason for this is the the schedule input would no longer be a valid map due to inconsistent types:

β”‚ The given value is not suitable for module.eventbridge.var.schedules declared at ../../variables.tf:177,1-21: attribute types must all match for conversion
β”‚ to map.

Additionally even if it passed the for_each will assign the iterator to just [true] and subsequently try to access a field on it --- failing either way.

After this change the configuration looks like this and works as intended (see examples):

partition_key  = "foo"

Breaking Changes

No, as the functionality was not working in the first place.

How Has This Been Tested?

  • [x] I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • [x] I have tested and validated these changes using one or more of the provided examples/* projects
  • [x] I have executed pre-commit run -a on my pull request

mschuwalow avatar Jun 05 '24 09:06 mschuwalow

This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days

github-actions[bot] avatar Jul 06 '24 00:07 github-actions[bot]

still relevant

mschuwalow avatar Jul 09 '24 10:07 mschuwalow

This PR is included in version 3.7.1 :tada:

antonbabenko avatar Jul 15 '24 10:07 antonbabenko

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Aug 15 '24 02:08 github-actions[bot]