- When each job starts: it will attempt to restore cache from the github cache
- After terraform runs it will download all the necessary providers into a cache directory
- Once it is done it will store the cache back into github cache — using the hash of the directory appended to the key
S3 caching
You can cache in AWS s3 rather than artefacts. This requires a bucket for caching and setting similar settings:Self-hosted runners and volumes caching
If you are using self-hosted runners with github it might be overkill on your bandwidth to load and restore from cache. In this case it might be better to mount a common volume for all the runners to read and write to. Digger provides an argument to control the location for the terraform (or terragrunt) provider cache directory:We are currently looking into cases where there might be conflicts between different runners
writing to the same cache directory. It seems that recent versions of opentofu and terraform have improved their cache handling to avoid this issue. But it is an area we hope to document better for digger in the near future.