Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
fix: 320 subnet validation in Network Configuration
Browse files Browse the repository at this point in the history
fixes #320

Fix subnet validation in Network Configuration.

- Resolved an issue where defining subnets in network configuration would erroneously report them as missing in the VPC.
- Adjusted the boto3 describe_subnets call to specifically compare against SubnetId, as it retrieves full subnet details.
  • Loading branch information
chotalia authored and rc committed Oct 6, 2023
1 parent 525c917 commit 2dbb32d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions prefect_aws/workers/ecs_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,10 +1349,10 @@ def _custom_network_configuration(
+ "Network configuration cannot be inferred."
)

subnet_ids = [subnet["SubnetId"] for subnet in subnets]

config_subnets = network_configuration.get("subnets", [])
if not all(
[conf_sn in sn.values() for conf_sn in config_subnets for sn in subnets]
):
if not all(conf_sn in subnet_ids for conf_sn in config_subnets):
raise ValueError(
f"Subnets {config_subnets} not found within {vpc_message}."
+ "Please check that VPC is associated with supplied subnets."
Expand Down

0 comments on commit 2dbb32d

Please sign in to comment.