terraform-provider-azurerm: Error refreshing State on previously created Storage Account

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

Terraform (and AzureRM Provider) Version

Terraform 0.13.7 Azure Provider 2.65.0

Affected Resource(s)

  • azurerm_storage_account

Terraform Configuration Files

resource "azurerm_storage_account" "redacted" {
  name                     = "redacted"
  resource_group_name      = azurerm_resource_group.data.name
  location                 = "Australia East"
  account_tier             = "Standard"
  account_replication_type = "GRS"
  account_kind             = "Storage"
  enable_https_traffic_only = false
  tags = {
    owner       = var.tagOwner
    description = "The storage account used for App Service Backups and SQL Logs for Australia"    
    usage       = var.tagUsage
    config      = var.tagConfig
  }
}

Expected Behaviour

This storage account was created >12 months ago using Terraform. The last successful run of this workspace was using provider 2.18.0 When refreshing the workspace resources in order to make an unrelated change to a different component, Terraform should not return an error.

Actual Behaviour

When refreshing the state Terraform returns the error:

Error: reading share properties for AzureRM Storage Account "redacted": storage.FileServicesClient#GetServiceProperties: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="FeatureNotSupportedForAccount" Message="File is not supported for the account."

Speaking with Vladimir Lazarenko on Slack, the error comes from the following code:

	if resp.Kind == storage.FileStorage || resp.Kind != storage.BlobStorage && resp.Kind != storage.BlockBlobStorage && resp.Sku != nil && resp.Sku.Tier != storage.Premium {
		shareProps, err := fileServiceClient.GetServiceProperties(ctx, resGroup, name)
		if err != nil {
			if !utils.ResponseWasNotFound(shareProps.Response) {
				return fmt.Errorf("reading share properties for AzureRM Storage Account %q: %+v", name, err)
			}
		}
		if err := d.Set("share_properties", flattenShareProperties(shareProps)); err != nil {
			return fmt.Errorf("setting `share_properties `for AzureRM Storage Account %q: %+v", name, err)
		}
	}

Steps to Reproduce

  1. Make a change to a resource in a workspace that also has a Storage Account with the settings in above config.
  2. Use recent Azure Provider
  3. Reverting provider to 2.18.0 causes this not to be an issue. I have tried latest 5 releases of Provider and the issue is present, 2.18.0 was the version when we had our last successful run. Reverting back to this version resolves the issue.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

πŸ‘‹ hey folks

Looking through this one, I’d tend to agree that 2 is probably the right approach to go here - as such I’ve tagged this as a breaking-change which we can address in 3.0.

Thanks!

Sorry for the misunderstanding, I’m not trying to say the Terraform provider should not support this scenario. I’ll figure out if it is possible to fix it, and let you know the outcome.

Depending on your own timeframe and other influences you should do what suits best for you. Just trying to give the options.