如何强制pulumi删除一个

发布于 2025-02-02 11:19:51 字数 268 浏览 4 评论 0原文

我试图重命名aws.lambda.permission pulumi中的资源。 在Pulumi中,重命名资源似乎是不可能的。我不知道详细的原因,但这没关系。

因此,我希望Pulumi创建一个新的并删除现有的新产品。但是问题在于,AWS不允许我们使用相同的内容创建重复的权限资源。因此,Pulumi无法创建一个新的,因为新的pulig 具有不同的名称。

我认为我需要一些选项来使Pulumi在此之前删除现有的选项。 Pulumi提供什么吗?

I was trying to rename aws.lambda.Permission resource in Pulumi.
It seems that renaming resources is impossible in Pulumi. I don't know the detailed reason, but that's ok.

So, I expected Pulumi to create a new one and delete the existing one. But the problem is that AWS didn't allow us to create a duplicated Permission resource with the same content. Therefore, Pulumi failed to create a new one because the new one is just the exactly same Permission with a different name.

I think that I need some options to make Pulumi delete the existing one before creating at this point. Does Pulumi provide any?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱要勇敢去追 2025-02-09 11:19:51

我试图在pulumi中重命名aws.lambda。在Pulumi中,重命名资源似乎是不可能的。我不知道详细的原因,但是没关系。

这是云提供商API的限制。如果您想要具有新名称的资源,则必须创建一个全新的资源

所以,我希望Pulumi创建一个新的,并删除现有的

Pulumi在删除之前创建A,以减少Load Balancers后面的对象的停机时间。这是我们为什么建议使用自身的。请参阅在这里有关更多信息

我认为我需要一些选项来使pulumi在此时创建之前删除现有的选项。 Pulumi提供什么?

是的,使用 deletebebeforereplace

const loggingPermission = new aws.lambda.Permission("loggingPermission", {
    action: "lambda:InvokeFunction",
    "function": loggingFunction.name,
    principal: "logs.eu-west-1.amazonaws.com",
    sourceArn: pulumi.interpolate`${defaultLogGroup.arn}:*`,
}, { deleteBeforeReplace: true } );

I was trying to rename aws.lambda.Permission resource in Pulumi. It seems that renaming resources is impossible in Pulumi. I don't know the detailed reason, but that's ok.

This is a limitation of the cloud provider API. If you want a resource with a new name, you have to create a brand new resource

So, I expected Pulumi to create a new one and delete the existing one

Pulumi does a create before a delete by default to reduce downtime for objects behind loadbalancers. This us why we recommend using autonaming. See here for more information

I think that I need some options to make Pulumi delete the existing one before creating at this point. Does Pulumi provide any?

Yes, use deleteBeforeReplace

const loggingPermission = new aws.lambda.Permission("loggingPermission", {
    action: "lambda:InvokeFunction",
    "function": loggingFunction.name,
    principal: "logs.eu-west-1.amazonaws.com",
    sourceArn: pulumi.interpolate`${defaultLogGroup.arn}:*`,
}, { deleteBeforeReplace: true } );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文