terraform-aws-rds-cluster icon indicating copy to clipboard operation
terraform-aws-rds-cluster copied to clipboard

Aurora Serverless "BackupWindow" parameter not working

Open sebastianmacarescu opened this issue 5 years ago • 6 comments

Describe the Bug

It seems like AWS does not support (or maybe is bugged) "preferred_maintenance_window " and "preferred_backup_window" Existing AWS issue: https://github.com/aws-cloudformation/aws-cloudformation-coverage-roadmap/issues/396 This was also reported internally in AWS team

Expected Behavior

Everything should work as expected

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Run '....'
  3. Enter '....'
  4. See error

Screenshots

Create a serverless database from a snapshot. Right after it's finished terraform will throw: Error: error modifying RDS Cluster (tc-staging-shared-main-rds): InvalidParameterCombination: You currently can't modify BackupWindow with Aurora Serverless. status code: 400, request id: aa5042ba-f0be-49ea-a695-e68da91a01f8

If you run terraform again it will say the cluster is tainted and must be replaced. Moreover a lot of values are just wrong. The created resource has totally different values than specified in terraform code:

  • backup_retention_period (1 day instead of configured 7)
  • preferred_backup_window
  • preferred_maintenance_window
  • master_username (the module passes a default but the instance was created from a snapshot)

image image

Environment (please complete the following information):

  • OS: Windows 10

Additional Context

I think you could have a dedicated resource for serverless clusters with the above fields omitted

sebastianmacarescu avatar Sep 21 '20 18:09 sebastianmacarescu

@sebastianmacarescu thanks for reporting this. Will it work if you just set all those parameters to null?

aknysh avatar Sep 23 '20 02:09 aknysh

Tried to set it to null but I get validation error, preferred_maintenance_window must be of format ...

sebastianmacarescu avatar Sep 26 '20 11:09 sebastianmacarescu

+1

joshuabalduff avatar Dec 23 '21 18:12 joshuabalduff

From this commit e82b41f

@joshmello @sebastianmacarescu does it work if you tried setting the following to null ?

  maintenance_window = null
  backup_window      = null
  retention_period   = null

nitrocode avatar Dec 28 '21 23:12 nitrocode

@nitrocode when I tested last year no, it did not work setting to null. Got validation error, preferred_maintenance_window must be of format ...

sebastianmacarescu avatar Jan 10 '22 19:01 sebastianmacarescu

It seems like an aws api issue. A serverless aurora does have these parameters and these can be modified in the browser but not from the aws api. The workaround from the issue you linked above is to comment out the preferred parameters and we do that in terraform by setting them to null which seems to error out because of a presumably API bug... not much we can do here since a dynamic only works on blocks and not root level arguments.

You can see from the below code we're passing in the input vars unaltered to the corresponding resource.

https://github.com/cloudposse/terraform-aws-rds-cluster/blob/28e76def91186eef0baae3cdbea09905a10215f9/main.tf#L61

https://github.com/cloudposse/terraform-aws-rds-cluster/blob/28e76def91186eef0baae3cdbea09905a10215f9/main.tf#L71

https://github.com/cloudposse/terraform-aws-rds-cluster/blob/28e76def91186eef0baae3cdbea09905a10215f9/main.tf#L143

https://github.com/cloudposse/terraform-aws-rds-cluster/blob/28e76def91186eef0baae3cdbea09905a10215f9/main.tf#L153

Looks like a user has documented that serverless engine mode has a few limitations which could be worked around by the aws provider.

https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/396#issuecomment-684002416

@joshmello @sebastianmacarescu you may have better luck creating another ticket with the aws provider. When you do, please include a minimal example using the raw resource aws_rds_cluster to reproduce the issue.

nitrocode avatar Feb 19 '22 14:02 nitrocode