Skip to content

fix: Inverted conditional for bus creation #154

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

Closed

Conversation

seanmann-synth
Copy link

Description

While attempting to prevent the creation of the event bus I noticed that despite setting create and create_bus false that the module was still complaining that it couldn't find the event bus resource.

* Failed to execute "terraform apply" in ./.terragrunt-cache/8HF66hbAsRFOCc5OnnuLt3r_uyU/XdD3lc4frNDv5mvmMn0J_6eJy-Y
  ╷
  │ Error: reading EventBridge Event Bus (scheduled-lambda-bus-template-lambda-dev): couldn't find resource
  │ 
  │   with module.eventbridge.data.aws_cloudwatch_event_bus.this[0],
  │   on .terraform/modules/eventbridge/main.tf line 58, in data "aws_cloudwatch_event_bus" "this":
  │   58: data "aws_cloudwatch_event_bus" "this" {
  │ 
  ╵
  
  exit status 1

It seems the conditional expression is inverted. This PR fixes that.

Motivation and Context

Fixes create and create_bus flag behavior to be as expected (e.g., if false then don't make the bus).

Breaking Changes

No expected breaking changes.

How Has This Been Tested?

Ultra minor change. Please verify logic and merge.

@seanmann-synth seanmann-synth changed the title Fix inverted conditional for bus creation fix inverted conditional for bus creation Feb 21, 2025
@seanmann-synth seanmann-synth changed the title fix inverted conditional for bus creation fix: inverted conditional for bus creation Feb 21, 2025
@seanmann-synth seanmann-synth changed the title fix: inverted conditional for bus creation fix: Inverted conditional for bus creation Feb 21, 2025
Copy link

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 github-actions bot added the stale label Mar 24, 2025
@@ -56,7 +56,7 @@ locals {
}

data "aws_cloudwatch_event_bus" "this" {
count = var.create && var.create_bus ? 0 : 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is correct as written - if var.create is true and var.create_bus is false, then the data source will be used to look up an externally created (existing) event bus

Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants