I am deploying a File Mount in Azure using following code block:
resource “azapi_resource_action” “itp_storage_mount_config” {
# count = var.create_storage_mount ? 1 : 0
type = “Microsoft.Web/sites/config@2023-12-01”
resource_id = data.azapi_resource_id.config.id
method = “PUT”
body = {
name = "azurestorageaccounts"
properties = {
ukitp = {
type = "FileShare"
protocol = "Smb"
accountName = var.serviceacct_name
shareName = var.file_system_itp_share_name
accessKey = "@AppSettingRef(SrvAcct_Pwd)"
mountPath = var.file_system_mount_path
endpoint = var.file_system_itp_endpoint
}
}
}
response_export_values = [
"properties.ukitp.mountPath",
"properties.ukitp.endpoint",
"properties.ukitp.shareName",
"properties.ukitp.type",
"properties.ukitp.accountName",
"properties.ukitp.accessKey",
"properties.ukitp.protocol",
"name"
]
}
# Create the file share required for salespoints function app
resource “azurerm_storage_share” “bibitpsalespoints_content” {
name = “{var.environment}-{var.project}-func-{var.role}-{var.region}-content”
storage_account_name = data.azurerm_storage_account.functionapp.name
quota = “5000”
}
This is used in a Logic app. On subsequent deployments this error is thrown:
│ CreateOrUpdate: unexpected status 400 (400 Bad Request) with response:
│ {“Code”:“BadRequest”,“Message”:"The parameter ‘Endpoint’ has an invalid
│ value. Details: Endpoint cannot be empty for File Share storage
│ mounts.",“Target”:null,“Details”:[{“Message”:"The parameter ‘Endpoint’ has
│ an invalid value. Details: Endpoint cannot be empty for File Share storage
│ mounts."},{“Code”:“BadRequest”},{“ErrorEntity”:{“ExtendedCode”:“01033”,“MessageTemplate”:"The
│ parameter ‘{0}’ has an invalid value. Details:
│ {1}.",“Parameters”:[“Endpoint”,"Endpoint cannot be empty for File Share
│ storage mounts"],“Code”:“BadRequest”,“Message”:"The parameter ‘Endpoint’
│ has an invalid value. Details: Endpoint cannot be empty for File Share
│ storage mounts."}}],“Innererror”:null}
It looks like subsequent deployments attempt to create and/or update the the resource again, as though the TF State has not been maintained. Anyone come across this issue before, nb that we are using az api provider.
Thanks