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 9aab406
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Changed `push_to_s3` deployment step function to write paths `as_posix()` to allow support for deploying from windows [#314](https://github.com/PrefectHQ/prefect-aws/pull/314)

### Fixed

- Resolved an issue where defining subnets in network configuration would erroneously report them as missing in the VPC. [#321](https://github.com/PrefectHQ/prefect-aws/pull/321)

### Deprecated

### Removed
Expand Down
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 9aab406

Please sign in to comment.