Skip to content

Infracost doesn't know about explicit tfvars #1104

@mooseracerPT

Description

@mooseracerPT

Describe the bug

Infracost reports are missing variable values from the terraform projects.

Steps to reproduce

File structure:

my_root_module\main.tf
my_root_module\vars\some_environment.tfvars

Our Terrateam config specifies the tfvars for the dirspace like "extra_args": ["-var-file=vars/${TERRATEAM_WORKSPACE}.tfvars"] and this works well for plans/applies.

Expected behavior

I expected that the Infracost code would use --terraform-var-file or --terraform-var if they were present in the workflow config's extra_args.

Actual behavior

Infracost logs like this:

INFO Found Terraform project "my_root_module-some_environment" at directory "my_root_module"
...
WARN Input values were not provided for following Terraform variables: "variable.some_var", "variable.some_other_var". Use --terraform-var-file or --terraform-var to specify them.

And that leads to it assuming 0 quantity on resources like container counts.

Terrateam version & environment details

Cloud-hosted terrateam; terraform 1.14.3. Big dynamic config_builder script.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions