Hi infracost wizards , Is there a way to disable t...
# general
b
Hi infracost wizards , Is there a way to disable the automatic creation of .infracost folder by infracost VScode pluggin everytime a new workspace ops a tf directory?
w
Hey @best-action-5428! that folder is used to cache the downloaded modules otherwise they’ll have to be downloaded each time you save a file and Infracost needs to run… Add it to your .gitignore so you can ignore it
b
b
Thanks Ali and Vadim . I guessed it had to do with some cache function and thanks for the gitignore tip, but the thing is, I have tf directories with providers that aren't supported at all by infracost like OCI . So It doesn't make sense still generate that folder. is there a way to specifically tell the pluggin to ignore a workspace or folder? just looking to find an elegant solution.
b
I think config file is what you're looking for: you can ignore certain projects/folders and estimate the rest: https://www.infracost.io/docs/features/config_file/
(and either commit the config file or add it to the gitignore too) 🙂
b
does this apply to the Vscode plugin ? because I'm not navigating through the terminal so far in that directory.
w
@best-action-5428 yep, the vscode extension uses the infracost.yml or infracost.yml.tmpl at the root of your vscode workspace
b
right and this is located inside the .infracost folder ? because as soon as I add a folder to the workspace the tf folder is added .
w
oh no, the infracost.yml file needs to be added to the workspace root (or repo root if you open that folder in VSCode) so you can define your projects: https://github.com/infracost/vscode-infracost/#4-create-a-infracost-config-file
b
root of the directory where the workspace was created ? could it work independently from any workspace ? if so can the below work ? I have a direcory with many subfolder with oci tf projects : /
Copy code
version: 0.1
exclude_paths:
  - C:\DATA\Cloud\oci
#  - "test-*"
w
@best-action-5428 root of the workspace being opened in VSCode, take a look at the “Only matching certain project” example in https://www.infracost.io/docs/features/config_file/#examples as you can specify the paths that should be matched
b
thanks Ali , we'll check it out . I just don't get if what you mean by workspace root location (is it for each workspace or 1 single location for all )
w
Sorry I should have clarified @best-action-5428! When you open a workspace in vscode, whatever folder is the root folder needs to have the infracost.yml config file. It might be easier to do screenshare, DM me if you want 🙂
b
hehe , I thought the root was a single location in the computer that manages the whole VSCode settings for ifracost . I will just delete the whole infra folder I think since I usually have one config per workspace (I was hopping I could do black list a root path at a VSCODE level). Thank you Ali