Skip to content
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

mssql_database deletion fails when running on RDS instance with MultiAZ setup #127

Open
Krad-dono opened this issue Jun 12, 2023 · 0 comments

Comments

@Krad-dono
Copy link

Krad-dono commented Jun 12, 2023

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.
╵

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant