aztfexport icon indicating copy to clipboard operation
aztfexport copied to clipboard

Azure Redis Cache can't be imported

Open chaoscreater opened this issue 10 months ago • 1 comments

I'm getting the following error on Redis Cache and this error is consistently found across all RGs that have this resource type.

Error: generating Terraform configuration: converting from state to configurations: generating state for resource azurerm_redis_cache.res-2: tune template for azurerm_redis_cache: () tunning attributes: (redis_version) checking attribute value is default or zero: converting cty value 6 to Go: can't convert Go float64 to string

Image

Currently, I have to use the following to exclude certain resource types from being imported. If I don't do this, the main.tf file doesn't get generated for the rest of the resources in the same RG as those problematic resource types.

aztfexport query `
	-n `
	-f `
	-k `
	--include-role-assignment `
	--mask-sensitive `
	--hcl-only `
	--tfclient-plugin-path "$Plugin_Cache_Provider_Path\terraform-provider-azurerm_v$($LatestProviderVersion)_x5.exe" `
	--provider-name azurerm `
	--provider-version $LatestProviderVersion `
	--log-level $LogLevel `
	--parallelism 1 `
	--log-path "$ExportPath\tfexportlogs.log" `
	--output-dir "$ExportPath" `
	--client-id "$env:ARM_CLIENT_ID" `
	--client-secret "$env:ARM_CLIENT_SECRET" `
	--tenant-id "$env:ARM_TENANT_ID" `
	"resourceGroup =~ '$ResourceGroup' and tags !contains 'deployed_by_amba' and not(type =~ 'Microsoft.Cache/Redis') and not(type =~ 'Microsoft.OperationsManagement/solutions') and not(type =~ 'Microsoft.Logic/workflows/triggers') and not(type =~ 'Microsoft.Logic/workflows')"

chaoscreater avatar Feb 19 '25 10:02 chaoscreater

@chaoscreater Thanks for this report! We can fix that once the upstream PR above got merged. Meanwhile, you can use the --full-properties option to skip the property tuning step, hence get a full version of the configuration. You'll likely need to tune the config manually to make it valid then.

magodo avatar Feb 20 '25 07:02 magodo