terraform-provider-ibm icon indicating copy to clipboard operation
terraform-provider-ibm copied to clipboard

regression: ICD for MongoDB and EnterpriseDB is reporting 'Unprocessable Entity'

Open shemau opened this issue 10 months ago • 7 comments

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 1.5.7 with IBM Provider 1.61.0

previously when creating MongoDB (6.0) and EnterpriseDB (12) with the ibm_database resource the following block was accepted:

  group {
    group_id = "member"
    memory {
      allocation_mb = var.memory_mb
    }
    disk {
      allocation_mb = var.disk_mb
    }
    cpu {
      allocation_count = var.cpu_count
    }
    members {
      allocation_count = var.members
    }
  }

Note: The values specified varied by database type.

Now this block causes

 ╷
│ Error: 1 error occurred:
│ 	* Unprocessable Entity
│ 
│ 
│ 
│   with module.enterprise_db.module.enterprise_db.ibm_database.enterprise_db,
│   on ../../main.tf line 52, in resource "ibm_database" "enterprise_db":
│   52: resource "ibm_database" "enterprise_db" {
│ 
╵

The error message is very poor. It gives no indication of what the problem is. Trial and error removing blocks until the command did not error isolated the failure with the group block. This used to work, but I have been unable to find a basic set of working values per

  • https://cloud.ibm.com/docs/databases-for-mongodb?topic=databases-for-mongodb-pricing#mongodb-scale-member
  • https://cloud.ibm.com/docs/databases-for-enterprisedb?topic=databases-for-enterprisedb-resources-scaling
  • Using custom in the UI to determine default/min/max options

Affected Resource(s)

  • ibm_database

Terraform Configuration Files

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

# https://github.com/terraform-ibm-modules/terraform-ibm-icd-mongodb

Debug Output

Nothing captured, the recreate is simple.

Panic Output

There is no cras.

Expected Behavior

Previous behaviour, the database instance should be provisioned

Actual Behavior

An error occurs that the entity is unprocessable .

Steps to Reproduce

Include the group block with minimal configurations (from the documentation link)

  1. terraform plan

Important Factoids

With the same terraform version and IBM Provider version the code still works for databases-for-postgresql. It is just failing with values that previously worked for mongo and enterprise.

References

  • #0000

shemau avatar Apr 08 '24 15:04 shemau

There should be more information after the message Unprocessable Entity which should help you narrow it down.

If not, could you set TF_LOG=DEBUG, re-run the command and send the log?

obai-1 avatar Apr 08 '24 17:04 obai-1

The entire error message is as above.

For mongo it is

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

╷
│ Error: 1 error occurred:
│       * Unprocessable Entity
│ 
│ 
│ 
│   with module.mongodb.module.mongodb.ibm_database.mongodb,
│   on ../../main.tf line 49, in resource "ibm_database" "mongodb":
│   49: resource "ibm_database" "mongodb" {
│ 

Additional information: The same error blocks destroy. Thus any existing infrastructure (created before the regression) can not be torn down until the code is changed and the group block removed.

shemau avatar Apr 09 '24 08:04 shemau

2024-04-09T09:30:13.732+0100 [INFO]  provider.terraform-provider-ibm_v1.64.0: 2024/04/09 09:30:13 [Debug] Response:
HTTP/2.0 200 OK
Cache-Control: no-store
Cf-Cache-Status: DYNAMIC
Cf-Ray: 871922449e0e71fa-LHR
Content-Security-Policy: frame-ancestors *.bluemix.net *.compose.fastkit *.cloud.ibm.com cloud.ibm.com
Content-Type: application/json; charset=utf-8
Date: Tue, 09 Apr 2024 08:30:13 GMT
Etag: W/"2cde4ace4634a34bd828f9fd9a1d660e"
Referrer-Policy: strict-origin-when-cross-origin
Server: cloudflare
Set-Cookie: _compose-dashboard_session=[redacted]; path=/; secure; HttpOnly
Strict-Transport-Security: max-age=63072000; includeSubDomains
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Envoy-Upstream-Service-Time: 164
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 1794c43d-b201-4212-940f-64005bd73ea2
X-Runtime: 0.159981
X-Xss-Protection: 1; mode=block

{"groups":[{"id":"member","count":3,"members":{"units":"count","allocation_count":3,"minimum_count":3,"maximum_count":3,"step_size_count":1,"is_adjustable":false,"is_optional":false,"can_scale_down":false},"memory":{"units":"mb","allocation_mb":43008,"minimum_mb":43008,"maximum_mb":344064,"step_size_mb":384,"is_adjustable":true,"is_optional":false,"can_scale_down":true},"disk":{"units":"mb","allocation_mb":61440,"minimum_mb":61440,"maximum_mb":12582912,"step_size_mb":3072,"is_adjustable":true,"is_optional":false,"can_scale_down":false,"storage_class":{"id":"icd-block-gold","iops_per_allocation_gb":10}},"cpu":{"units":"count","allocation_count":18,"minimum_count":18,"maximum_count":84,"step_size_count":3,"is_adjustable":true,"is_optional":false,"can_scale_down":true}},{"id":"analytics","count":0,"members":{"units":"count","allocation_count":0,"minimum_count":1,"maximum_count":1,"step_size_count":1,"is_adjustable":true,"is_optional":true,"can_scale_down":false},"memory":{"units":"mb","allocation_mb":0,"minimum_mb":0,"maximum_mb":0,"step_size_mb":0,"is_adjustable":true,"is_optional":false,"can_scale_down":true},"disk":{"units":"mb","allocation_mb":0,"minimum_mb":0,"maximum_mb":0,"step_size_mb":0,"is_adjustable":false,"is_optional":false,"can_scale_down":false,"storage_class":{"id":"icd-block-gold","iops_per_allocation_gb":10}},"cpu":{"units":"count","allocation_count":0,"minimum_count":0,"maximum_count":0,"step_size_count":0,"is_adjustable":true,"is_optional":false,"can_scale_down":true}},{"id":"bi_connector","count":0,"members":{"units":"count","allocation_count":0,"minimum_count":1,"maximum_count":1,"step_size_count":1,"is_adjustable":true,"is_optional":true,"can_scale_down":false},"memory":{"units":"mb","allocation_mb":0,"minimum_mb":0,"maximum_mb":0,"step_size_mb":0,"is_adjustable":true,"is_optional":false,"can_scale_down":true},"disk":{"units":"mb","allocation_mb":0,"minimum_mb":0,"maximum_mb":0,"step_size_mb":0,"is_adjustable":false,"is_optional":false,"can_scale_down":false,"storage_class":{"id":"icd-block-gold","iops_per_allocation_gb":10}},"cpu":{"units":"count","allocation_count":0,"minimum_count":0,"maximum_count":0,"step_size_count":0,"is_adjustable":true,"is_optional":false,"can_scale_down":true}}]}: timestamp=2024-04-09T09:30:13.732+0100
2024-04-09T09:30:13.732+0100 [INFO]  provider.terraform-provider-ibm_v1.64.0: 2024/04/09 09:30:13 [Debug] Request:
GET /v5/ibm/deployables/mongodbee/groups?host_flavor=multitenant HTTP/1.1
Host: api.us-south.databases.cloud.ibm.com
User-Agent: cloud-databases-go-sdk/0.6.0 (lang=go; arch=amd64; os=darwin; go.version=go1.19.13)
Accept: application/json
Authorization: [redacted]
X-Original-User-Agent: terraform-provider-ibm/1.64.0
Accept-Encoding: gzip

: timestamp=2024-04-09T09:30:13.732+0100
2024-04-09T09:30:13.732+0100 [INFO]  provider.terraform-provider-ibm_v1.64.0: 2024/04/09 09:30:13 [DEBUG] GET https://api.us-south.databases.cloud.ibm.com/v5/ibm/deployables/mongodbee/groups?host_flavor=multitenant: timestamp=2024-04-09T09:30:13.732+0100
2024-04-09T09:30:13.992+0100 [INFO]  provider.terraform-provider-ibm_v1.64.0: 2024/04/09 09:30:13 [Debug] Response:
HTTP/2.0 422 Unprocessable Entity
Connection: close
Cache-Control: no-store
Cf-Cache-Status: DYNAMIC
Cf-Ray: 8719224818b171fa-LHR
Content-Security-Policy: frame-ancestors *.bluemix.net *.compose.fastkit *.cloud.ibm.com cloud.ibm.com
Content-Type: application/json; charset=utf-8
Date: Tue, 09 Apr 2024 08:30:14 GMT
Referrer-Policy: strict-origin-when-cross-origin
Server: cloudflare
Set-Cookie: _compose-dashboard_session=[redacted]; path=/; secure; HttpOnly
Strict-Transport-Security: max-age=63072000; includeSubDomains
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Envoy-Upstream-Service-Time: 115
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: 80629db0-acde-4e02-bccb-e4cef3e8581d
X-Runtime: 0.111346
X-Xss-Protection: 1; mode=block

{"errors":{"deployment.host_flavor":["mongodbee is not available on multitenant"]}}: timestamp=2024-04-09T09:30:13.992+0100
2024-04-09T09:30:13.992+0100 [ERROR] provider.terraform-provider-ibm_v1.64.0: Response contains error diagnostic: @module=sdk.proto diagnostic_detail= tf_resource_type=ibm_database tf_rpc=PlanResourceChange tf_provider_addr=provider tf_req_id=cf0d326b-1f99-7184-db14-f19c4016e23b @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_severity=ERROR diagnostic_summary="1 error occurred:
	* Unprocessable Entity

" tf_proto_version=5.4 timestamp=2024-04-09T09:30:13.992+0100
2024-04-09T09:30:13.992+0100 [ERROR] vertex "module.mongodb.module.mongodb.ibm_database.mongodb" error: 1 error occurred:
	* Unprocessable Entity
2024-04-09T09:30:13.992+0100 [ERROR] vertex "module.mongodb.module.mongodb.ibm_database.mongodb (expand)" error: 1 error occurred:
	* Unprocessable Entity

The code does not include host_flavor within the group block. In this instance the plan is set to enterprise.

shemau avatar Apr 09 '24 08:04 shemau

Since the error appeared to related to mongodbee, which might reasonably be enterprise edition, I tried again with plan set to standard. This time it passed. So the error is ONLY with the enterprise plan AND a group block defined.

shemau avatar Apr 09 '24 08:04 shemau

For databases-for-enterprisedb the error is

{"errors":{"deployment.host_flavor":["enterprisedb is not available on multitenant"]}}: timestamp=2024-04-09T10:28:08.837+0100
2024-04-09T10:28:08.838+0100 [ERROR] provider.terraform-provider-ibm_v1.64.0: Response contains error diagnostic: tf_req_id=b260591d-07d4-53e9-dbae-0895053af2e0 @module=sdk.proto diagnostic_detail= diagnostic_severity=ERROR diagnostic_summary="1 error occurred:
        * Unprocessable Entity

In this case the plan is standard.

shemau avatar Apr 09 '24 09:04 shemau

@shemau you need to set the host_flavor for enterprisedb. host_flavors can be found here.

Please note that the multitenant option is not available for enterprisedb.

omaraibrahim avatar Apr 09 '24 14:04 omaraibrahim

@shemau we've gone ahead and released a fix for this in 1.64.2. Thank you for bringing this to our attention and we apologize for the inconvenience.

omaraibrahim avatar Apr 17 '24 18:04 omaraibrahim

1.64.2 resolved this issue.

shemau avatar May 01 '24 20:05 shemau