kind-angle-62935
08/05/2022, 7:52 AMInvalid --compare-to Infracost JSON, found duplicate project name ...
. What exactly does this mean?little-author-61621
kind-angle-62935
08/05/2022, 8:25 AMlittle-author-61621
kind-angle-62935
08/05/2022, 11:17 AMdiff
checking this? Should breakdown
fail in this case?little-author-61621
prev_infracost
JSON file have the same name
key. The diff is checking this because it assumes unique project names otherwise it doesn’t know which one to diff against. Are you setting project names in the config file when you create it?kind-angle-62935
08/05/2022, 11:20 AMlittle-author-61621
dirspaces
have the same path and workspace?kind-angle-62935
08/05/2022, 11:21 AMlittle-author-61621
…
here found duplicate project name ...
is the one it’s finding twice.kind-angle-62935
08/05/2022, 11:24 AMlittle-author-61621
<path> (Workspace: <workspace>)
kind-angle-62935
08/05/2022, 11:26 AMdefault
?little-author-61621
kind-angle-62935
08/05/2022, 11:26 AMlittle-author-61621
name
key for each project in the config file if you want as well.kind-angle-62935
08/05/2022, 12:34 PMprojects:
- path: foo
terraform_workspace: default
- path: foo/bar
terraform_workspace: default
little-author-61621
foo
is a Terraform mono repo then it will create a new project for each project underneath it, and so there might be two created for foo/bar
kind-angle-62935
08/05/2022, 12:37 PMlittle-author-61621
exclude_paths
(https://www.infracost.io/docs/features/config_file/#usage) - does that help?kind-angle-62935
08/05/2022, 12:44 PMprojects:
- path: foo
terraform_workspace: default
exclude_paths: ['foo/*/*']
- path: foo/bar
terraform_workspace: default
exclude_paths: ['foo/bar/*/*']
little-author-61621
kind-angle-62935
08/05/2022, 12:47 PMlittle-author-61621
kind-angle-62935
08/05/2022, 12:48 PMexclude_paths
diff
work fine? Or does it depend on the summary
information in a breakdown
to be correct?little-author-61621
name
manually in the config file.kind-angle-62935
08/05/2022, 1:49 PMbreakdown
is producing duplicate entries in the output, but does that mean the summary contains the duplicate values?little-author-61621
.tf
files directly in both /foo
and /foo/bar
? And are there directories under /foo
you aren’t wanting to generate Infracost results for?kind-angle-62935
08/05/2022, 2:59 PMlittle-author-61621
exclude_paths:
- ./*
This seems to work for me. The exclude_paths is relative to the path parameter.kind-angle-62935
08/05/2022, 3:07 PMexclude_paths
did not work either.
projects:
- exclude_paths:
- ./*
path: non-prod
terraform_workspace: default
- exclude_paths:
- ./*
path: non-prod/us-east-1
terraform_workspace: default
- exclude_paths:
- ./*
path: non-prod/us-east-1/qa
terraform_workspace: default
- exclude_paths:
- ./*
path: non-prod/us-east-1/qa/mysql
terraform_workspace: default
- exclude_paths:
- ./*
path: non-prod/us-east-1/qa/webserver-cluster
terraform_workspace: default
- exclude_paths:
- ./*
path: non-prod/us-east-1/stage
terraform_workspace: default
- exclude_paths:
- ./*
path: non-prod/us-east-1/stage/mysql
terraform_workspace: default
- exclude_paths:
- ./*
path: non-prod/us-east-1/stage/webserver-cluster
terraform_workspace: default
version: '0.1'
little-author-61621
tree
on this directory.
2. What is the output of running infracost breakdown --config-file=infracost.yml --format=json | jq -r '.projects[].name'
3. What is the output of INFRACOST_PARALLELISM=1 infracost breakdown --config-file=infracost.yml --format=json --log-level=debug 2>&1 | grep 'walking path\|skipping directory'
?
4. If you run with just the first project, i.e.:
projects:
- exclude_paths:
- ./*
path: non-prod
terraform_workspace: default
What is the output of the above commands from 2 & 3?
Random idea that might work for just now. Is there any way of flattening the directories yourself before running Infracost? i.e. having non-prod
, non-prod-us-east-1
, non-prod-us-east-1-qa
. I know this isn’t ideal, just an idea for a workaround.kind-angle-62935
08/07/2022, 5:57 AM