Fixing plugin crash when providing empty strings to argument #421
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a really simple fix that closes #409 by preventing the user to set the
names
argument fortfe_data_source_workspace_ids
to an array of empty strings or an array that contains empty strings. The reason for this is the plugin sdk fetches empty strings asnil
values, causing any type casting operations to panic.There is an alternative up for discussion, let's say the user provides
["wkspace1", "", "wkspace2"]
, should the plugin read this as["wkspace1", "wkspace2"]
omitting any entries that arenil
? This might be a better alternative as[]
is a valid assignment and therefore omitting entries that are nil (in a case where all entries are nil) would effectively be the same as[]
.Update: Decided to go with the alternative solution
Testing plan
To run acceptance test:
TESTARGS="-run TestAccTFEWorkspaceIDsDataSource_namesEmpty" make testacc