Hi @doug-fish! I’ve moved this to a new topic because that other topic was pretty old and it’s nice to keep each topic focused on only one question.
With that said, in the comment you were referring to I was suggesting using external
instead of null_resource
, rather than using the two together. That advice only applies if you’re talking about only retrieving some data, and not also creating an important side-effect at the same time.
For example, if it’s important to your situation that you end up with a file on disk containing the information then external
wouldn’t be appropriate for that alone, though you could potentially get the same effect by using the external
data source first and then writing its result to disk using the local_file
resource.
I’d also note that Terraform is not really intended for managing local files on disk, as the warning in the documentation mentions. The hashicorp/local
provider exists as a pragmatic way to help solve some problems on the edges of Terraform’s scope, but I’d suggest exhausting all other possible solutions first and treating the creation of a temporary file as a last-resort solution. If you can say a little more about your underlying problem, rather than the way you’re currently trying to solve it, I might be able to suggest some alternative strategies.