cuddly-dentist-1090
07/10/2024, 2:15 PMdev/
<http://moduleA.tf|moduleA.tf>
<http://moduleB.tf|moduleB.tf>
prod/
<http://moduleA.tf|moduleA.tf>
<http://moduleC.tf|moduleC.tf>
Is there an easy way to make the config file treat each individual module as a project, so we can get cost estimates per module? So the projects would be like dev-moduleA
, dev-moduleB
etc? Or is there another/better way to get a cost breakdown per module inside of a project?busy-agent-35515
07/10/2024, 2:17 PMcuddly-dentist-1090
07/10/2024, 3:02 PMversion: 0.1
projects:
{{- range $project := matchPaths ":env/:<http://module.tf|module.tf>" }}
- path: .
name: {{ $project.module }}-{{ $project.env }}
{{- end }}
Resulting in
Infracost generate config failed.
/usr/local/bin/infracost command was closed with a non 0 exit code: Error: could not parse template: "version: 0.1\n\nprojects:\n{{- range $project := matchPaths env/module.tf }}\n - path: .\n name: {{ $project.module }}-{{ $project.env }}\n{{- end }}" err: template: infracost.yml.tmpl4 expected :=
busy-agent-35515
07/10/2024, 7:19 PMversion: 0.1
projects:
{{- range $project := matchPaths ":env/:file" }}
- path: {{ $project._path }}
name: {{ $project.env }}-{{ stem $project.file }}
{{- end }}
busy-agent-35515
07/10/2024, 7:21 PMversion: 0.1
projects:
- path: dev/moduleA.tf
name: dev-moduleA
- path: dev/moduleB.tf
name: dev-moduleB
- path: prod/moduleA.tf
name: prod-moduleA
- path: prod/moduleC.tf
name: prod-moduleC
cuddly-dentist-1090
07/10/2024, 7:30 PMbusy-agent-35515
07/10/2024, 7:30 PM--path
requires a directory.busy-agent-35515
07/10/2024, 7:31 PMbusy-agent-35515
07/10/2024, 7:31 PMcuddly-dentist-1090
07/10/2024, 7:32 PMbusy-agent-35515
07/10/2024, 7:32 PMdev/
but keep only one file in each projectbusy-agent-35515
07/10/2024, 8:06 PMcuddly-dentist-1090
07/10/2024, 8:07 PMbusy-agent-35515
07/11/2024, 9:17 AM