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

ibm_scc_scope_collection data lookup not returning when no scopes exist #6042

Open
ocofaigh opened this issue Mar 4, 2025 · 2 comments · May be fixed by #6051
Open

ibm_scc_scope_collection data lookup not returning when no scopes exist #6042

ocofaigh opened this issue Mar 4, 2025 · 2 comments · May be fixed by #6051
Labels
service/SCC Issues related to SCC

Comments

@ocofaigh
Copy link
Contributor

ocofaigh commented Mar 4, 2025

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 other comments that do not add relevant new information or questions, 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

Terraform CLI and Terraform IBM Provider Version

Terraform v1.9.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/random v3.7.1
+ provider registry.terraform.io/hashicorp/time v0.12.1
+ provider registry.terraform.io/ibm-cloud/ibm v1.76.0

Your version of Terraform is out of date! The latest version
is v1.11.0. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • ibm_scc_scope_collection

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

data "ibm_scc_scope_collection" "scc_scope_collection" {
  instance_id = "xxxxxxxxxxxxxxxx" # replace with guid of instance
}

Debug Output

Seems to be stuck in a loop:

2025-03-04T12:53:02.522Z [INFO]  provider.terraform-provider-ibm_v1.76.0: 2025/03/04 12:53:02 [Debug] Sending HTTP request message...: timestamp=2025-03-04T12:53:02.522Z
2025-03-04T12:53:02.522Z [INFO]  provider.terraform-provider-ibm_v1.76.0: 2025/03/04 12:53:02 [DEBUG] GET https://us-south.compliance.cloud.ibm.com/instances/97ade875-dd97-410c-8ec3-0f1b5024a33e/v3/scopes?start=: timestamp=2025-03-04T12:53:02.522Z
2025-03-04T12:53:02.787Z [INFO]  provider.terraform-provider-ibm_v1.76.0: 2025/03/04 12:53:02 [Debug] Considering retry attempt; status_code=200, method=GET, url=https://us-south.compliance.cloud.ibm.com/instances/97ade875-dd97-410c-8ec3-0f1b5024a33e/v3/scopes?start=, error=nil: timestamp=2025-03-04T12:53:02.784Z
2025-03-04T12:53:02.787Z [INFO]  provider.terraform-provider-ibm_v1.76.0: 2025/03/04 12:53:02 [Debug] No retry for status code: 200: timestamp=2025-03-04T12:53:02.784Z
2025-03-04T12:53:02.787Z [INFO]  provider.terraform-provider-ibm_v1.76.0: 2025/03/04 12:53:02 [Debug] Received HTTP response message, status code 200: timestamp=2025-03-04T12:53:02.784Z
2025-03-04T12:53:02.787Z [INFO]  provider.terraform-provider-ibm_v1.76.0: 2025/03/04 12:53:02 [Debug] Response:
HTTP/2.0 200 OK
Cache-Control: no-store
Cf-Cache-Status: DYNAMIC
Cf-Ray: 91b183a33ec4be20-DUB
Content-Type: application/json; charset=utf-8
Date: Tue, 04 Mar 2025 12:53:02 GMT
Server: cloudflare
Strict-Transport-Security: max-age=31536000; includeSubDomains
Transaction-Id: 84c4ae6d-3815-4667-b3dc-70274178f355
X-Content-Type-Options: nosniff
X-Correlation-Id: d132c3af-f77d-4763-8b33-3e14df180b6b
X-Envoy-Upstream-Service-Time: 97
X-Request-Id: 2ff94f0a-91fa-4373-9d06-ddebf9c5b60e

{"total_count":0,"limit":0,"first":{"href":""},"next":{"href":"","start":""},"scopes":[]}: timestamp=2025-03-04T12:53:02.785Z

debug.log

Panic Output

Expected Behavior

Data lookup should return successfully

Actual Behavior

I waited over 15mins and it still didn't pass:

data.ibm_scc_scope_collection.scc_scope_collection: Still reading... [15m10s elapsed]
data.ibm_scc_scope_collection.scc_scope_collection: Still reading... [15m20s elapsed]
data.ibm_scc_scope_collection.scc_scope_collection: Still reading... [15m30s elapsed]
data.ibm_scc_scope_collection.scc_scope_collection: Still reading... [15m40s elapsed]

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@github-actions github-actions bot added the service/SCC Issues related to SCC label Mar 4, 2025
@ocofaigh
Copy link
Contributor Author

ocofaigh commented Mar 4, 2025

Seems this happens when no scopes exist in an instance yet

@ocofaigh ocofaigh changed the title ibm_scc_scope_collection data lookup not working ibm_scc_scope_collection data lookup not returning when no scopes exist Mar 4, 2025
@tyao117
Copy link
Contributor

tyao117 commented Mar 4, 2025

Found the source of the issue; I was able to replicate the problem creating a SCC instance with no scopes. Using REST calls directly to the endpoint that datasource is using, you will see a response similar to this:

{
  "total_count": 0,
  "limit": 0,
  "first": {
    "href": ""
  },
  "next": {
    "href": "",
    "start": ""
  },
  "scopes": []
}

The SDK is seeing that a .next attribute is being returned and thus thinks that another pagination is available. This is an API defect but i can provide a temp fix for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/SCC Issues related to SCC
Projects
None yet
2 participants