【发布时间】:2021-02-14 03:08:49
【问题描述】:
我正在使用 Pulumi 和 Python 创建一个 GCP 存储桶和聚合日志接收器。要创建接收器,我需要来自 Pulumi 的存储桶 id 的值。
bucket = storage.Bucket(resource_name=bucket_name,
location="us-central1",
storage_class="REGIONAL",
uniform_bucket_level_access=True)
# destination value is needed to create the logging sink.
destination = Output.all(bucket.id).apply(lambda l: f"storage.googleapis.com/{l[0]}")
print(destination)
我希望得到类似于"storage.googleapis.com/bucket_id" 的目标变量的打印输出。相反,我得到
<pulumi.output.Output object at 0x10c39ae80>。我也尝试过使用 Pulumi docs 中描述的 Pulumi concat 方法。
destination = Output.concat("storage.googleapis.com/", bucket.id)
print(destination)
这将返回相同的 <pulumi.output.Output object at 0x10c39ae80> 而不是预期的字符串。
任何建议将不胜感激。
【问题讨论】:
标签: python google-cloud-platform pulumi