I am trying to create EC2 instance with an optional value for IAMInstanceprofile. When createiam is False I am expecting ec2stack to create without iam, when its True it should wait for iamstack and use its value.
"Parameters": {
"createiam" : {
"Type" : "String",
"Default" : "False"
}
},
"Conditions" : {
"Create_iam" : {"Fn::Equals" : [{"Ref" : "createiam"}, "True"]}
},
"Resources" : {
"iamstack" : {
"Type" : "AWS::CloudFormation::Stack",
"Condition": "Create_iam"
},
"ec2stack": {
"Type" : "AWS::CloudFormation::Stack",
"DependsOn" : "iamstack"
}
}
While running stack with option False for crateiam getting an error saying iamstack resource not found. Is there a way to add a condition for Dependson value?