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

Error creating NFS export on Storage Account #24269

Closed
1 task done
webstean opened this issue Dec 18, 2023 · 7 comments · Fixed by #24446
Closed
1 task done

Error creating NFS export on Storage Account #24269

webstean opened this issue Dec 18, 2023 · 7 comments · Fixed by #24446

Comments

@webstean
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 "+1" or "me too" comments, 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.

Terraform Version

v1.6.6

AzureRM Provider Version

3.85.0

Affected Resource(s)/Data Source(s)

azurerm_storage_share

Terraform Configuration Files

// NFS export1
resource "azurerm_storage_share" "nfs1" {
  for_each = azurerm_storage_account.nfs

  storage_account_name = each.value.name

  name             = "default"
  enabled_protocol = "NFS"
  // 100GB is the minimum
  quota = 101

}
get error:-

│ Error: creating Share "default" (Account "lscphnfssydstorage01" / Resource Group "lscph-syd-nfs-rg"): shares.Client#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidHeaderValue" Message="The value for one of the HTTP headers is not in the correct format.\nRequestId:4a0e221f-301a-0060-29a2-3196bb000000\nTime:2023-12-18T11:08:38.4496445Z"
│ 
│   with azurerm_storage_share.nfs1["sydney"],
│   on storage-nfs.tf line 172, in resource "azurerm_storage_share" "nfs1":172: resource "azurerm_storage_share" "nfs1" {

Debug Output/Panic Output

a

Expected Behaviour

NFS export created

Actual Behaviour

Error:
│ Error: creating Share "default" (Account "lscphnfssydstorage01" / Resource Group "lscph-syd-nfs-rg"): shares.Client#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidHeaderValue" Message="The value for one of the HTTP headers is not in the correct format.\nRequestId:4a0e221f-301a-0060-29a2-3196bb000000\nTime:2023-12-18T11:08:38.4496445Z"

Steps to Reproduce

with
// NFS export1
resource "azurerm_storage_share" "nfs1" {
for_each = azurerm_storage_account.nfs

storage_account_name = each.value.name

name = "default"
enabled_protocol = "NFS"
// 100GB is the minimum
quota = 101

}

Important Factoids

Azure Public

References

none known

@magodo
Copy link
Collaborator

magodo commented Dec 20, 2023

@webstean I've tried to create the NFS share locally successfully with following configuration:

resource "azurerm_storage_account" "test" {
  name                     = "acctestacclgmn1"
  resource_group_name      = azurerm_resource_group.test.name
  location                 = azurerm_resource_group.test.location
  account_kind             = "FileStorage"
  account_tier             = "Premium"
  account_replication_type = "LRS"
}
resource "azurerm_storage_share" "test" {
  name                 = "testsharelgmnz"
  storage_account_name = azurerm_storage_account.test.name
  enabled_protocol     = "NFS"
  quota                = 101
}

Would you mind check whether you have the storage account configured with Premium & FileStorage?

@webstean
Copy link
Author

webstean commented Jan 5, 2024

I've tried multiple combinations, I get this error: Terraform Error: nfsv3_enabled can only be used with account tier Standard and account kind StorageV2, or account tier Premium and account kind BlockBlobStorage, which matches the documentation: https://learn.microsoft.com/en-us/azure/storage/blobs/network-file-system-protocol-support-how-to

I get failures on both types:-

account_tier = "Premium"
account_kind = "BlockBlobStorage"
or
account_tier = "Standard"
account_kind = "StorageV2"

@magodo your options:-

account_kind = "FileStorage"
account_tier = "Premium"

Arn't supposed to work.

Very confused ;-)

@magodo
Copy link
Collaborator

magodo commented Jan 5, 2024

I didn't specify the nfsv3_enabled in my configuration above (as you didn't paste the complete configuration, so I just used the minimalist). If that is the case, the combination include nfsv3_enabled just is an invalid one. Are you able to create the storage share via other means?

@webstean
Copy link
Author

webstean commented Jan 7, 2024

Thanks @magodo OK, after some more reading, the above is about creating an NFS export with Azure files and as you demonstrates, this work fine, but what I'm trying to do is create a NFS v3 on blob storage, as per this link:-
Mount Blob Storage by using the Network File System (NFS) 3.0 protocol which requires the use of nfsv3_enabled`

@magodo
Copy link
Collaborator

magodo commented Jan 8, 2024

Thanks for the update! After switching to the following config, I can reproduce the issue:

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-231220102417470677"
  location = "WestEurope"
}
resource "azurerm_storage_account" "test" {
  name                     = "acctestacclgmn2"
  resource_group_name      = azurerm_resource_group.test.name
  location                 = azurerm_resource_group.test.location
  account_tier             = "Standard"
  account_kind             = "StorageV2"
  account_replication_type = "LRS"
  is_hns_enabled           = true
  nfsv3_enabled            = true
  network_rules {
    default_action = "Deny"
    bypass         = ["Logging", "Metrics", "AzureServices"]
    ip_rules       = ["0.0.0.0/0"]
  }
}

resource "azurerm_storage_share" "test" {
  name                 = "testsharelgmnz"
  storage_account_name = azurerm_storage_account.test.name
  enabled_protocol     = "NFS"
  quota                = 101
}

The apply failed with:


│ Error: creating Share "testsharelgmnz" (Account "acctestacclgmn2" / Resource Group "acctestRG-231220102417470677"): shares.Client#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidHeaderValue" Message="The value for one of the HTTP headers is not in the correct format.\nRequestId:1f0e709c-201a-0045-05e4-4180ea000000\nTime:2024-01-08T03:41:26.5859377Z"

│ with azurerm_storage_share.test,
│ on main.tf line 29, in resource "azurerm_storage_share" "test":
│ 29: resource "azurerm_storage_share" "test" {

It seems the NFS file share is only supported for account_kind = "FileStorage" account. Otherwise, the data plane API used to create the share will failed as above, and the mgmt plane API will also fail (though only available via azapi provider), e.g.:

resource "azapi_resource" "test" {
  body = jsonencode({
    properties = {
      enabledProtocols = "NFS"
      accessTier       = "TransactionOptimized"
      metadata = {
        AzureBackupProtected = "true"
      }
      shareQuota        = 5120
      signedIdentifiers = []
    }
  })
  name      = "testshare"
  parent_id = "${azurerm_storage_account.test.id}/fileServices/default"
  type      = "Microsoft.Storage/storageAccounts/fileServices/shares@2023-01-01"
}

Failed with:

│ Error: creating/updating "Resource: (ResourceId \"/subscriptions/xxxx/resourceGroups/acctestRG-231220102417470677/providers/Microsoft.Storage/storageAccounts/acctestacclgmn2/fileServices/default/shares/testshare\" / Api Version \"2023-01-01\")": PUT https://management.azure.com/subscriptions/xxxx/resourceGroups/acctestRG-231220102417470677/providers/Microsoft.Storage/storageAccounts/acctestacclgmn2/fileServices/default/shares/testshare
│ --------------------------------------------------------------------------------
│ RESPONSE 400: 400 Bad Request
│ ERROR CODE: FeatureNotSupportedForAccount
│ --------------------------------------------------------------------------------
│ {
│   "error": {
│     "code": "FeatureNotSupportedForAccount",
│     "message": "NfsFileShares is not supported for the account."
│   }
│ }
│ --------------------------------------------------------------------------------
│
│
│   with azapi_resource.test,
│   on main.tf line 42, in resource "azapi_resource" "test":
│   42: resource "azapi_resource" "test" {
│
╵

@webstean
Copy link
Author

webstean commented Jan 9, 2024

Can some code be added, to provide a clear error message, when trying to create the NFS share?

Requirements
says, you must use the account_kind = "FileStorage"

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants