Title
#general
Alistair (Infracost)

Alistair (Infracost)

09/12/2022, 11:05 AM
Hi Guy, is this after you generated plan JSONs? Looks like it’s the us-east-1 cost that’s showing so I wonder if for some reason the plan JSON isn’t showing the region.
g

Gurpal Singh

09/12/2022, 11:10 AM
this is via atlantis. my steps are: 1.
terragrunt plan -input=false -out=$PLANFILE
2.
terragrunt show -json $PLANFILE > $SHOWFILE
3.
/tmp/infracost breakdown --path=$SHOWFILE \
                                  --format=json \
                                  --log-level=info \
                                  --out-file=$INFRACOST_OUTPUT
Alistair (Infracost)

Alistair (Infracost)

09/12/2022, 11:12 AM
Are you able to retrieve the
$SHOWFILE
file and see what the JSON is for that resource?
g

Gurpal Singh

09/12/2022, 1:00 PM
sure i can do that
1:00 PM
we don't pass in the region to the provider block, or resource block
1:00 PM
will this mean it will always use us-east-1?
1:01 PM
or should generating diffs from plan files not rely on the provider block region being present?
1:04 PM
i have the json, is there a specific field i should be looking for?
1:18 PM
have just tested, by adding the region to the provider block. it now is reflecting prices correctly
Tim (Infracost)

Tim (Infracost)

09/12/2022, 1:19 PM
Is there a
configuration
block with
provider_config
? This is from one of our example repos:
{
  ...
  "configuration": {
    "provider_config": {
      "aws": {
        "name": "aws",
        "version_constraint": "3.50.0",
        "expressions": {
          ...
          "region": {
            "constant_value": "us-east-1"
          },
g

Gurpal Singh

09/12/2022, 1:20 PM
i have a provider_config block, but there is no region inside it, unless i add it to the terraform provider code.
1:20 PM
terraform allows you to set the region from the AWS_DEFAULT_REGION env var. i think infracost should look into supporting it
Tim (Infracost)

Tim (Infracost)

09/12/2022, 1:23 PM
Ok yeah so same problem with the default region 😞.
1:27 PM
In the spirit of temporary hacking, maybe we could use jq to add the region value to the plan.json before sending it to infracost
v

Vitale Mazo

09/16/2022, 2:42 AM
was this resolved ?
2:42 AM
@Tim (Infracost)
Tim (Infracost)

Tim (Infracost)

09/16/2022, 12:21 PM
Not resolved, there is an open GH issue.