So as in title - if you have created database using mssql_database resource on RDS SQL Server instance with MultiAZ setup terraform will fail to terminate/delete database.
Getting this error below:
module.database.mssql_database.rds_db["test"]: Destroying... [id=8]
╷
│ Error: Could not execute SQL
│
│ mssql: The database 'test' is currently joined to an availability
│ group. Before you can drop the database, you need to remove it from the
│ availability group.
╵
So as in title - if you have created database using mssql_database resource on RDS SQL Server instance with MultiAZ setup terraform will fail to terminate/delete database.
Getting this error below:
To fix this mssql_database needs to run:
EXECUTE msdb.dbo.rds_drop_database N'your-database-name'
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.SQLServer.CommonDBATasks.DropMirrorDB.html