-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
EC2: implement determinstic subnet ID generation #11853
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
Conversation
LocalStack Community integration with Pro 2 files 2 suites 23s ⏱️ Results for commit 52cc5c7f. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
@localstack_id | ||
def generate_subnet_id( | ||
resource_identifier: ResourceIdentifier, | ||
existing_ids: ExistingIds = None, | ||
tags: Tags = None, | ||
) -> str: | ||
# We return an empty string here to differentiate between when a custom ID was used, or when it was randomly generated by `moto`. | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Since it only returns an empty string and the signature is shared for all generate function, we could probably implement only one with the purpose of returning an empty string.
A single match_or_blank()
could be reused across all resource with this specific need. (The naming ain't right, but I am too tired to come up with a good name right now! 🤣 )
Not blocking, we can definitely keep on improving with the next ones!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a great idea! Since I will be working on another resource in the same file, I will implement this change there, thanks!
Motivation
In order to support the AWS replicator use case, we need to be able to generate predictable IDs for subnets.
We follow the pattern from the VPC replication (in #11772).
Changes
Testing
Tests are implemented in our ext test suite