Skip to content

Conversation

@Zaid-Ajaj
Copy link
Contributor

Terraform added List Resources support back in terraform v1.14 and this PR implements it in the bridge.

List resources are a new special resource type which are not really resources, they act more like data_sources where they an input of the shape:

{ limit: int, includeResource: bool, config: <INPUT_CONFIG> }

and the output are of the shape

{ results: [ { resource: <OUTPUT_TYPE>, displayName: string } ] }

Where <INPUT_CONFIG> and <OUTPUT_TYPE> are defined in the schema of the ListResource in question.

In this PR, we implement these list resources as invokes since they are stateless and can be treated as functions of the provider. This way, we get SDK-gen support out of the box without any changes to the CLI or engine.

TODO:

  • Fully test the runtime implementation
  • Fully test the generated emitted schema (partially done)

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 56.17761% with 227 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.55%. Comparing base (4c91969) to head (3903d63).

Files with missing lines Patch % Lines
pkg/tfgen/generate.go 58.40% 38 Missing and 14 partials ⚠️
pkg/pf/tfbridge/provider_invoke.go 0.00% 38 Missing and 1 partial ⚠️
pkg/pf/tfbridge/provider_listresources.go 7.40% 24 Missing and 1 partial ⚠️
pkg/pf/internal/schemashim/list_resource_map.go 39.39% 19 Missing and 1 partial ⚠️
pkg/tfgen/generate_schema.go 83.76% 17 Missing and 2 partials ⚠️
pkg/pf/internal/schemashim/listresource.go 11.11% 16 Missing ⚠️
pkg/convert/encoding.go 0.00% 12 Missing ⚠️
pkg/tfbridge/info/info.go 66.66% 7 Missing and 2 partials ⚠️
pkg/convert/schema_context.go 0.00% 8 Missing ⚠️
pkg/tfshim/util/util.go 0.00% 5 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3232      +/-   ##
==========================================
- Coverage   68.62%   68.55%   -0.08%     
==========================================
  Files         338      322      -16     
  Lines       44181    35956    -8225     
==========================================
- Hits        30318    24648    -5670     
+ Misses      12128     9536    -2592     
- Partials     1735     1772      +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant