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: fix panic of slice index out-of-range #23019

Merged
merged 2 commits into from Aug 25, 2023

Conversation

wuxu92
Copy link
Contributor

@wuxu92 wuxu92 commented Aug 21, 2023

Not sure why need a uri.Path[1:] here, I guess it want to trim the leading slash (by the comment inline), so change to use strings.TrimPrefix

fixes: #23004

Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wuxu92, thank you for opening this PR. While the parsing code would fix the panic mentioned in the issue I think the real fix would be to add a ValidateFunc to the storage_data_lake_gen2_filesystem_id field in the schema. That way if the end users pass in an invalid storage_data_lake_gen2_filesystem_id it would be caught during plan phase of deployment. What do you think?

@wuxu92
Copy link
Contributor Author

wuxu92 commented Aug 25, 2023

@WodansSon thanks for your review. a validation func added to this field.

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :

Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.IsURLWithPath,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a resource id? should we not be validating it as an id not a uri?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katbyte, the ID here is in the form of a URI (e.g., https://storageaccountname.dfs.core.windows.net/filesystemname)

Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @wuxu92, thanks for pushing those changes, this LGTM now! 🚀

@WodansSon
Copy link
Collaborator

image

@WodansSon WodansSon merged commit d72e9d7 into hashicorp:main Aug 25, 2023
23 checks passed
@github-actions github-actions bot added this to the v3.72.0 milestone Aug 25, 2023
WodansSon added a commit that referenced this pull request Aug 25, 2023
WodansSon added a commit that referenced this pull request Aug 25, 2023
WodansSon added a commit that referenced this pull request Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

azurerm_synapse_workspace crashes provider if storage_data_lake_gen2_filesystem_id is missing path
3 participants