Closed ifs-anthonylecarrer closed 1 month ago
@ifs-anthonylecarrer Thank you for reaching out! Could you please set the logs to debug mode? You can do so as follows in the Terraform Provider
, export TF_LOG=DEBUG
After doing so, please run your code again. You should hopefully see all the API calls being triggered in the logs. Then send them and we'll be able to better assist you :D
Thank you and I apologize for the inconvenience.
The provider 1.49 is working with the same code. Are u asking me to do your job and to test your provider ?
@ifs-anthonylecarrer I'm asking you to provide the logs to help me support you.
@ifs-anthonylecarrer auto_scaling was refactored to use a different client library in the last release so this does appear to be a change in behavior. The template provided is setting auto_scaling
blocks with null values which now in v1.50.0 results in an API call that returns an error. Here is the autoscaling API call/response from the template you provided.
PATCH https://api.us-south.databases.cloud.ibm.com/v5/ibm/deployments/{crn}/groups/member/autoscaling
{
"autoscaling": {
"disk": {
"scalers": {
"capacity": {
"enabled": false,
"free_space_less_than_percent": 0
},
"io_utilization": {
"enabled": false,
"over_period": "",
"above_percent": 0
}
},
"rate": {
"increase_percent": 0,
"period_seconds": 0,
"limit_mb_per_member": 0,
"units": ""
}
},
"memory": {
"scalers": {
"io_utilization": {
"enabled": false,
"over_period": "",
"above_percent": 0
}
},
"rate": {
"increase_percent": 0,
"period_seconds": 0,
"limit_mb_per_member": 0,
"units": ""
}
}
}
}
HTTP/2.0 422 Unprocessable Entity
{
"errors": {
"autoscaling.rate.period_seconds": [
"must be greater than or equal to 60"
],
"disk.scalers.io_utilization.over_period": [
"must be one of [\"5m\", \"15m\", \"30m\", \"60m\"]" a user error
]
}
}
I would suggest as an interim fix to modify the template to not set auto_scaling
blocks with null / empty values as this has undocumented behavior while we investigate. Also, the cpu
auto_scaling
block is unused and can be removed as there is no auto scaling for CPU resources for IBM Cloud Databases.
There are additional issues with the cpu
block in IBM Cloud provider 1.51 and 1.53.
When setting the auto_scaling
cpu
rate_limit_count_per_member
to 20 the first apply works, but fails to set the value. This is clearly a bug.
Folloing this a second apply (with no changes) results in:
Terraform will perform the following actions:
# module.postgresql_db.ibm_database.postgresql_db will be updated in-place
~ resource "ibm_database" "postgresql_db" {
id = "crn:v1:bluemix:public:databases-for-postgresql:us-south:a/abac0df06b644a9cabc6e44f55b3880e:454508e1-4d6a-45e3-aac1-98c08353ab6f::"
name = "steve-n12-postgres"
tags = []
# (26 unchanged attributes hidden)
~ auto_scaling {
~ cpu {
~ rate_limit_count_per_member = 30 -> 20
# (3 unchanged attributes hidden)
}
# (2 unchanged blocks hidden)
}
# (2 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.postgresql_db.ibm_database.postgresql_db: Modifying... [id=crn:v1:bluemix:public:databases-for-postgresql:us-south:a/abac0df06b644a9cabc6e44f55b3880e:454508e1-4d6a-45e3-aac1-98c08353ab6f::]
β·
β Error: [ERROR] Error updating database memory auto_scaling group: Unprocessable Entity
β
β with module.postgresql_db.ibm_database.postgresql_db,
β on ../../main.tf line 42, in resource "ibm_database" "postgresql_db":
β 42: resource "ibm_database" "postgresql_db" {
β
β΅
which is another bug, since it was processable the first time and is suddenly no longer processable.
Should the documentation for the cpu block be removed from the terraform ibm_database resource if it is not used and causes issues if is coded? Additionally the documentation is missing an entry for auto_scaling
disk
io_over_period
which appears to be a legitimate value with a counterpart in the UI (Resource, Autoscaling, disk average IO utilization above, for more than box).
Just to add to @shemau's comment above, when you try and actually set the rate_limit_count_per_member
to 30
in the code, the error you get is:
β Error: [ERROR] Error updating database cpu auto_scaling group: Request failed with status code: 422, ServerErrorResponse: {"errors":{"cpu.rate.limit_count_per_member":["cannot autoscale higher than regular scaling limit"]}}
β
β with module.postgresql_db.ibm_database.postgresql_db,
β on ../../main.tf line 42, in resource "ibm_database" "postgresql_db":
β 42: resource "ibm_database" "postgresql_db" {
β
β΅
If CPU auto scaling is not supported by ICD, then the documentation needs to be updated because clearly if you try to use it, things break. cc @alexhemard I would also expect the provider to do some validation here before it attempts to use these values during provision time, and hence fails the terraform apply. Should be caught at plan time
@ocofaigh Correct, there is no cpu
autoscaling. Our docs do not explicity state it, but confusingly it appears in our API. We are looking at clarifying/removing the cpu block.
Additionally the documentation is missing an entry for auto_scaling disk io_over_period which appears to be a legitimate value with a counterpart in the UI
@shemau Thanks for catching this! I'll try and get this fix prioritized
Community Note
Terraform CLI and Terraform IBM Provider Version
terraform : 1.3 terraform ibmcloud provider : 1.50.0
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Debug Output
Panic Output
Expected Behavior
NO ERROR
Actual Behavior
Deploy failed
Steps to Reproduce
terraform apply -var-file validation-values.json
Important Factoids
References
0000