gpt4 book ai didi

bash - 如何将 terragrunt apply 的输出变量保存为常规 shell 环境变量?

转载 作者:行者123 更新时间:2023-12-04 08:26:11 27 4
gpt4 key购买 nike

运行我的 terragrunt apply-all 后在我的 CI 步骤(所以基本上是一个 bash 脚本)我得到了我的输出,在这种情况下我只有一个:

output "cloudrun-hostname" {
value = google_cloud_run_service.cloudrun.status[0].url
description = "API endpoint URL"
}
我如何将该输出的值传递给环境变量,所以基本上就像我导出了一个这样的变量:
export HOSTNAME=terragrunt-cloudrun-hostname-output
我需要这个具有该值的变量,以便稍后可以在另一个文件中 envsub 值。

最佳答案

您可以使用 the terraform output 命令,即

export MY_ENV=$(terraform output cloudrun-hostname)
在您的 apply-all 之后.

关于bash - 如何将 terragrunt apply 的输出变量保存为常规 shell 环境变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65250192/

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