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

azurerm_synapse_workspace crashes provider if storage_data_lake_gen2_filesystem_id is missing path #23004

Closed
1 task done
pacon-ar opened this issue Aug 18, 2023 · 4 comments · Fixed by #23019
Closed
1 task done

Comments

@pacon-ar
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

9999

AzureRM Provider Version

3.69.0

Affected Resource(s)/Data Source(s)

azurerm_synapse_workspace

Terraform Configuration Files

See "References"

Debug Output/Panic Output

panic, "slide bounds out of range"

Expected Behaviour

Not crash

Actual Behaviour

Crash

Steps to Reproduce

  1. supply a value to the storage_data_lake_gen2_filesystem_id attribute of the azurerm_synapse_workspace resource which is a URL but lacks a path element e.g. "https://foo.bar.example.net"
  2. terraform apply

Important Factoids

No response

References

storage_data_lake_gen2_filesystem_id is a URL including a single path element e.g. https://foo.bar.example.net/pathelement1

When parsing the attribute storage_data_lake_gen2_filesystem_id, the provider throws away any trailing path elements: https://github.com/hashicorp/terraform-provider-azurerm/blob/43f8ab0860fb588d95c34a1b109c09c41b9b3275/internal/services/synapse/synapse_workspace_resource.go#L798C13-L798C13

    Filesystem: utils.String(uri.Path[1:])

However does so in a way that assumes there is at least one path element. If there is no path element (e.g. user got mixed up and provided a DFS endpoint instead of a filesystem ID) then the provider will crash/panic.

Suggested fix is to add a check for the number of elements in the path, throw a specific error back to the user if the ID is malformed (e.g. lacking path element).

@rcskosir
Copy link
Contributor

Thanks for taking the time to submit this issue. Can you provide us with a more complete TF configuration as well as the panic output? It will help with reproducing this issue to confirm your findings and suggestions.
Thanks!

@pacon-ar
Copy link
Author

Hi @rcskosir, the situation is that I wasn't the one who hit this bug and the affected terraform configuration no longer exists. I will put together an illustrative test case and a fix, but not sure "when". :-)

For now hopefully the report will show up in google searches for others hitting the same issue, so they know they are not going mad.

WodansSon pushed a commit that referenced this issue Aug 25, 2023
* fix panic of path slice index

* add a validation for storage_data_lake_gen2_filesystem_id
@pacon-ar
Copy link
Author

Thankyou @wuxu92

Copy link

github-actions bot commented May 7, 2024

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 May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants