Skip to content

Commit

Permalink
terraform_plan/direct_references: Only account the created resources
Browse files Browse the repository at this point in the history
  • Loading branch information
refeed authored and arunim2405 committed Nov 8, 2023
1 parent 86eb203 commit 5fd2162
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tirith/providers/terraform_plan/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ def direct_references_operator_referenced_by(input_data: dict, provider_inputs:

# Loop for adding reference_target
for resource_change in resource_changes:
if resource_change.get("type") != resource_type and resource_change.get("change", {}).get("actions") != [
"delete"
if resource_change.get("type") != resource_type or resource_change.get("change", {}).get("actions") != [
"create"
]:
continue
reference_target_addresses.add(resource_change.get("address"))
Expand Down Expand Up @@ -288,7 +288,9 @@ def direct_references_operator_references_to(input_data: dict, provider_inputs:
is_resource_found = False

for resource_change in resource_changes:
if resource_change.get("type") != resource_type:
if resource_change.get("type") != resource_type or resource_change.get("change", {}).get("actions") != [
"create"
]:
continue
is_resource_found = True
resource_type_count += 1
Expand Down

0 comments on commit 5fd2162

Please sign in to comment.