Skip to content

Commit

Permalink
Fix RDB instance count issue
Browse files Browse the repository at this point in the history
  • Loading branch information
AkashS0510 committed Feb 25, 2025
1 parent 75e930f commit d3d38ca
Show file tree
Hide file tree
Showing 3 changed files with 647 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/tirith/providers/terraform_plan/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@ def provide(provider_inputs, input_data):
resource_type = provider_inputs["terraform_resource_type"]
for resource_change in resource_changes:
if resource_type in (resource_change["type"], "*"):
# No need to check if the resource is not found
# because the count of a resource can be zero
resource_meta = resource_change
count += 1

# Check if the resource has an "index" key
if "index" in resource_change:
count += 1 # Add 1 for each indexed instance
else:
count += 1 # Standard single instance counting

Check warning on line 156 in src/tirith/providers/terraform_plan/handler.py

View check run for this annotation

Codecov / codecov/patch

src/tirith/providers/terraform_plan/handler.py#L156

Added line #L156 was not covered by tests

outputs.append(
{
Expand Down
Loading

0 comments on commit d3d38ca

Please sign in to comment.