Skip to content

Initial work on Query command for List Resource #531

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

rainkwan
Copy link

Related Issue

Building off #528

Description

Adding ListResource and ValidateListResourceConfig from List Resource to plugin testing.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

No

@rainkwan rainkwan requested a review from a team as a code owner July 21, 2025 16:34
Copy link
Member

@stephybun stephybun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rainkwan, left a few minor comments but nothing that I think blocks us from merging this. LGTM 🚗


r.UnitTest(t, r.TestCase{
TerraformVersionChecks: []tfversion.TerraformVersionCheck{
tfversion.SkipBelow(tfversion.Version1_14_0), // Query mode requires Terraform 1.13.0 or later
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this comment since it contradicts what's in the code

Suggested change
tfversion.SkipBelow(tfversion.Version1_14_0), // Query mode requires Terraform 1.13.0 or later
tfversion.SkipBelow(tfversion.Version1_14_0),


for _, file := range fi {
if file.Mode().IsRegular() {
if filepath.Ext(file.Name()) == ".warioform" || filepath.Ext(file.Name()) == ".json" || filepath.Ext(file.Name()) == ".hcl" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it makes sense to be more specific with the file extension here as well, also

.warioform

😬

Suggested change
if filepath.Ext(file.Name()) == ".warioform" || filepath.Ext(file.Name()) == ".json" || filepath.Ext(file.Name()) == ".hcl" {
if filepath.Ext(file.Name()) == ".warioform" || filepath.Ext(file.Name()) == ".json" || filepath.Ext(file.Name()) == ".tfquery.hcl" {

"github.com/hashicorp/terraform-plugin-testing/internal/testing/testsdk/provider"
"github.com/hashicorp/terraform-plugin-testing/internal/testing/testsdk/resource"
)

var _ tfprotov6.ProviderServer = ProviderServer{}

// var _ tfprotov6.ProviderServerWithListResource = ProviderServer{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this still be commented out?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally speaking, this interface should only be directly referenced by exported terraform-plugin-go packages or testing packages like in terraform-plugin-mux

Since it's a temporary interface, we will eventually remove it once all downstream provider servers have a chance to implement them (for example, SDKv2 will need to implement the interface eventually, even if it doesn't have an SDK for the RPCs). Once that is removed, since there are no direct references to the interface itself, no downstream packages need to be re-released with the interface removed and provider's CI won't break 🙂

@@ -71,6 +71,10 @@ func (c configurationFile) HasTerraformBlock(ctx context.Context) (bool, error)
return contains, nil
}

func (c configurationFile) WriteQuery(ctx context.Context, dest string) error {
panic("WriteQuery not supported for configurationDirectory")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
panic("WriteQuery not supported for configurationDirectory")
panic("WriteQuery not supported for configurationFile")

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.

3 participants