简体   繁体   中英

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM