Skip to content

Commit

Permalink
fixup! terracost: add EstimateHCL function
Browse files Browse the repository at this point in the history
  • Loading branch information
Patryk Kalinowski committed May 27, 2021
1 parent 68f1733 commit 24f522f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions estimation.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func EstimateTerraformPlan(ctx context.Context, backend Backend, plan io.Reader,
return cost.NewPlan(prior, planned), nil
}

// EstimateHCL is a helper function that recursively reads Terraform modules from a directory at the
// given path and generates a planned cost.State that is returned wrapped in a cost.Plan.
// It uses the Backend to retrieve the pricing data.
func EstimateHCL(ctx context.Context, backend Backend, fs afero.Fs, path string, providerInitializers ...terraform.ProviderInitializer) (*cost.Plan, error) {
if len(providerInitializers) == 0 {
providerInitializers = []terraform.ProviderInitializer{
Expand Down

0 comments on commit 24f522f

Please sign in to comment.