Channels
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    Hi everyone, does anyone know how infracost add var file ?
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    Hi, you should be able to pass a
    --terraform-var-file=myvars.tfvar
    flag to the
    infracost breakdown
    or
    infracost diff
    command. Does that work for you?
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    thank you, how about I have multiple file
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    You can repeat that flag, e.g.
    infracost breakdown --path=. --terraform-var-file=myvars1.tfvar --terraform-var-file=myvars2.tfvar
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    I used infracost.yml
    infracost breakdown --config-file infracost.yml
    is my file correctly ?
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    👍 looks like that should work
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    this is my project structure
    but it still does not recognize file
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    hmm, odd… are there any more details if you run with
    --log-level=debug
    ?
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    I saw it
    seem like it does not understand some git ssh module
    time="2022-06-07T18:57:34+07:00" level=warning parser=terraform_hcl msg="Failed to load module err: missing module with source 'registry.terraform.io/git@git.company.org:cost_be/terraform-core-modules/api-gateway.git?ref=1.0.2 git@git.company.org:cost_be/terraform-core-modules/api-gateway.git?ref=1.0.2' - try to 'terraform init' first" time="2022-06-07T18:57:34+07:00" level=warning parser=terraform_hcl msg="Failed to load module err: missing module with source 'registry.terraform.io/../cognito ../cognito' - try to 'terraform init' first"
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    Thanks, that looks similar to the issue that was just reported here: https://github.com/infracost/infracost/issues/1730. We’ll try and get a patch in for the next version sometime this week. In the meantime you can run Infracost with the
    --terraform-force-cli
    flag as a workaround which runs it in the old way by calling out to the Terraform/Terragrunt binary.
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    ah, my bad I searched but didn't find it
    thank you very much
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    No worries, I’ll reach back out to you when the issue is fixed. Let me know if you have any more issues.
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    I will 😄
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    I’ve got a potential fix in https://github.com/infracost/infracost/pull/1731, but another workaround for just now might just be changing the
    source
    attribute in your HCL module block to match whatever Terraform has written out as the source for that module in the
    .terraform/modules/modules.json
    file.
  • xuan duy dinh

    xuan duy dinh

    3 weeks ago
    thank you, with flag --terraform-force-cli, I got the estimation of my project 😄
    currently my format for module git is "git@git.company.org:cost_be/terraform-core-modules/api-gateway.git"
    when I tried to change to "git::<ssh😕/git@git.company.org:cost_be/terraform-core-modules/api-gateway.git"
    I got the error
    so I think it doesn't work for my case as well
  • Alistair (Infracost)

    Alistair (Infracost)

    3 weeks ago
    Interesting, what does your
    .terraform/modules/modules.json
    file show?
View count: 10