diff --git a/src/tirith/providers/terraform_plan/handler.py b/src/tirith/providers/terraform_plan/handler.py index 81f2c57..af8276d 100644 --- a/src/tirith/providers/terraform_plan/handler.py +++ b/src/tirith/providers/terraform_plan/handler.py @@ -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")) @@ -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