Hi guys, I need some solution in terraform. I am creating an ec2 instance in ter . . .

Haider Ali:
Hi guys, I need some solution in terraform. I am creating an ec2 instance in terraform and I need to run remote-exec and local-exec both. but I want to execute local-exec only when I get a specific out from a command in remote-exec . So how can I do this condition based execution of local-exec.

Cai Walkowiak:
I’m not sure about passing results from provisioners. You might be able to write the result out, but I am also not sure how the Order of Operations may fail depending on an external resource.

Sorry I cannot be more help.

ag4ve:
I haven’t tried, but I /think/ remote-exec should only store output when it gets a 0 return code (so grep -q maybe?). If I’m right then you just put a count = (remote-exec.foo.output ? 1 : 0) in your local-exec

I’m not looking at the docs either so it’s probably not called output - and may need to be var == “” - I’m trying to convey an idea not code