How to retrieve the null_resource returned value?

I realize I’m late to this topic, but I just wanted to note that because the command you are running seems to be a read-only command gathering data another option is to use the external data source to run a wrapper script to gather the data and return it in JSON format, which can then avoid creating temporary files on disk and reading them back in.

Provisioners are intended for operations whose value comes from their side-effects, like starting up services or similar. While we can use them to read data by exploiting the side-effect of creating a temporary file on disk, the external data source more directly represents the intent to gather some data without side-effects.

With that said, if what you did with the local_file data source is meeting your needs then that’s fine! I’m just sharing the above in case it’s useful to you or to others.

4 Likes