-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
[Bug]: Apply fails with error InvalidParameterValue: Serverless v2 maximum capacity 0.0 isn't valid. The maximum capacity must be at least 1.0.
when capacity is not specified
#40473
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
cc @ohookins Hi, saw your PR reducing the limit to 0, any idea what might be going on here? |
It seems to correlate, although I don't see how it could be happening if you don't define that block at all: terraform-provider-aws/internal/service/rds/cluster.go Lines 1578 to 1582 in 145fc0c
If the block isn't defined it shouldn't even try to do anything with it. Can you share your config? |
Maybe @jackkates did the same mistake that I did. I had a dynamic block for the serverless configuration that was deactivated for non-serverless databases. And I had the same "terraform plan" all the last months where the capacity should be changed to "null". And the Terraform Provider versions 5.79.0 and before accepted that and did simply nothing and in the next run of Terraform the plan showed me the same things again. |
As this may strictly speaking be a regression (we aim to be 100% backwards compatible with existing configurations), could @pioneer2k or @jackkates add in a simple configuration that exhibits the problem. Thanks. |
Here is my code block that I was using with version 5.79.0 and before.
If var.serverless_v2_enabled was set, then everything always worked fine and the parameters max_capacity and min_capacity were set to a valid value, even on non-serverless databases. |
Okay I brushed up on Aurora Serverless v2 and now recall that they switched back to using EngineMode: provisioned for serverlessv2. so even a db with all non-serverless instances could still have a ServerlessV2ScalingConfiguration. In fact, I see one on my database when I run How such a config got onto our database, I'm not sure (we don't have a dynamic block for this parameter). But seems to be same as the issue described above where we saw that change in the plan and then now have an apply error trying to remove(?) the config. I was able to recover the API request terraform made through Cloudtrail and confirm that it sent a zero for both
It doesn't seem correct to zero the values out instead of removing it. Not sure if you actually can remove the whole parameter, maybe can call ModifyDBCluster with empty object for that param? |
This sounds like it would solve it, although I think it is still a regression. I think that if you
seems step 4 will succeed on v5.79.0 (it will just not send anything for the value of ServerlessV2ScalingConfiguration), but in v5.80.0 it will fail (sending an invalid value with maximum capacity of 0) I'll try to actually test that. |
I think that #40230 has a bug. I think the new scaling to 0 capability only means that that the minimum MinCapacity value is 0, but the minimum MaxCapacity value is still 1.0. Unfortunately the AWS docs are not clear on this matter, but the The removal of the check for |
error InvalidParameterValue: Serverless v2 maximum capacity 0.0 isn't valid. The maximum capacity must be at least 1.0.
on a non-serverless databaseerror InvalidParameterValue: Serverless v2 maximum capacity 0.0 isn't valid. The maximum capacity must be at least 1.0.
when capacity is not specified
I've updated the title/description to reflect that the issue isn't really that the database is non-serverless (a cluster can have a Kind of tricky because it seems like you maybe can't actually remove the setting on aws. The docs say if you don't set it, you can't add any serverless instances.
But they don't say anything about removing the setting. Therefore tf provider should probably just choose to not send any values, that seems like the only thing it can do. Sending 0.0 as started happening in v5.80.0 will just cause errors. (The user can manually add valid values but it still's breaking a tf config that worked on previous version) I think just restoring the restriction on MaxCapacity to be at least 0.5 would work. Allow 0 MinCapacity but not 0 MaxCapacity to match AWS. (It seems like for MaxCapacity the actual valid minimum value is 1.0 not 0.5, but that's a pre-existing bug and less of an issue because that only affects someone who explicitly sets 0.5, as opposed to this issue). |
I asked AWS support about this issue and this is what they said:
|
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
This functionality has been released in v5.81.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
There is another issue popping up in 5.81 now:
|
When you use code that is mentioned in the first post of this issue or directly set the minimum capacity of the serverlessv2 config to 0.0 (also called "auto-pause"), then this is only allowed when you use specific engine versions of you database cluster. In your case you need to upgrade from 16.1 to 16.3. Please see the docs of AWS: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2-auto-pause.html |
@pioneer2k except that I don't even use Aurora Serverless. This instance used to be aurora serverless, but was later switched back to regular. It's a continuation of this bug - #32381 (I know that one is on AWS), but it's also something that was not happening pre 5.81. |
I just ran into the same error that @Fodoj mentioned. Our instance was serverless and later converted back to instance based. I am pinning the aws provider to |
Terraform Core Version
1.0.8
AWS Provider Version
5.80.0
Affected Resource(s)
Expected Behavior
The apply should succeed even if config for ServerlessV2ScalingConfiguration is not specified.
Actual Behavior
The apply failed with an error saying that a serverless maximum capacity 0.0 isn't valid. However, we did not specify a serverless capacity. It appears an empty/null value is being converted into 0.0.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
cannot provide
Steps to Reproduce
observed in our system, don't have exact repro steps
Debug Output
No response
Panic Output
No response
Important Factoids
The plan includes this change which I don't totally understand since as said before, our db is not serverless.
We saw the same change in the plan 1 week ago, but the apply was successful and only failed upon upgrade to v5.80.0
No response
References
#40230
potentially related to this recent PR since the failure started after upgrade to v5.80.0. Maybe the removal of the checks for 0 in that PR broke something or made it so you can't have null serverless settings?
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: