Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SG-2878] New resource_type '*' for terraform provider Issue #219 #229

Merged
merged 6 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -69,7 +69,7 @@ def provide(provider_inputs, input_data):
is_attribute_found = False

for resource_change in resource_changes:
if resource_change["type"] == resource_type:
if resource_type in (resource_change["type"], "*"):
is_resource_found = True
input_resource_change_attrs = resource_change["change"]["after"]
if input_resource_change_attrs:
Expand Down Expand Up @@ -146,11 +146,11 @@ def provide(provider_inputs, input_data):
resource_meta = {}
resource_type = provider_inputs["terraform_resource_type"]
for resource_change in resource_changes:
if resource_change["type"] == resource_type:
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
count += 1

outputs.append(
{
Expand Down Expand Up @@ -282,6 +282,7 @@ def direct_dependencies_operator(input_data: dict, provider_inputs: dict, output
is_resource_found = False

for resource in config_resources:

if resource.get("type") != resource_type:
continue
is_resource_found = True
Expand Down Expand Up @@ -406,6 +407,7 @@ 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 or resource_change.get("change", {}).get("actions") == [
"destroy"
]:
Expand Down Expand Up @@ -479,6 +481,7 @@ def direct_references_operator(input_data: dict, provider_inputs: dict, outputs:
is_resource_found = False

for resource in config_resources:

if resource.get("type") != resource_type:
continue
is_resource_found = True
Expand Down
Loading