@@ -62,6 +62,7 @@ def provide(provider_inputs, input_data):
6262 input_resource_change_attrs = {}
6363 input_type = provider_inputs ["operation_type" ]
6464 resource_changes = input_data .get ("resource_changes" )
65+ exclude_resource_types = provider_inputs .get ("exclude_resource_types" , [])
6566
6667 if not resource_changes :
6768 outputs .append (
@@ -82,6 +83,9 @@ def provide(provider_inputs, input_data):
8283 is_attribute_found = False
8384
8485 for resource_change in resource_changes :
86+ # Skip if resource type is in exclude_resource_types when using wildcard
87+ if resource_type == "*" and resource_change ["type" ] in exclude_resource_types :
88+ continue
8589 if resource_type in (resource_change ["type" ], "*" ):
8690 is_resource_found = True
8791 input_resource_change_attrs = resource_change ["change" ]["after" ]
@@ -144,6 +148,9 @@ def provide(provider_inputs, input_data):
144148 resource_type = provider_inputs ["terraform_resource_type" ]
145149 is_resource_type_found = False
146150 for resource_change in resource_changes :
151+ # Skip if resource type is in exclude_resource_types when using wildcard
152+ if resource_type == "*" and resource_change ["type" ] in exclude_resource_types :
153+ continue
147154 if resource_type in (resource_change ["type" ], "*" ):
148155 is_resource_type_found = True
149156 for action in resource_change ["change" ]["actions" ]:
@@ -170,6 +177,9 @@ def provide(provider_inputs, input_data):
170177 resource_meta = {}
171178 resource_type = provider_inputs ["terraform_resource_type" ]
172179 for resource_change in resource_changes :
180+ # Skip if resource type is in exclude_resource_types when using wildcard
181+ if resource_type == "*" and resource_change ["type" ] in exclude_resource_types :
182+ continue
173183 if resource_type in (resource_change ["type" ], "*" ):
174184 # No need to check if the resource is not found
175185 # because the count of a resource can be zero
0 commit comments