Skip to content

Commit

Permalink
terraform_plan/action: Support "*" resource type
Browse files Browse the repository at this point in the history
For including all of the resource types
  • Loading branch information
refeed authored and arunim2405 committed Oct 26, 2023
1 parent cd116a7 commit 5ab7aed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tirith/providers/terraform_plan/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 9 additions & 0 deletions tests/providers/terraform_plan/test_action.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5ab7aed

Please sign in to comment.