-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: wildcard support for modules in usage file #2286
Conversation
@aliscott I'm not sure what we're thinking of doing with the |
ee09cf0
to
fcde5fe
Compare
fcde5fe
to
15febbb
Compare
15febbb
to
c37f8a8
Compare
This PR adds support for wildcard references in the Infracost usage file. Users can now specify usage file references such as `module.mod[*].aws_lambda_function.test[*]`. This functionality is enabled by the introduction of `schema.UsageMap` into the application. This builds a regexp from the usage file name (escaping all regular expression metacharacters apart from *) if a direct match is not made. This means we can support many layers of wildcard references, e.g: `module.mod[*].module.another[*].aws_lambda_function.test[*]`.
4d651e4
to
2304330
Compare
@@ -8,7 +8,7 @@ Project: infracost/infracost/cmd/infracost/testdata/breakdown_terraform_sync_usa | |||
└─ Insights queries data scanned Monthly cost depends on usage: $0.005 per GB | |||
|
|||
aws_cloudwatch_log_group.production_logs["media"] | |||
├─ Data ingested Monthly cost depends on usage: $0.50 per GB | |||
├─ Data ingested 1,000 GB $500.00 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like this was a bug before that was fixed by this PR, the resource defaults are as follows:
resource_type_default_usage:
aws_cloudwatch_log_group:
monthly_data_ingested_gb: 1000.0
2304330
to
aee1996
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice tests!
This PR adds support for wildcard references in the Infracost usage file.
Users can now specify usage file references such as
module.mod[*].aws_lambda_function.test[*]
.This functionality is enabled by the introduction of
schema.UsageMap
into the application. This builds a regexp from the usage file name (escaping all regular expression metacharacters apart from *) if a direct match is not made. This means we can support many layers of wildcard references, e.g:module.mod[*].module.another[*].aws_lambda_function.test[*]
.