diff --git a/src/tirith/providers/terraform_plan/handler.py b/src/tirith/providers/terraform_plan/handler.py index 39b5afd..4408e49 100644 --- a/src/tirith/providers/terraform_plan/handler.py +++ b/src/tirith/providers/terraform_plan/handler.py @@ -118,7 +118,7 @@ def provide(provider_inputs, input_data): resource_type = provider_inputs["terraform_resource_type"] is_resource_type_found = False for resource_change in resource_changes: - if resource_change["type"] == resource_type: + if resource_type in (resource_change["type"], "*"): is_resource_type_found = True for action in resource_change["change"]["actions"]: outputs.append( diff --git a/tests/providers/terraform_plan/test_action.py b/tests/providers/terraform_plan/test_action.py new file mode 100644 index 0000000..5609242 --- /dev/null +++ b/tests/providers/terraform_plan/test_action.py @@ -0,0 +1,9 @@ +from tirith.providers.terraform_plan import handler +from utils import load_terraform_plan_json + + +def test_action_star_resource_type_should_include_every_resource_types(): + provider_args_dict = {"operation_type": "action", "terraform_resource_type": "*"} + result = handler.provide(provider_args_dict, load_terraform_plan_json("input_implicit_elb_secgroup.json")) + + assert len(result) == 4