Case sensitivity causing exports to fail
I'm trying to export a resource group and it was chugging along great until it hit this error:
Error: Failed to import /subscriptions/aaaaaaaa-0000-aaaa-aa-aaaaaaaaaaaa/resourceGroups/defaultresourcegroup-eus/providers/Microsoft.OperationsManagement/solutions/SQLAuditing[defaultworkspace-defaultworkspace-aaaaaaaa-0000-aaaa-aa-aaaaaaaaaaaa-eus] as azurerm_log_analytics_solution.res-575: exit status 1
Error: expected "SQLAuditing[defaultworkspace-aaaaaaaa-0000-aaaa-aa-aaaaaaaaaaaa-eus]" to match 'Solution(WorkspaceName)'
When I investigated the issue, I saw that the rest of the resources use this as the resource group name:
DefaultWorkspace-aaaaaaaa-0000-aaaa-aa-aaaaaaaaaaaa-EUS
but this one uses:
defaultworkspace-aaaaaaaa-0000-aaaa-aa-aaaaaaaaaaaa-eus
Any chance this match could be made case insensitive?
@skadz From the error message:
Error: expected "SQLAuditing[defaultworkspace-aaaaaaaa-0000-aaaa-aa-aaaaaaaaaaaa-eus]" to match 'Solution(WorkspaceName)'
It seems the resource name violates the expectation of the provider, which is defined at https://github.com/hashicorp/terraform-provider-azurerm/blob/fc0bfa18efa74a94c24b12eda48b00cb508c7d22/internal/services/loganalytics/log_analytics_solution_resource.go#L223-L236:
// Reversing the mapping used to get .solution_name
// expecting resp.Name to be in format "SolutionName(WorkspaceName)".
if v := model.Name; v != nil {
val := pointer.From(v)
segments := strings.Split(val, "(")
if len(segments) != 2 {
return fmt.Errorf("expected %q to match 'Solution(WorkspaceName)'", val)
}
solutionName := segments[0]
workspaceName := strings.TrimSuffix(segments[1], ")")
state.SolutionName = solutionName
state.WorkspaceName = workspaceName
}
This means if you manually run terraform import to import this resource, you'll get the same error. This either indicates the provider doesn't support importing this resource, or you shall not import this resource at all (as it is a built-in resource managed by other means)?
:wave:
Since we've not heard back here I'm going to close this issue for the moment. Feel free to reopen if still have questions.