我正在尝试传递一个参数,该参数已由用户在创建云信息模板的堆栈时收到,例如下面
Parameters:
EnvironmentName:
Type: String
Description: The name of the environment
AllowedPattern: "[a-z0-9-]+"
我想将该参数传递给 jenkins(它是作为此堆栈的一部分创建的),以用作全局变量,可能使用 Global Variable String Parameter Plugin .
有没有办法纯粹使用 cloudformation 来做到这一点?有人告诉我,我可能需要 Ansible 或 Terraform 之类的东西,但如果可能的话,我更愿意仅使用 cloudformation。
最佳答案
如果你想在另一个CF脚本中使用它,有一个export将导出变量的输出部分的选项。
Outputs:
EnvironmentName:
Type: String
Description: The name of the environment
Export: !Sub EnvironmentName
Value: EnvironmentName
然后您可以使用 list-stack-resources 从 Jenkings 或 sh 脚本进行询问功能。
关于jenkins - 将参数从 cloudformation 作为变量传递到 jenkins 实例中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44885837/