CouncilDataProject / cookiecutter-cdp-deployment

Cookiecutter template for creating new CDP instances.
Mozilla Public License 2.0
26 stars 9 forks source link

30 character limit on GCP project names #145

Closed gregoryfoster closed 11 months ago

gregoryfoster commented 12 months ago

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.

evamaxfield commented 11 months ago

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 commented 11 months ago

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

evamaxfield commented 11 months ago

Already merged! Thanks! Closing