nebari icon indicating copy to clipboard operation
nebari copied to clipboard

[BUG] - Can't deploy on azure if project name includes a dash

Open Adam-D-Lewis opened this issue 1 year ago • 2 comments

Describe the bug

I tried deploying on Azure with the project name dd-nebari and the deployment had an error. I didn't copy it but the error mentioned this line. It seems likely that using "a" as the escape character makes it impossible to tell if other "a" characters are escape characters or not, but I haven't tracked this down specifically.

Expected behavior

No error

OS and architecture in which you are running Nebari

Linux x86-64

How to Reproduce the problem?

See above

Command output

2024.3.3

Versions and dependencies used.

No response

Compute environment

Azure

Integrations

No response

Anything else?

No response

Adam-D-Lewis avatar Apr 17 '24 17:04 Adam-D-Lewis

Just tried to deploy Nebari on Azure with the project name ne-bri and I get the following error just after the terraform state resource group, storage container, and storage account are created.

The actual resource group is named nebridevxhz2, but Nebari seems to be looking for nea2Dbridevxhz2.

[terraform]: Plan: 3 to add, 0 to change, 0 to destroy.
[terraform]: module.terraform-state.azurerm_resource_group.terraform-state-resource-group: Creating...
[terraform]: module.terraform-state.azurerm_resource_group.terraform-state-resource-group: Creation complete after 1s [id=/subscriptions/901d2965-5cce-4799-aa15-44991169568b/resourceGroups/ne-bri-dev-state]
[terraform]: module.terraform-state.azurerm_storage_account.terraform-state-storage-account: Creating...
[terraform]: module.terraform-state.azurerm_storage_account.terraform-state-storage-account: Still creating... [10s elapsed]
[terraform]: module.terraform-state.azurerm_storage_account.terraform-state-storage-account: Still creating... [20s elapsed]
[terraform]: module.terraform-state.azurerm_storage_account.terraform-state-storage-account: Creation complete after 23s [id=/subscriptions/901d2965-5cce-4799-aa15-44991169568b/resourceGroups/ne-bri-dev-state/providers/Microsoft.Storage/storageAccounts/nebridevxhz2]
[terraform]: module.terraform-state.azurerm_storage_container.storage_container: Creating...
[terraform]: module.terraform-state.azurerm_storage_container.storage_container: Creation complete after 0s [id=https://nebridevxhz2.blob.core.windows.net/ne-bri-dev-state]
[terraform]: 
[terraform]: Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
[terraform]: [terraform]: 
[terraform]: Initializing the backend...
[terraform]: Upgrading modules...
[terraform]: - kubernetes in modules/kubernetes
[terraform]: - registry in modules/registry
[terraform]: ╷
[terraform]: │ Error: Failed to get existing workspaces: Error retrieving keys for Storage Account "nea2Dbridevxhz2": storage.AccountsClient#ListKeys: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The Resource 'Microsoft.Storage/storageAccounts/nea2Dbridevxhz2' under resource group 'ne-bri-dev-state' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"

Adam-D-Lewis avatar Apr 22 '24 19:04 Adam-D-Lewis

The issue is that we mutate the project_name to get the storage account name (e.g. strip dashes), but we create the storage account in a different place from where we read the storage account name and we don't apply the same mutation when we're creating the storage account as we do when we're reading (terraform importing) the storage class name.

So with a project name of ne-bri. we end up creating a storage account called nebridevxhz2, but then Nebari looks for a storage account called nea2Dbridevxhz2

Adam-D-Lewis avatar Apr 23 '24 02:04 Adam-D-Lewis