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 the 5635 - The ibm_resource_tag now checks the response in the api tags calls #5641

Merged
merged 16 commits into from
Sep 17, 2024

Conversation

luiof
Copy link
Contributor

@luiof luiof commented Sep 13, 2024

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 #5635

Changes:

  • This PR fixes the [Bug] The ibm_resource_tag does not check the response on api tags calls #5635
  • The ibm_resource_tag has been updated with the Context function and the new error handling.
  • The ibm/flex/structures.go file, in particular the UpdateTagsUsingCRN function has been updated with the v1 client and a check on the results array has been added.
  • The check on the results of the GhoST API has been added on all the functions to avoid issues in the resource attachment and detachment. This fix will be applied in all resources that are attaching tags since the bug is in each of them.
  • Added extra tests in in the ibm_resource_tag test suite to check after the destroy.
  • The delete tags call has been removed in the UpdateGlobalTagsUsingCRN function since a tag can exists on other resources and out of the terraform code too. The ibm_resource_tag must be handle only the attach and the detach.
  • Removed unused structures from the GetGlobalTagsUsingCRN function.
  • Added the GetTagsUsingResourceCRNFromTaggingApi function to retrieve an attached tag on a resource. This can be used in the test suite since we run them manually. I used it in the destroy step check.
  • The _Wait test has been removed since it is a duplication of the _Create test.

Output from acceptance testing:

$ make testacc TEST=./ibm/service/globaltagging TESTARGS='-run=TestAccResourceTag_Basic -count=1'

2024-09-13T12:45:21.347+0200 [DEBUG] sdk.helper_resource: Finished TestCase: test_name=TestAccResourceTag_Basic
--- PASS: TestAccResourceTag_Basic (86.95s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/globaltagging   89.638s
$ make testacc TEST=./ibm/service/globaltagging TESTARGS='-run=TestAccResourceTag_FakeCrnExpectingError -count=1'

2024-09-13T12:46:47.335+0200 [DEBUG] sdk.helper_resource: Finished TestCase: test_name=TestAccResourceTag_FakeCrnExpectingError
--- PASS: TestAccResourceTag_FakeCrnExpectingError (18.59s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/globaltagging   20.125s
$ make testacc TEST=./ibm/service/globaltagging TESTARGS='-run=TestAccResourceTag_AttachOnExistingResource -count=1'

2024-09-13T12:48:47.025+0200 [DEBUG] sdk.helper_resource: Finished TestCase: test_name=TestAccResourceTag_AttachOnExistingResource
--- PASS: TestAccResourceTag_AttachOnExistingResource (53.15s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/globaltagging   54.646s
$ make testacc TEST=./ibm/service/globaltagging TESTARGS='-run=TestAccResourceTag_replace_Basic -count=1'

--- PASS: TestAccResourceTag_replace_Basic (108.01s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/globaltagging   109.560s
$ make testacc TEST=./ibm/service/globaltagging TESTARGS='-run=TestAccIamAccessTag_Basic -count=1'

2024-09-13T12:52:49.930+0200 [DEBUG] sdk.helper_resource: Finished TestCase: test_name=TestAccIamAccessTag_Basic
--- PASS: TestAccIamAccessTag_Basic (34.91s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/globaltagging   36.430s
$ make testacc TEST=./ibm/service/globaltagging TESTARGS='-run=TestAccIamAccessTag_Usage -count=1'

2024-09-13T12:59:56.035+0200 [DEBUG] sdk.helper_resource: Finished TestCase: test_name=TestAccIamAccessTag_Usage
--- PASS: TestAccIamAccessTag_Usage (107.73s)
PASS
ok      github.com/IBM-Cloud/terraform-provider-ibm/ibm/service/globaltagging   109.264s

@hkantare hkantare merged commit 54c8962 into IBM-Cloud:master Sep 17, 2024
1 check passed
srikant-sahu pushed a commit to srikant-sahu/terraform-provider-ibm that referenced this pull request Sep 24, 2024
…i tags calls (IBM-Cloud#5641)

* Deprecated ibm_resource_access_tag in favor of ibm_iam_access_tag

* changes

* Fix

* Changed resource to speed up tests

* fix

* PR changes

* PR changes

* Added new context functions.
Now the code handles the error in the response on resource tags calls.

* Fixed 5635

* Fix

* Fixed

* Removed logs line
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.

[Bug] The ibm_resource_tag does not check the response on api tags calls
3 participants