#I asked it here https://discord.com/
1 messages · Page 1 of 1 (latest)
Hey @worldly geyser 👋 I'm surprised the screenshot you posted doesn't have working caching. Can you tell me about what the output looks like and how it's being run?
hey @queen rampart thank you for jumping into the thread. I guess I could achieve constant caching with a few changes.
First thing first I saw @flint aspen 's example here and actually It helped a lot. I totally separated my Terraform Cache Dir to outside of my src code repository
#terraform message
https://gist.github.com/padraic-padraic/8ec330151be45ff49842de2c882e0a08
mountedDockerImage := dockerImage.
WithMountedDirectory("/src", src).
WithMountedDirectory("/root/.aws", awscreds).
WithEnvVariable("TF_CACHE_DIR", "/terraform-cache-dir").
WithEnvVariable("TF_PLUGIN_CACHE_DIR", "/terraform-cache-dir").
WithMountedCache("/terraform-cache-dir", client.CacheVolume("terraform-cache"))
I excluded all possible files that might change from folders
dagger.HostDirectoryOpts{Exclude: []string{"**/.git/*", "**/.terraform/*", "**/.DS_Store", "**/*.terraform.lock.hcl", "**/*.cicd"}})
I only mounted cache for providers folder and not included any parent one
WithMountedCache("/src/vpc/.terraform/providers", client.CacheVolume("terraform-providers-vpc")).
Currently, my only concern is what is the disk size of this Buildkit cache? When I download all the providers for each of my terraform stages, my file size goes up to 5GB and if I also separate each environment's cache id, I feel I can easily hit some limits if they exist.
How can I be sure I have the maximum possible cache ttl?