gpt4 book ai didi

google-cloud-platform - 如果资源不存在,谷歌部署管理器会创建资源吗?

转载 作者:行者123 更新时间:2023-12-04 13:17:51 25 4
gpt4 key购买 nike

有没有办法在资源不存在的情况下创建资源并在存在的情况下使用现有资源?

resources:
- name: "my-topic"
type: gcp-types/pubsub-v1:projects.topics
properties:
topic: "this-exists-already"
- name: "my-other-resource"
type: 'gcp-types/cloudfunctions-v1:projects.locations.functions'
properties:
functionName: "function"
environmentVariables:
# get a ref to new or already existing topic
my-toptic: "$(ref.my-topic.name)"

根据@kolban 的链接,我想我想在这里使用放弃。我能否有选择地“放弃”特定资源,以便我可以将 accessControl 策略附加到现有存储桶,但如果部署被删除则不删除该存储桶?

ABANDON - This removes any references to the resource from thedeployment but does not delete the underlying resource. For example,abandoning an instance means that it is removed from a deployment butthe instance still exists for you to use.

编辑

也许我应该使用“操作”来分配 acl 而不是资源?这是正确的方法吗?有这方面的例子吗?所以 DM 本质上只会执行一个 api 调用来应用带外 acl。这意味着如果部署被删除,它会留下 acl,但我同意这一点。

看起来我想做这样的事情,但我不想将 acl 应用于特定文件,而是想将其设置在存储桶上(通过操作)https://github.com/GoogleCloudPlatform/deploymentmanager-samples/blob/master/community/storage-bucket-acl/storagebucket-acl.jinja#L29 .

最佳答案

如果我们阅读 Deployment Manager 文档的这一部分:

https://cloud.google.com/deployment-manager/docs/deployments/updating-deployments#policies_for_adding_resources

我们读到了“创造或获取”的概念。我读这篇文章的方式是,如果你的配置说应该创建一个资源,那么默认情况下,如果它已经存在,它不会导致错误,并且会为这个部署“获取”,我认为它的意思是就像它已经被创建一样。

关于google-cloud-platform - 如果资源不存在,谷歌部署管理器会创建资源吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58384511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com