hi, its not supposed to catch changes in arbitrary things, it is tracking changes at “terraform resource” level.
in your case the “null_resource” named “ansible-deploy”.
terraform can be made to “re-run” the “null_resource” by adding a “trigger” section.
you can configure a trigger using the checksum (say “sha256sum” of the file “playbook.yaml”)
So, anytime the file “playbook.yaml” changes, and you run “terraform apply”, the trigger will “detect” a change, and the “null_resource” will be re-created (execute scripts in your case)
What comes to mind is a function like stat which could indicate the last modified time of the directory. As far I could search, there isn’t such a function, though some quick googling revealed:
… which in turn links to:
Not sure, but if you could verify the checksums of all the files inside a directory, I think it would achieve the same result.
Maybe you could file a feature request with the Terraform core for a “stat” equivalent function?!?
Silly me, just realized something as I finished clicking “Reply”. Could you not write a simple shell script which returns the stat output of the directory in question?