GCP的PULUMI GO SDK:无法销毁SQL Server
我正在使用pulumi go sdk:当我尝试销毁堆栈时,我在其中提供了新的SQL数据库,数据库,密码和用户时,我会收到此错误消息:
21:00:33 [2022-07-05T18:00:33.872Z] Diagnostics:
21:00:33 [2022-07-05T18:00:33.874Z] gcp:sql:User (gcp-test02-user:myuser):
21:00:33 [2022-07-05T18:00:33.875Z] error: deleting urn:pulumi:us-east4-gcp-test02::cluster::gcp:myuser/sql:Database$gcp:sql/user:User::gcp-test02-user:myuser: 1 error occurred:
21:00:33 [2022-07-05T18:00:33.876Z] * Error, failed to deleteuser myuser in instance gcp-test02-1b95d9a: googleapi: Error 400: Invalid request: failed to delete user myuser: . role "myuser" cannot be dropped because some objects depend on it Details: 640 objects in database mydatabases., invalid
21:00:33 [2022-07-05T18:00:33.877Z]
21:00:33 [2022-07-05T18:00:33.877Z] gcp:sql:Database (gcp-test02-db:mydatabases):
21:00:33 [2022-07-05T18:00:33.879Z] error: deleting urn:pulumi:us-east4-auto-mgmt-console-gcp-test02::cluster::gcp:myuser/sql:Database$gcp:sql/database:Database::gcp-test02-db:mydatabases: 1 error occurred:
21:00:33 [2022-07-05T18:00:33.880Z] * Error when reading or editing Database: googleapi: Error 400: Invalid request: failed to delete database "sentinellabs". Detail: pq: database "sentinellabs" is being accessed by other users. (Please use psql client to delete database that is not owned by "cloudsqlsuperuser")., invalid
21:00:33 [2022-07-05T18:00:33.881Z]
21:00:33 [2022-07-05T18:00:33.881Z] pulumi:pulumi:Stack (cluster-us-east4-auto-mgmt-console-gcp-test02):
21:00:33 [2022-07-05T18:00:33.882Z] error: update failed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
删除用户 (或
删除角色
)在角色仍然拥有任何东西或对其他对象有任何特权。在GCP控制台中,在您的云SQL实例中,您应该使用
drop拥有
(这不是显而易见的) 。 <因此,删除角色的命令的顺序应该是:
在中运行两个命令,每个数据库角色拥有任何东西或具有任何特权。
然后:
重新分配拥有的
更改该角色当前拥有的所有对象的所有权。Drop拥有的
然后仅撤销特权(所有权不解决)。再次尝试 pulumi Destroy 。
最后,您应该运行“ pulumi刷新”,然后CLI应该检测到它已被删除并将其从堆栈中取出。
Recommended:
DROP USER
(orDROP ROLE
) cannot proceed while the role still owns anything or has any granted privileges on other objects.In the GCP Console, in your Cloud SQL instance, you should get rid of all privileges with
DROP OWNED
(which isn't obvious). The manual:So the sequence of commands to drop a role should be:
Run both commands in every database of the same cluster where the role owns anything or has any privileges.
And then:
REASSIGN OWNED
changes ownership for all objects currently owned by the role.DROP OWNED
then only revokes privileges (ownerships out of the way).Try again
pulumi destroy
.Finally, you should run ‘pulumi refresh’, and then the CLI should detect that it was deleted and remove it from the stack.
Recommended:
看来可能在该SQL实例中添加了一个附加的数据库,该数据库正在访问和锁定。您可能必须登录到SQL实例并首先删除该数据库,然后运行
pulumi Refresh
和pulumi Destroy
。 400错误正在从Google返回。It looks like there might be an additional database added to that sql instance that is being accessed and locked. You might have to login to the sql instance and drop that db first, then run
pulumi refresh
, andpulumi destroy
. The 400 error is being returned from Google.