Skip to content

Commit

Permalink
Merge branch 'main' into feature/depends_on_objects
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnPreston committed May 31, 2024
2 parents 1124be6 + 6ecb774 commit 7784de1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ecs_composex/elbv2/elbv2_stack/elbv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,19 @@ def __init__(
self.lookup_listeners: dict[int, LookupListener] = {}
self.target_groups: list[MergedTargetGroup] = []
super().__init__(name, definition, module, settings)
if not keyisset("Listeners", definition) and not self.lookup:
raise KeyError(
"You must specify at least one new Listener for a new LB.", name
)

if (
not keyisset("Listeners", definition)
and not self.lookup
or (self.lookup and not keyisset("Listeners", self.lookup))
self.lookup
and not keyisset("Listeners", self.definition)
and not keyisset("Listeners", self.lookup)
):
raise KeyError("You must specify at least one Listener for a LB.", name)
raise KeyError(
"When looking up LB, you must either create a new Listener or Lookup and existing one."
)

self.cloud_control_attributes_mapping = LB_CLOUD_CONTROL_ATTRIBUTES
self.no_allocate_eips: bool = keyisset("NoAllocateEips", self.settings)
Expand Down

0 comments on commit 7784de1

Please sign in to comment.