Skip to content
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

30 character limit on GCP project names #145

Closed
gregoryfoster opened this issue Nov 25, 2023 · 3 comments
Closed

30 character limit on GCP project names #145

gregoryfoster opened this issue Nov 25, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@gregoryfoster
Copy link
Contributor

gregoryfoster commented Nov 25, 2023

Describe the Bug

cookiecutter prompts for the infrastructure_slug and provides a default (cdp-{{ cookiecutter.municipality_slug }}-{{ random_ascii_string(8).lower() }}). That default value can be > 30 characters, which causes problems downstream.

Expected Behavior

Let's ensure we aren't recommending an invalid project name.

Reproduction

Add a project name > 30 characters. Can be fixed with a search and replace in the generated codebase.

Environment

Any additional information about your environment.

  • OS Version: [e.g. macOS 11.3.1]
  • Cookiecutter Version: [e.g. 0.5.0]
@gregoryfoster gregoryfoster added the bug Something isn't working label Nov 25, 2023
@evamaxfield
Copy link
Member

I think this might be a documentation issue. I can't really think of a workaround. We generally want to keep the random_ascii_string(8).lower() as that provides us a decent amount of randomness to not overlap with existing GCP projects. Meanwhile, the user provided content is the long bit.

Would just adding a bit of documentation saying "the name should be at most 23 characters in length" work?

@gregoryfoster
Copy link
Contributor Author

That certainly works. I looked around to see if cookiecutter offered a means of declaring a character limit, and one option is to declare a pre_gen_project hook to validate template variables:
https://cookiecutter.readthedocs.io/en/stable/advanced/hooks.html#examples

gregoryfoster added a commit to gregoryfoster/cookiecutter-cdp-deployment that referenced this issue Nov 30, 2023
evamaxfield pushed a commit that referenced this issue Dec 2, 2023
…lidate infrastructure_slug (#150)

#145: adding pre_gen_project hook to validate input variable infrastructure_slug
@evamaxfield
Copy link
Member

Already merged! Thanks! Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants