简体   繁体   English

Fn如果在cf模板中并执行命令

[英]Fn If in cf template and executing a command

I would greatly appreciate your help on this. 非常感谢您的帮助。 I am trying inside a AWS CF template to run a command when the env=QA 当env = QA时,我正在尝试在AWS CF模板中运行命令

This is what I'm trying to achieve but there is no way 这是我要实现的目标,但是没有办法

"Conditions" : {
  "CreateQaResources" : {"Fn::Equals" : [{"Ref" : "Env"}, "AwsQaUs"]}
},

and then 接着

"Fn::If": [
  "CreateQaResources",
  {
    "echo  \"10.0.0.0     DOMAIN.COMPANY.com  \" >>/etc/hosts \n",

  },
  {
    "Ref" : "Env::AwsQaUs"
  }  
]

Can you please tell me where is my mistake? 你能告诉我我的错误在哪里吗?

Thank you 谢谢

Everything seems to be okay, but it would be nice to see more of your template to make sure it looks right. 一切似乎都还不错,但是很高兴看到更多模板来确保它看起来正确。 Are you getting some sort of error or is the end result just not what you're hoping? 您是否遇到某种错误,或者最终结果不是您所希望的? I realize this isn't an answer. 我知道这不是答案。 Apparently I don't have permission to add comments, yet. 显然我还没有添加评论的权限。 Sorry! 抱歉!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在cf模板中设置出口时使用fn :: att或fn :: select或任何其他内置函数获取当前VPC CIDR - How to get current VPC CIDR using fn::att or fn::select or anyother builtin functions while setting egress in cf template Cloudformation 模板中的组合 Fn::Join 和 Fn::Select - Combination Fn::Join and Fn::Select in Cloudformation template Cloudformation 模板中的组合 Fn::Select + Fn::Split + Fn:GetAtt - Combination Fn::Select + Fn::Split + Fn:GetAtt in Cloudformation template 使用 CF 模板更新 AWS 堆栈 - Update AWS stack with CF template 创建 sparkUI 历史服务器的 CF 模板失败 - CF template to create sparkUI history server is failing 为CloudHSM启动CF模板时出错 - Error while launching CF Template for CloudHSM CF模板未启用RDS StorageEncrypted - RDS StorageEncrypted not getting Enabled with CF template 执行命令时出错:sam build --use-container --template ${SAM_TEMPLATE}。 原因:退出状态1 - Error while executing command: sam build --use-container --template ${SAM_TEMPLATE}. Reason: exit status 1 具有参考或顶级Fn :: FindInMap的CloudFormation模板 - CloudFormation Template with Reference or TopLevel Fn::FindInMap 模板错误:不能在条件中使用 Fn::GetAZs - Template error: Cannot use Fn::GetAZs in Conditions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM