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

Fix: Resource group crash #2809

Merged
merged 1 commit into from
Jul 5, 2021
Merged

Conversation

kavya498
Copy link
Collaborator

@kavya498 kavya498 commented Jul 2, 2021

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #2808

Output from acceptance testing:

=== RUN   TestAccIBMResourceGroupDataSource_Basic
--- PASS: TestAccIBMResourceGroupDataSource_Basic (38.58s)
PASS
ok  	github.com/IBM-Cloud/terraform-provider-ibm/ibm	40.710s
...

@@ -72,12 +72,12 @@ func dataSourceIBMResourceGroupRead(d *schema.ResourceData, meta interface{}) er
}
grp, err := rsGroup.FindByName(resourceGroupQuery, name)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a condition check of len(grp) < 1 here also

Copy link
Collaborator Author

@kavya498 kavya498 Jul 5, 2021

Choose a reason for hiding this comment

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

FindByName function is already checking the condition..

@@ -72,12 +72,12 @@ func dataSourceIBMResourceGroupRead(d *schema.ResourceData, meta interface{}) er
}
grp, err := rsGroup.FindByName(resourceGroupQuery, name)
if err != nil {
return fmt.Errorf("Error retrieving resource group %s: %s", name, err)
return fmt.Errorf("[ERROR] Error retrieving resource group %s: %s", name, err)
}
d.SetId(grp[0].ID)

} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can remove this block by adding ExactlyOneOf

@hkantare hkantare merged commit 361af87 into IBM-Cloud:master Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The terraform-provider-ibm_v1.27.1 plugin crashed
2 participants