This message was deleted.
# help
b
This message was deleted.
l
Hi @early-article-57185, does adding the
terraform/
prefix to the path help? Something like this:
Copy code
version: 0.1
projects:
{{- range $project := matchPaths "terraform/my_org-:service/environments/:env" }}
  - path : terraform/my_org-{{ $project.service }}/manifests
    name : my_org-{{ $project.service }}/{{$project.env}}
    terraform_var_files:
      - ../environments/{{$project.env}}/environment.tfvars
{{- end }}
e
No, after adding terraform/ prefix getting same
Copy code
version: 0.1
projects:
{{- range $project := matchPaths "my_org-:service }}
  - path : ./my_org-{{ $project.service }}/manifests
{{- end }}
for this template file I'm getting infracost.yml like below
Copy code
version: 0.1
projects:
  - path : ./my_org-location-service/manifests
  - path : ./my_org-location-service/manifests
  - path : ./my_org-location-service\environments\dev/manifests
  - path : ./my_org-location-service\environments\dev\environment.tfvars/manifests
  - path : ./my_org-location-service\environments\qa/manifests
  - path : ./my_org-location-service\environments\qa\environment.tfvars/manifests
  - path : ./my_org-location-service\manifests/manifests
  - path : ./my_org-location-service\manifests\datafactory.tf/manifests
  - path : ./my_org-location-service\manifests\functionapp.tf/manifests
  - path : ./my_org-location-service\manifests\locals.tf/manifests
  - path : ./my_org-location-service\manifests\variables.tf/manifests
  - path : ./my_org-location-service\manifests\versions.tf/manifests
l
- path : ./my_org-{{ $project.service }}/manifests
->
- path : terraform/my_org-{{ $project.service }}/manifests
e
Copy code
version: 0.1
projects:
{{- range $project := matchPaths "terraform/my_org-:service/environments/:env" }}
  - path : terraform/my_org-{{ $project.service }}/manifests
    name : my_org-{{ $project.service }}/{{$project.env}}
    terraform_var_files:
      - ../environments/{{$project.env}}/environment.tfvars
{{- end }}
version: 0.1 projects: In matchPaths if i add anything after / (forward slash) It Is giving result as version: 0.1 projects:
l
@early-article-57185 are you running this on a Windows machine?
And can you paste the exact command you are running?
e
I'm running this in VS Code git bash infracost generate config --repo-path=. --template-path=infracost.yml.tmpl --out-file=infracost.yml
l
@early-article-57185 Does using blackslashes help:
Copy code
version: 0.1
projects:
{{- range $project := matchPaths "my_org-:service\environments\:env" }}
  - path : .\my_org-{{ $project.service }}\manifests
    name : my_org-{{ $project.service }}\{{$project.env}}
    terraform_var_files:
      - ..\environments\{{$project.env}}\environment.tfvars
{{- end }}
e
getting error $ infracost generate config --repo-path=. --template-path=infracost.yml.tmpl --out-file=infracost.yml 2024-01-05T191522+05:30 INF Enabled policies V2 2024-01-05T191522+05:30 INF Enabled tag policies Error: could not parse template path: infracost.yml.tmpl err: template: infracost.yml.tmpl3 invalid syntax
l
Out of interest does something like this work:
Copy code
version: 0.1
projects:
{{- range $project := matchPaths "my_org-:service\\environments\\:env" }}
  - path : my_org-{{ $project.service }}\manifests
{{- end }}
I’m not running on a Windows machine just now so can’t test it, but if this doesn’t work then we can dig in more.
e
It is giving same result version: 0.1 projects:
l
Okay thanks, let me take this to the team and see if we can test it out on a Windows machine. In the meantime you should be able to work around it by creating a static config file like so:
Copy code
version: 0.1
projects:
  - name: my_org-location-service/dev
    path: my_org-location-service\manifests
    terraform_var_files:
      - ..\environments\dev\environment.tfvars
  - name: my_org-location-service/qa
    path: my_org-location-service\manifests
    terraform_var_files:
      - ..\environments\qa\environment.tfvars
  ...
e
okay, Thank you @little-author-61621