https://infracost.io logo
#general
Title
# general
l

little-author-61621

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.
w

worried-soccer-67640

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.
Copy code
/tmp/infracost breakdown --path=$SHOWFILE \
                                  --format=json \
                                  --log-level=info \
                                  --out-file=$INFRACOST_OUTPUT
l

little-author-61621

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

worried-soccer-67640

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

crooked-daybreak-55253

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

worried-soccer-67640

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.
terraform allows you to set the region from the AWS_DEFAULT_REGION env var. i think infracost should look into supporting it
c

crooked-daybreak-55253

09/12/2022, 1:23 PM
Ok yeah so same problem with the default region 😞.
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
m

mammoth-accountant-5963

09/16/2022, 2:42 AM
was this resolved ?
@crooked-daybreak-55253
c

crooked-daybreak-55253

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