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

Wrong Fileshare ID using 'azurerm_machine_learning_datastore_fileshare' #28314

Open
1 task done
rapster83 opened this issue Dec 17, 2024 · 0 comments
Open
1 task done

Comments

@rapster83
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

When trying to create 'azurerm_machine_learning_datastore_fileshare' the resource creation failed with the following message:

2024-12-17 17_07_58-main tf - module-library-azurerm - Visual Studio Code

Terraform Version

1.10.2

AzureRM Provider Version

4.14.0

Affected Resource(s)/Data Source(s)

azurerm_machine_learning_datastore_fileshare

Terraform Configuration Files

Terraform v1.10.2
on windows_amd64
+ provider registry.terraform.io/hashicorp/azurerm v4.14.0

provider "azurerm" {
  features {}
}

data "azurerm_client_config" "current" {}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_application_insights" "example" {
  name                = "workspace-example-ai"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  application_type    = "web"
}

resource "azurerm_key_vault" "example" {
  name                = "workspaceexamplekeyvault"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  tenant_id           = data.azurerm_client_config.current.tenant_id
  sku_name            = "premium"
}

resource "azurerm_storage_account" "example" {
  name                     = "workspacestorageaccount"
  location                 = azurerm_resource_group.example.location
  resource_group_name      = azurerm_resource_group.example.name
  account_tier             = "Standard"
  account_replication_type = "GRS"
}

resource "azurerm_machine_learning_workspace" "example" {
  name                    = "example-workspace"
  location                = azurerm_resource_group.example.location
  resource_group_name     = azurerm_resource_group.example.name
  application_insights_id = azurerm_application_insights.example.id
  key_vault_id            = azurerm_key_vault.example.id
  storage_account_id      = azurerm_storage_account.example.id

  identity {
    type = "SystemAssigned"
  }
}

resource "azurerm_storage_share" "example" {
  name                 = "example"
  storage_account_name = azurerm_storage_account.example.name
  quota                = 1
}

resource "azurerm_machine_learning_datastore_fileshare" "example" {
  name                 = "example-datastore"
  workspace_id         = azurerm_machine_learning_workspace.example.id
  storage_fileshare_id = azurerm_storage_share.example.resource_manager_id
  account_key          = azurerm_storage_account.example.primary_access_key
}

Debug Output/Panic Output

│ Error: ID was missing the `fileshares` element
│
│   with module.defaults.azurerm_machine_learning_datastore_fileshare.this["mlfslibrarymltest001"],
│   on ..\..\main.tf line 347, in resource "azurerm_machine_learning_datastore_fileshare" "this":
│  347: resource "azurerm_machine_learning_datastore_fileshare" "this" {
│
│ ID was missing the `fileshares` element

Expected Behaviour

Normally, the azurerm_storage_share.example.id should insert a usable fileshare ID.

Actual Behaviour

During the terraform apply I get the following error:

│ Error: ID was missing the `fileshares` element
│
│   with module.defaults.azurerm_machine_learning_datastore_fileshare.this["mlfslibrarymlswntest002"],
│   on ..\..\main.tf line 347, in resource "azurerm_machine_learning_datastore_fileshare" "this":
│  347: resource "azurerm_machine_learning_datastore_fileshare" "this" {
│
│ ID was missing the `fileshares` element

Steps to Reproduce

Execute terraform apply

Possible Solution:
I compared the ID with is created by the Azure Portal with the one created by Terraform and here is the difference:

"/subscriptions/549ff4fb-409c-4d6a-82ac-206b69d27d80/resourceGroups/rg-library-ml-test-001/providers/Microsoft.Storage/storageAccounts/stlibrarydstest001/fileServices/default/fileshares/stfiledstest001"
"/subscriptions/549ff4fb-409c-4d6a-82ac-206b69d27d80/resourceGroups/rg-library-ml-test-001/providers/Microsoft.Storage/storageAccounts/stlibrarydstest001/fileServices/default/shares/stfiledstest001"

Please see fileshares vs. shares.

As a workaround I use the Terraform replace() function and replace /shares/ section with /fileshares/. And then it was working. 😉

Important Factoids

No response

References

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants