-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: show a 100% cost increase with prior empty projects
Resolves issue where projects that were previously "empty" (i.e. with no infrastructure configuration files) were showing an error and zero costs with `diff`. We now instead show a 100% cost increase in the project.
- Loading branch information
Showing
8 changed files
with
168 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"version": "0.2", | ||
"metadata": { | ||
"infracostCommand": "breakdown", | ||
"vcsBranch": "master", | ||
"vcsCommitSha": "71785af96bce822bd54f359d0883cfa4ca805432", | ||
"vcsCommitAuthorName": "Hugo", | ||
"vcsCommitAuthorEmail": "", | ||
"vcsCommitTimestamp": "2024-02-23T11:04:26Z", | ||
"vcsCommitMessage": "wip", | ||
"vcsRepositoryUrl": "https://github.com/infracost/infracost.git" | ||
}, | ||
"currency": "USD", | ||
"projects": [ | ||
{ | ||
"name": "infracost/infracost/cmd/infracost/testdata/diff_prior_empty_project", | ||
"metadata": { | ||
"path": ".", | ||
"type": "error", | ||
"vcsSubPath": "cmd/infracost/testdata/diff_prior_empty_project", | ||
"errors": [ | ||
{ | ||
"code": 106, | ||
"message": "could not detect path type for '.'\n\nTry adding a config-file to configure how Infracost should run. See \u001b[4;1mhttps://infracost.io/config-file\u001b[0m for details and examples.", | ||
"data": null, | ||
"isError": true | ||
} | ||
] | ||
}, | ||
"pastBreakdown": { | ||
"resources": [], | ||
"totalHourlyCost": "0", | ||
"totalMonthlyCost": "0" | ||
}, | ||
"breakdown": { | ||
"resources": [], | ||
"totalHourlyCost": "0", | ||
"totalMonthlyCost": "0" | ||
}, | ||
"diff": { | ||
"resources": [], | ||
"totalHourlyCost": "0", | ||
"totalMonthlyCost": "0" | ||
}, | ||
"summary": { | ||
"totalDetectedResources": 0, | ||
"totalSupportedResources": 0, | ||
"totalUnsupportedResources": 0, | ||
"totalUsageBasedResources": 0, | ||
"totalNoPriceResources": 0, | ||
"unsupportedResourceCounts": {}, | ||
"noPriceResourceCounts": {} | ||
} | ||
} | ||
], | ||
"totalHourlyCost": "0", | ||
"totalMonthlyCost": "0", | ||
"pastTotalHourlyCost": "0", | ||
"pastTotalMonthlyCost": "0", | ||
"diffTotalHourlyCost": "0", | ||
"diffTotalMonthlyCost": "0", | ||
"timeGenerated": "2024-02-23T12:58:15.71255Z", | ||
"summary": { | ||
"totalDetectedResources": 0, | ||
"totalSupportedResources": 0, | ||
"totalUnsupportedResources": 0, | ||
"totalUsageBasedResources": 0, | ||
"totalNoPriceResources": 0, | ||
"unsupportedResourceCounts": {}, | ||
"noPriceResourceCounts": {} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
cmd/infracost/testdata/diff_prior_empty_project/diff_prior_empty_project.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
────────────────────────────────── | ||
Project: infracost/infracost/cmd/infracost/testdata/diff_prior_empty_project | ||
|
||
+ aws_instance.web_app | ||
+$743 | ||
|
||
+ Instance usage (Linux/UNIX, on-demand, m5.4xlarge) | ||
+$561 | ||
|
||
+ root_block_device | ||
|
||
+ Storage (general purpose SSD, gp2) | ||
+$5 | ||
|
||
+ ebs_block_device[0] | ||
|
||
+ Storage (provisioned IOPS SSD, io1) | ||
+$125 | ||
|
||
+ Provisioned IOPS | ||
+$52 | ||
|
||
Monthly cost change for infracost/infracost/cmd/infracost/testdata/diff_prior_empty_project | ||
Amount: +$743 ($0.00 → $743) | ||
|
||
────────────────────────────────── | ||
Key: ~ changed, + added, - removed | ||
|
||
1 cloud resource was detected: | ||
∙ 1 was estimated, it includes usage-based costs, see https://infracost.io/usage-file | ||
|
||
Infracost estimate: Monthly cost will increase by $743 ↑ | ||
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ | ||
┃ Project ┃ Cost change ┃ New monthly cost ┃ | ||
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━┫ | ||
┃ infracost/infracost/cmd/infraco...tdata/diff_prior_empty_project ┃ +$743 ┃ $743 ┃ | ||
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━━┛ | ||
|
||
Err: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
provider "aws" { | ||
region = "us-east-1" # <<<<< Try changing this to eu-west-1 to compare the costs | ||
skip_credentials_validation = true | ||
skip_requesting_account_id = true | ||
access_key = "mock_access_key" | ||
secret_key = "mock_secret_key" | ||
} | ||
|
||
resource "aws_instance" "web_app" { | ||
ami = "ami-674cbc1e" | ||
instance_type = "m5.4xlarge" | ||
|
||
root_block_device { | ||
volume_size = 50 | ||
} | ||
|
||
ebs_block_device { | ||
device_name = "my_data" | ||
volume_type = "io1" | ||
volume_size = 1000 | ||
iops = 800 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters