[BUG] - Project Names and Namespaces with Underscores Break in Certain Providers
Describe the bug
Project names and namespaces with underscores break because they're not DNS compliant (or escaped). The first time this issue is encountered when deploying in AWS is trying to create S3 bucket because it used the pattern [project_name]-[namespace]-terraform-state. But if that were updated there would surely be others in later stages (most K8S resource names must be DNS compliant, and so _ are illegal).
Expected behavior
Project names and namespaces that are legal as defined by Nebari should be able to successfully create resources.
OS and architecture in which you are running Nebari
Ubuntu 22.04 amd64
How to Reproduce the problem?
nebari init aws -p test_project nebari deploy -c nebari-config.yaml
Command output
[terraform]: â Error: validating S3 Bucket (test_project-dev-terraform-state) name: only lowercase alphanumeric characters and hyphens allowed in "test_project-dev-terraform-state"
[terraform]: â
[terraform]: â with module.terraform-state.aws_s3_bucket.terraform-state,
[terraform]: â on modules/terraform-state/main.tf line 1, in resource "aws_s3_bucket" "terraform-state":
[terraform]: â 1: resource "aws_s3_bucket" "terraform-state" {
Versions and dependencies used.
No response
Compute environment
None
Integrations
No response
Anything else?
No response
We are using the terraform version From terraform version v3.28.0 terraform plan will fail if the bucket name has underscores for AWS. Link to bugfix in terrafrom ticket.
But upgrading the Terraform will not prevent nebari deploy from failing. I would recommend that we add validations in Nebari Wizard.
-
Add validation in Wizard to check if the provider is AWS, then don't allow
_s in the project name.- Pro: It's an easy fix.
- Con: Naming conventions can differ for different cloud providers.
-
Enforce validation for all providers.
- Pro:
- Even easier to add it to Wizard.
- Consistent naming conventions across all providers.
- Switching providers can become easier.
- Con:
- All the providers need to be tested.
- Pro: