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

bitbucket_default_reviewers crash when reviewers are greater than 10 #215

Open
quentin9696 opened this issue Aug 16, 2024 · 0 comments
Open

Comments

@quentin9696
Copy link

Hi there,

Terraform Version

Terraform v1.9.4
on linux_amd64
+ provider registry.terraform.io/drfaust92/bitbucket v2.42.0

Affected Resource(s)

  • bitbucket_default_reviewers

Terraform Configuration Files

terraform {
  required_version = ">= 1.3"

  required_providers {
    bitbucket = {
      source  = "DrFaust92/bitbucket"
      version = "2.42.0"
    }
  }
}

resource "bitbucket_default_reviewers" "this" {
  owner      = REDACTED
  repository = REDACTED

  reviewers = ["a list with more that 10 users - REDACTED"]
}

provider "bitbucket" {
  username = var.bitbucket_username
  password = var.bitbucket_app_password
}

variable "bitbucket_username" {
  type        = string
}

variable "bitbucket_app_password" {
  type        = string
  sensitive   = true
}

Debug Output

bitbucket_default_reviewers.this: Refreshing state... [id=REDACTED/REDACTED/reviewers]
2024-08-16T18:57:58.561-0400 [TRACE] GRPCProvider: ReadResource
2024-08-16T18:57:58.561-0400 [TRACE] GRPCProvider: GetProviderSchema
2024-08-16T18:57:58.561-0400 [TRACE] GRPCProvider: returning cached schema: EXTRA_VALUE_AT_END=registry.terraform.io/drfaust92/bitbucket
2024-08-16T18:57:58.562-0400 [TRACE] provider.terraform-provider-bitbucket_v2.42.0: Received request: tf_proto_version=5.4 tf_req_id=cc37a1a7-7274-2776-0447-1bf1b3e02e64 tf_resource_type=bitbucket_default_reviewers tf_rpc=ReadResource @module=sdk.proto tf_provider_addr=DrFaust92/bitbucket @caller=github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:763 timestamp=2024-08-16T18:57:58.562-0400
2024-08-16T18:57:58.562-0400 [TRACE] provider.terraform-provider-bitbucket_v2.42.0: Sending request downstream: tf_provider_addr=DrFaust92/bitbucket tf_req_id=cc37a1a7-7274-2776-0447-1bf1b3e02e64 tf_resource_type=bitbucket_default_reviewers tf_proto_version=5.4 tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:20 @module=sdk.proto timestamp=2024-08-16T18:57:58.562-0400
2024-08-16T18:57:58.562-0400 [TRACE] provider.terraform-provider-bitbucket_v2.42.0: Calling downstream: @module=sdk.helper_schema tf_resource_type=bitbucket_default_reviewers @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:1088 tf_provider_addr=DrFaust92/bitbucket tf_req_id=cc37a1a7-7274-2776-0447-1bf1b3e02e64 tf_rpc=ReadResource timestamp=2024-08-16T18:57:58.562-0400
2024-08-16T18:57:59.189-0400 [TRACE] provider.terraform-provider-bitbucket_v2.42.0: Called downstream: @module=sdk.helper_schema tf_provider_addr=DrFaust92/bitbucket tf_resource_type=bitbucket_default_reviewers @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.32.0/helper/schema/resource.go:1090 tf_req_id=cc37a1a7-7274-2776-0447-1bf1b3e02e64 tf_rpc=ReadResource timestamp=2024-08-16T18:57:59.188-0400
2024-08-16T18:57:59.189-0400 [TRACE] provider.terraform-provider-bitbucket_v2.42.0: Received downstream response: tf_provider_addr=DrFaust92/bitbucket tf_req_duration_ms=626 tf_resource_type=bitbucket_default_reviewers tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:40 diagnostic_error_count=1 diagnostic_warning_count=0 tf_proto_version=5.4 tf_req_id=cc37a1a7-7274-2776-0447-1bf1b3e02e64 @module=sdk.proto timestamp=2024-08-16T18:57:59.189-0400
2024-08-16T18:57:59.189-0400 [ERROR] provider.terraform-provider-bitbucket_v2.42.0: Response contains error diagnostic: @module=sdk.proto diagnostic_detail="" diagnostic_severity=ERROR tf_proto_version=5.4 @caller=github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/internal/diag/diagnostics.go:62 diagnostic_summary="400 Bad Request: Invalid page" tf_provider_addr=DrFaust92/bitbucket tf_req_id=cc37a1a7-7274-2776-0447-1bf1b3e02e64 tf_resource_type=bitbucket_default_reviewers tf_rpc=ReadResource timestamp=2024-08-16T18:57:59.189-0400
2024-08-16T18:57:59.189-0400 [TRACE] provider.terraform-provider-bitbucket_v2.42.0: Served request: @caller=github.com/hashicorp/terraform-plugin-go@v0.21.0/tfprotov5/tf5server/server.go:788 tf_proto_version=5.4 tf_provider_addr=DrFaust92/bitbucket @module=sdk.proto tf_req_id=cc37a1a7-7274-2776-0447-1bf1b3e02e64 tf_resource_type=bitbucket_default_reviewers tf_rpc=ReadResource timestamp=2024-08-16T18:57:59.189-0400
2024-08-16T18:57:59.189-0400 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/drfaust92/bitbucket" is in the global cache
2024-08-16T18:57:59.189-0400 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to prevRunState for bitbucket_default_reviewers.this
2024-08-16T18:57:59.189-0400 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: writing state object for bitbucket_default_reviewers.this
2024-08-16T18:57:59.189-0400 [ERROR] vertex "bitbucket_default_reviewers.this" error: 400 Bad Request: Invalid page
2024-08-16T18:57:59.189-0400 [TRACE] vertex "bitbucket_default_reviewers.this": visit complete, with errors
2024-08-16T18:57:59.189-0400 [TRACE] dag/walk: upstream of "root" errored, so skipping
2024-08-16T18:57:59.189-0400 [TRACE] vertex "bitbucket_default_reviewers.this (expand)": dynamic subgraph encountered errors: 400 Bad Request: Invalid page
2024-08-16T18:57:59.189-0400 [ERROR] vertex "bitbucket_default_reviewers.this (expand)" error: 400 Bad Request: Invalid page
2024-08-16T18:57:59.189-0400 [TRACE] vertex "bitbucket_default_reviewers.this (expand)": visit complete, with errors
2024-08-16T18:57:59.189-0400 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/drfaust92/bitbucket\"] (close)" errored, so skipping
2024-08-16T18:57:59.189-0400 [TRACE] dag/walk: upstream of "root" errored, so skipping
2024-08-16T18:57:59.189-0400 [TRACE] LoadSchemas: retrieving schema for provider type "registry.terraform.io/drfaust92/bitbucket"
2024-08-16T18:57:59.189-0400 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/drfaust92/bitbucket" is in the global cache
2024-08-16T18:57:59.189-0400 [TRACE] LoadSchemas: retrieving schema for provider type "registry.terraform.io/drfaust92/bitbucket"
2024-08-16T18:57:59.189-0400 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/drfaust92/bitbucket" is in the global cache
2024-08-16T18:57:59.189-0400 [WARN]  Planning encountered errors, so plan is not applyable
2024-08-16T18:57:59.189-0400 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/drfaust92/bitbucket" is in the global cache
2024-08-16T18:57:59.189-0400 [TRACE] LoadSchemas: retrieving schema for provider type "registry.terraform.io/drfaust92/bitbucket"
2024-08-16T18:57:59.189-0400 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/drfaust92/bitbucket" is in the global cache
2024-08-16T18:57:59.189-0400 [INFO]  backend/local: plan operation completed
2024-08-16T18:57:59.189-0400 [TRACE] LoadSchemas: retrieving schema for provider type "registry.terraform.io/drfaust92/bitbucket"
2024-08-16T18:57:59.189-0400 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/drfaust92/bitbucket" is in the global cache

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: 400 Bad Request: Invalid page
│ 
│ 
╵
2024-08-16T18:57:59.189-0400 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2024-08-16T18:57:59.190-0400 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2024-08-16T18:57:59.190-0400 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-08-16T18:57:59.194-0400 [INFO]  provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/drfaust92/bitbucket/2.42.0/linux_amd64/terraform-provider-bitbucket_v2.42.0 id=319331
2024-08-16T18:57:59.194-0400 [DEBUG] provider: plugin exited

Expected Behavior

Refresh is done correctly - having more that 10 users. Less or equal 10 users works perfectly

Actual Behavior

The provider crash with a 400 page error, only when the number of user set on bitbucket is less or equal to 10. More than 10 cause this issue

Steps to Reproduce

  1. Setup 11 default reviewers on a repository
  2. terraform apply
  3. Having the error

Important Factoids

I tested the API, it automatically paginate to 10 default reviewer on the list default reviewers. We can add a ?pagelen=100 to have more than 10, or use the next included in the returned JSON of the first request as describe in the API doc https://developer.atlassian.com/cloud/bitbucket/rest/intro/#pagination

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

No branches or pull requests

1 participant