From 5981cd2bf7af70b9206bed9410f27bad1c240188 Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Tue, 16 Sep 2025 18:16:30 +0100 Subject: [PATCH 01/27] Prepare main branch for post-v1.14 development (#37621) * Prepare main branch for post-v1.14 development * Update pull_request_template.md to reflect how main == v1.15 now --- .changes/{1.14.0.md => 1.15.0.md} | 0 .changes/previous-releases.md | 1 + .changes/v1.13/BUG FIXES-20250804-162137.yaml | 5 ---- .changes/v1.13/BUG FIXES-20250821-091753.yaml | 5 ---- .changes/v1.13/BUG FIXES-20250825-125018.yaml | 5 ---- .changes/v1.13/BUG FIXES-20250905-083104.yaml | 5 ---- .changes/v1.13/BUG FIXES-20250910-095424.yaml | 5 ---- .changes/v1.13/BUG FIXES-20250911-142038.yaml | 5 ---- .changes/v1.14/BUG FIXES-20250714-135938.yaml | 5 ---- .changes/v1.14/BUG FIXES-20250828-182746.yaml | 5 ---- .../v1.14/ENHANCEMENTS-20250723-122922.yaml | 5 ---- .../v1.14/ENHANCEMENTS-20250723-141420.yaml | 5 ---- .../v1.14/NEW FEATURES-20250829-151946.yaml | 5 ---- .../v1.14/NEW FEATURES-20250903-131921.yaml | 5 ---- .../v1.14/UPGRADE NOTES-20250814-162650.yaml | 5 ---- .../v1.14/UPGRADE NOTES-20250814-162752.yaml | 5 ---- .changes/v1.15/.gitkeep | 0 .changie.yaml | 2 +- .github/pull_request_template.md | 2 +- CHANGELOG.md | 29 ++----------------- internal/command/query_test.go | 6 ++-- version/VERSION | 2 +- 22 files changed, 10 insertions(+), 102 deletions(-) rename .changes/{1.14.0.md => 1.15.0.md} (100%) delete mode 100644 .changes/v1.13/BUG FIXES-20250804-162137.yaml delete mode 100644 .changes/v1.13/BUG FIXES-20250821-091753.yaml delete mode 100644 .changes/v1.13/BUG FIXES-20250825-125018.yaml delete mode 100644 .changes/v1.13/BUG FIXES-20250905-083104.yaml delete mode 100644 .changes/v1.13/BUG FIXES-20250910-095424.yaml delete mode 100644 .changes/v1.13/BUG FIXES-20250911-142038.yaml delete mode 100644 .changes/v1.14/BUG FIXES-20250714-135938.yaml delete mode 100644 .changes/v1.14/BUG FIXES-20250828-182746.yaml delete mode 100644 .changes/v1.14/ENHANCEMENTS-20250723-122922.yaml delete mode 100644 .changes/v1.14/ENHANCEMENTS-20250723-141420.yaml delete mode 100644 .changes/v1.14/NEW FEATURES-20250829-151946.yaml delete mode 100644 .changes/v1.14/NEW FEATURES-20250903-131921.yaml delete mode 100644 .changes/v1.14/UPGRADE NOTES-20250814-162650.yaml delete mode 100644 .changes/v1.14/UPGRADE NOTES-20250814-162752.yaml create mode 100644 .changes/v1.15/.gitkeep diff --git a/.changes/1.14.0.md b/.changes/1.15.0.md similarity index 100% rename from .changes/1.14.0.md rename to .changes/1.15.0.md diff --git a/.changes/previous-releases.md b/.changes/previous-releases.md index 9dbc3d602248..d3f9501009c2 100644 --- a/.changes/previous-releases.md +++ b/.changes/previous-releases.md @@ -1,3 +1,4 @@ +- [v1.14](https://github.com/hashicorp/terraform/blob/v1.14/CHANGELOG.md) - [v1.13](https://github.com/hashicorp/terraform/blob/v1.13/CHANGELOG.md) - [v1.12](https://github.com/hashicorp/terraform/blob/v1.12/CHANGELOG.md) - [v1.11](https://github.com/hashicorp/terraform/blob/v1.11/CHANGELOG.md) diff --git a/.changes/v1.13/BUG FIXES-20250804-162137.yaml b/.changes/v1.13/BUG FIXES-20250804-162137.yaml deleted file mode 100644 index 2a9dbd238f20..000000000000 --- a/.changes/v1.13/BUG FIXES-20250804-162137.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: Fixes resource identity being dropped from state in certain cases -time: 2025-08-04T16:21:37.590435+02:00 -custom: - Issue: "37396" diff --git a/.changes/v1.13/BUG FIXES-20250821-091753.yaml b/.changes/v1.13/BUG FIXES-20250821-091753.yaml deleted file mode 100644 index d39012ed0c8d..000000000000 --- a/.changes/v1.13/BUG FIXES-20250821-091753.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: Fix regression that caused `terraform test` with zero tests to return a non-zero exit code. -time: 2025-08-21T09:17:53.534792+02:00 -custom: - Issue: "37477" diff --git a/.changes/v1.13/BUG FIXES-20250825-125018.yaml b/.changes/v1.13/BUG FIXES-20250825-125018.yaml deleted file mode 100644 index 1d915d7d5a8b..000000000000 --- a/.changes/v1.13/BUG FIXES-20250825-125018.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: 'terraform test: prevent panic when resolving incomplete references' -time: 2025-08-25T12:50:18.511449+02:00 -custom: - Issue: "37484" diff --git a/.changes/v1.13/BUG FIXES-20250905-083104.yaml b/.changes/v1.13/BUG FIXES-20250905-083104.yaml deleted file mode 100644 index 0cbd970f7447..000000000000 --- a/.changes/v1.13/BUG FIXES-20250905-083104.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: "test: Fix the order of execution of cleanup nodes" -time: 2025-09-05T08:31:04.56877+02:00 -custom: - Issue: "37546" diff --git a/.changes/v1.13/BUG FIXES-20250910-095424.yaml b/.changes/v1.13/BUG FIXES-20250910-095424.yaml deleted file mode 100644 index d34da5672be8..000000000000 --- a/.changes/v1.13/BUG FIXES-20250910-095424.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: 'apply: hide sensitive inputs when values have changed between plan and apply' -time: 2025-09-10T09:54:24.889605+02:00 -custom: - Issue: "37582" diff --git a/.changes/v1.13/BUG FIXES-20250911-142038.yaml b/.changes/v1.13/BUG FIXES-20250911-142038.yaml deleted file mode 100644 index 4355a4c01788..000000000000 --- a/.changes/v1.13/BUG FIXES-20250911-142038.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: 'variable validation: keep sensitive and ephemeral metadata when evaluating variable conditions.' -time: 2025-09-11T14:20:38.411183+02:00 -custom: - Issue: "37595" diff --git a/.changes/v1.14/BUG FIXES-20250714-135938.yaml b/.changes/v1.14/BUG FIXES-20250714-135938.yaml deleted file mode 100644 index 69b483e11a62..000000000000 --- a/.changes/v1.14/BUG FIXES-20250714-135938.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: Retrieve all workspace variables while doing a `terraform import`, include variables inherited from variable sets but not overwritten by the workspace. -time: 2025-07-14T13:59:38.867411+05:30 -custom: - Issue: "37241" diff --git a/.changes/v1.14/BUG FIXES-20250828-182746.yaml b/.changes/v1.14/BUG FIXES-20250828-182746.yaml deleted file mode 100644 index a7f07b433a87..000000000000 --- a/.changes/v1.14/BUG FIXES-20250828-182746.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: BUG FIXES -body: Fix OSS backend proxy support by adding a proxy layer for OSS backend operations. Resolves hashicorp/terraform#36897. -time: 2025-08-28T18:27:46.867411+05:30 -custom: - Issue: "36897" \ No newline at end of file diff --git a/.changes/v1.14/ENHANCEMENTS-20250723-122922.yaml b/.changes/v1.14/ENHANCEMENTS-20250723-122922.yaml deleted file mode 100644 index 2738fafb61d9..000000000000 --- a/.changes/v1.14/ENHANCEMENTS-20250723-122922.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: ENHANCEMENTS -body: 'terraform test: expected diagnostics will be included in test output when running in verbose mode"' -time: 2025-07-23T12:29:22.244611+02:00 -custom: - Issue: "37362" diff --git a/.changes/v1.14/ENHANCEMENTS-20250723-141420.yaml b/.changes/v1.14/ENHANCEMENTS-20250723-141420.yaml deleted file mode 100644 index 7edfaa2280b2..000000000000 --- a/.changes/v1.14/ENHANCEMENTS-20250723-141420.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: ENHANCEMENTS -body: 'terraform test: ignore prevent_destroy attribute during when cleaning up tests"' -time: 2025-07-23T14:14:20.602923+02:00 -custom: - Issue: "37364" diff --git a/.changes/v1.14/NEW FEATURES-20250829-151946.yaml b/.changes/v1.14/NEW FEATURES-20250829-151946.yaml deleted file mode 100644 index d59ca48e43ec..000000000000 --- a/.changes/v1.14/NEW FEATURES-20250829-151946.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: NEW FEATURES -body: A new GenerateResourceConfiguration RPC allows providers to create more precise configuration values during import. -time: 2025-08-29T15:19:46.781245-04:00 -custom: - Issue: "37515" diff --git a/.changes/v1.14/NEW FEATURES-20250903-131921.yaml b/.changes/v1.14/NEW FEATURES-20250903-131921.yaml deleted file mode 100644 index 6087d99b9757..000000000000 --- a/.changes/v1.14/NEW FEATURES-20250903-131921.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: NEW FEATURES -body: "New top-level Actions block: Actions are provider defined and meant to codify use cases outside the normal CRUD model in your Terraform configuration. Providers can define Actions like `aws_lambda_invoke` or `aws_cloudfront_create_invalidation` that do something imparative outside of Terraforms normal CRUD model. You can configure such a side-effect with an action block and have actions triggered through the lifecycle of a resource or through passing the `-invoke` CLI flag." -time: 2025-09-03T13:19:21.097051+02:00 -custom: - Issue: "37553" diff --git a/.changes/v1.14/UPGRADE NOTES-20250814-162650.yaml b/.changes/v1.14/UPGRADE NOTES-20250814-162650.yaml deleted file mode 100644 index 17baa54cca2e..000000000000 --- a/.changes/v1.14/UPGRADE NOTES-20250814-162650.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: UPGRADE NOTES -body: 'The parallelism of Terraform operations within container runtimes may be reduced depending on the CPU bandwidth limit setting.' -time: 2025-08-14T16:26:50.569878+02:00 -custom: - Issue: "37436" diff --git a/.changes/v1.14/UPGRADE NOTES-20250814-162752.yaml b/.changes/v1.14/UPGRADE NOTES-20250814-162752.yaml deleted file mode 100644 index c42a78470ce1..000000000000 --- a/.changes/v1.14/UPGRADE NOTES-20250814-162752.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: UPGRADE NOTES -body: 'Building Terraform 1.14 requires macOS Monterey or later (due to being built on Go 1.25 which imposes these requirements)' -time: 2025-08-14T16:27:52.659896+02:00 -custom: - Issue: "37436" diff --git a/.changes/v1.15/.gitkeep b/.changes/v1.15/.gitkeep new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/.changie.yaml b/.changie.yaml index 063ce48dd3c7..831fe6fb5b6f 100644 --- a/.changie.yaml +++ b/.changie.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BUSL-1.1 changesDir: .changes -unreleasedDir: v1.14 +unreleasedDir: v1.15 versionFooterPath: version_footer.tpl.md changelogPath: CHANGELOG.md versionExt: md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 00f9ad48bbcf..0194cc47c352 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -31,7 +31,7 @@ label to enable the backport bot. --> -1.14.x +1.15.x ## Rollback Plan diff --git a/CHANGELOG.md b/CHANGELOG.md index 002c7e0fc361..0b436edc3388 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,30 +1,4 @@ -## 1.14.0 (Unreleased) - - -NEW FEATURES: - -* A new GenerateResourceConfiguration RPC allows providers to create more precise configuration values during import. ([#37515](https://github.com/hashicorp/terraform/issues/37515)) - - -ENHANCEMENTS: - -* terraform test: expected diagnostics will be included in test output when running in verbose mode" ([#37362](https://github.com/hashicorp/terraform/issues/37362)) - -* terraform test: ignore prevent_destroy attribute during when cleaning up tests" ([#37364](https://github.com/hashicorp/terraform/issues/37364)) - - -BUG FIXES: - -* Retrieve all workspace variables while doing a `terraform import`, include variables inherited from variable sets but not overwritten by the workspace. ([#37241](https://github.com/hashicorp/terraform/issues/37241)) - -* Fix OSS backend proxy support by adding a proxy layer for OSS backend operations. Resolves hashicorp/terraform#36897. ([#36897](https://github.com/hashicorp/terraform/issues/36897)) - - -UPGRADE NOTES: - -* The parallelism of Terraform operations within container runtimes may be reduced depending on the CPU bandwidth limit setting. ([#37436](https://github.com/hashicorp/terraform/issues/37436)) - -* Building Terraform 1.14 requires macOS Monterey or later (due to being built on Go 1.25 which imposes these requirements) ([#37436](https://github.com/hashicorp/terraform/issues/37436)) +## 1.15.0 (Unreleased) EXPERIMENTS: @@ -41,6 +15,7 @@ Experiments are only enabled in alpha releases of Terraform CLI. The following f For information on prior major and minor releases, refer to their changelogs: +- [v1.14](https://github.com/hashicorp/terraform/blob/v1.14/CHANGELOG.md) - [v1.13](https://github.com/hashicorp/terraform/blob/v1.13/CHANGELOG.md) - [v1.12](https://github.com/hashicorp/terraform/blob/v1.12/CHANGELOG.md) - [v1.11](https://github.com/hashicorp/terraform/blob/v1.11/CHANGELOG.md) diff --git a/internal/command/query_test.go b/internal/command/query_test.go index c95b91c5c4f0..864194988f5e 100644 --- a/internal/command/query_test.go +++ b/internal/command/query_test.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/providers" testing_provider "github.com/hashicorp/terraform/internal/providers/testing" + tfversion "github.com/hashicorp/terraform/version" "github.com/zclconf/go-cty/cty" ) @@ -782,6 +783,7 @@ func TestQuery_JSON(t *testing.T) { func TestQuery_JSON_Raw(t *testing.T) { + tfVer := tfversion.String() tests := []struct { name string directory string @@ -793,7 +795,7 @@ func TestQuery_JSON_Raw(t *testing.T) { { name: "basic query", directory: "basic", - expectedOut: `{"@level":"info","@message":"Terraform 1.14.0-dev","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} + expectedOut: `{"@level":"info","@message":"Terraform ` + tfVer + `","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} {"@level":"info","@message":"list.test_instance.example: Starting query...","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600609+02:00","list_start":{"address":"list.test_instance.example","resource_type":"test_instance","input_config":{"ami":"ami-12345","foo":null}},"type":"list_start"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600729+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 1","identity":{"id":"test-instance-1"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-12345","id":"test-instance-1"}},"type":"list_resource_found"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600759+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 2","identity":{"id":"test-instance-2"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-67890","id":"test-instance-2"}},"type":"list_resource_found"} @@ -803,7 +805,7 @@ func TestQuery_JSON_Raw(t *testing.T) { { name: "empty result", directory: "empty-result", - expectedOut: `{"@level":"info","@message":"Terraform 1.14.0-dev","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} + expectedOut: `{"@level":"info","@message":"Terraform ` + tfVer + `","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} {"@level":"info","@message":"list.test_instance.example: Starting query...","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600609+02:00","list_start":{"address":"list.test_instance.example","resource_type":"test_instance","input_config":{"ami":"ami-12345","foo":null}},"type":"list_start"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600729+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 1","identity":{"id":"test-instance-1"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-12345","id":"test-instance-1"}},"type":"list_resource_found"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600759+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 2","identity":{"id":"test-instance-2"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-67890","id":"test-instance-2"}},"type":"list_resource_found"} diff --git a/version/VERSION b/version/VERSION index 2f2e08cfa3bf..9a4866bbcede 100644 --- a/version/VERSION +++ b/version/VERSION @@ -1 +1 @@ -1.14.0-dev +1.15.0-dev From 719aefdb899ccd4752b0bdbd1a5076de355a640e Mon Sep 17 00:00:00 2001 From: Samsondeen <40821565+dsa0x@users.noreply.github.com> Date: Wed, 17 Sep 2025 12:29:04 +0200 Subject: [PATCH 02/27] tf query: ready list blocks for beta (#37619) --- commands.go | 12 ++-- internal/cloud/backend_query.go | 7 +- internal/cloud/backend_query_test.go | 12 +++- .../query-json-basic/main.tfquery.hcl | 4 +- .../cloud/testdata/query/main.tfquery.hcl | 4 +- .../command/e2etest/providers_schema_test.go | 30 +++++++++ internal/command/jsonformat/plan_test.go | 6 +- internal/command/jsonformat/state_test.go | 2 +- internal/command/jsonprovider/provider.go | 32 +++++---- .../command/jsonprovider/provider_test.go | 67 ++++--------------- internal/command/meta.go | 3 + internal/command/meta_config.go | 9 +-- internal/command/plan_test.go | 50 ++++++++++++++ internal/command/providers_schema.go | 2 +- internal/command/query.go | 1 + internal/command/query_test.go | 17 +---- internal/command/state_show.go | 2 +- internal/command/views/operation.go | 2 +- internal/command/views/show.go | 4 +- internal/command/views/test.go | 8 +-- internal/configs/config_build_test.go | 9 ++- internal/configs/configload/loader.go | 13 +++- internal/configs/configload/loader_load.go | 6 +- .../configs/configload/loader_snapshot.go | 2 +- internal/configs/configload/testing.go | 8 ++- internal/configs/parser_config_dir.go | 4 +- internal/configs/parser_config_dir_test.go | 19 ++---- internal/configs/parser_file_matcher.go | 10 ++- internal/initwd/testing.go | 2 +- internal/terraform/terraform_test.go | 15 ++++- internal/tfdiags/object.go | 43 +++++++----- 31 files changed, 242 insertions(+), 163 deletions(-) diff --git a/commands.go b/commands.go index 79424845043b..b8489519b40b 100644 --- a/commands.go +++ b/commands.go @@ -276,6 +276,12 @@ func initCommands( }, nil }, + "query": func() (cli.Command, error) { + return &command.QueryCommand{ + Meta: meta, + }, nil + }, + "refresh": func() (cli.Command, error) { return &command.RefreshCommand{ Meta: meta, @@ -451,12 +457,6 @@ func initCommands( }, nil } - Commands["query"] = func() (cli.Command, error) { - return &command.QueryCommand{ - Meta: meta, - }, nil - } - Commands["test cleanup"] = func() (cli.Command, error) { return &command.TestCleanupCommand{ Meta: meta, diff --git a/internal/cloud/backend_query.go b/internal/cloud/backend_query.go index 3fa78d4bfa8f..a8759c5f5cb9 100644 --- a/internal/cloud/backend_query.go +++ b/internal/cloud/backend_query.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform/internal/genconfig" "github.com/hashicorp/terraform/internal/terraform" "github.com/hashicorp/terraform/internal/tfdiags" + "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" ) @@ -276,7 +277,7 @@ func (b *Cloud) cancelQueryRun(cancelCtx context.Context, op *backendrun.Operati // formatIdentity formats the identity map into a string representation. // It flattens the map into a string of key=value pairs, separated by commas. func formatIdentity(identity map[string]json.RawMessage) string { - parts := make([]string, 0, len(identity)) + ctyObj := make(map[string]cty.Value, len(identity)) for key, value := range identity { ty, err := ctyjson.ImpliedType(value) if err != nil { @@ -286,9 +287,9 @@ func formatIdentity(identity map[string]json.RawMessage) string { if err != nil { continue } - parts = append(parts, fmt.Sprintf("%s=%s", key, tfdiags.ValueToString(v))) + ctyObj[key] = v } - return strings.Join(parts, ",") + return tfdiags.ObjectToString(cty.ObjectVal(ctyObj)) } const queryDefaultHeader = ` diff --git a/internal/cloud/backend_query_test.go b/internal/cloud/backend_query_test.go index 31fab4db2402..83feb260a6dc 100644 --- a/internal/cloud/backend_query_test.go +++ b/internal/cloud/backend_query_test.go @@ -9,6 +9,7 @@ import ( "testing" "time" + "github.com/google/go-cmp/cmp" "github.com/hashicorp/cli" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/backend/backendrun" @@ -121,8 +122,15 @@ func TestCloud_queryJSONBasic(t *testing.T) { outp := close(t) gotOut := outp.Stdout() - if !strings.Contains(gotOut, "list.concept_pet.pets id=complete-gannet,legs=6 This is a complete-gannet") { - t.Fatalf("expected query results in output: %s", gotOut) + expectedOut := `list.concept_pet.pets id=large-roughy,legs=2 This is a large-roughy +list.concept_pet.pets id=able-werewolf,legs=5 This is a able-werewolf +list.concept_pet.pets id=complete-gannet,legs=6 This is a complete-gannet +list.concept_pet.pets id=charming-beagle,legs=3 This is a charming-beagle +list.concept_pet.pets id=legal-lamprey,legs=2 This is a legal-lamprey + +` + if diff := cmp.Diff(expectedOut, gotOut); diff != "" { + t.Fatalf("expected query results output to be %s, got %s: diff: %s", expectedOut, gotOut, diff) } stateMgr, _ := b.StateMgr(testBackendSingleWorkspaceName) diff --git a/internal/cloud/testdata/query-json-basic/main.tfquery.hcl b/internal/cloud/testdata/query-json-basic/main.tfquery.hcl index 4652ae7d19da..a3276bd012a1 100644 --- a/internal/cloud/testdata/query-json-basic/main.tfquery.hcl +++ b/internal/cloud/testdata/query-json-basic/main.tfquery.hcl @@ -1 +1,3 @@ -list "concept_pet" "pets" {} +list "concept_pet" "pets" { + provider = concept +} diff --git a/internal/cloud/testdata/query/main.tfquery.hcl b/internal/cloud/testdata/query/main.tfquery.hcl index f8c5bb1924c3..58f63c04942e 100644 --- a/internal/cloud/testdata/query/main.tfquery.hcl +++ b/internal/cloud/testdata/query/main.tfquery.hcl @@ -1 +1,3 @@ -list "null_resource" "foo" {} +list "null_resource" "foo" { + provider = null +} diff --git a/internal/command/e2etest/providers_schema_test.go b/internal/command/e2etest/providers_schema_test.go index 7a5d7dea8d47..582a21710c21 100644 --- a/internal/command/e2etest/providers_schema_test.go +++ b/internal/command/e2etest/providers_schema_test.go @@ -134,6 +134,21 @@ func TestProvidersSchema(t *testing.T) { } } }, + "list_resource_schemas": { + "simple_resource": { + "version": 0, + "block": { + "attributes": { + "value": { + "type": "string", + "description_kind": "plain", + "optional": true + } + }, + "description_kind": "plain" + } + } + }, "resource_identity_schemas": { "simple_resource": { "version": 0, @@ -213,6 +228,21 @@ func TestProvidersSchema(t *testing.T) { } } }, + "list_resource_schemas": { + "simple_resource": { + "version": 0, + "block": { + "attributes": { + "value": { + "type": "string", + "description_kind": "plain", + "optional": true + } + }, + "description_kind": "plain" + } + } + }, "functions": { "noop": { "description": "noop takes any single argument and returns the same value", diff --git a/internal/command/jsonformat/plan_test.go b/internal/command/jsonformat/plan_test.go index f971c08d02af..5f99c2fd9e7e 100644 --- a/internal/command/jsonformat/plan_test.go +++ b/internal/command/jsonformat/plan_test.go @@ -8071,7 +8071,7 @@ func runTestCases(t *testing.T, testCases map[string]testCase) { return } - jsonschemas := jsonprovider.MarshalForRenderer(tfschemas, false) + jsonschemas := jsonprovider.MarshalForRenderer(tfschemas) change := structured.FromJsonChange(jsonchanges[0].Change, attribute_path.AlwaysMatcher()) renderer := Renderer{Colorize: color} diff := diff{ @@ -8421,7 +8421,7 @@ func TestResourceChange_deferredActions(t *testing.T) { } renderer := Renderer{Colorize: color} - jsonschemas := jsonprovider.MarshalForRenderer(fullSchema, false) + jsonschemas := jsonprovider.MarshalForRenderer(fullSchema) diffs := precomputeDiffs(Plan{ DeferredChanges: deferredChanges, ProviderSchemas: jsonschemas, @@ -8714,7 +8714,7 @@ func TestResourceChange_actions(t *testing.T) { }, }, } - jsonschemas := jsonprovider.MarshalForRenderer(fullSchema, false) + jsonschemas := jsonprovider.MarshalForRenderer(fullSchema) diffs := precomputeDiffs(Plan{ ResourceChanges: []jsonplan.ResourceChange{defaultResourceChange}, ActionInvocations: tc.actionInvocations, diff --git a/internal/command/jsonformat/state_test.go b/internal/command/jsonformat/state_test.go index 9c4eafa50b23..b8350f29bbbb 100644 --- a/internal/command/jsonformat/state_test.go +++ b/internal/command/jsonformat/state_test.go @@ -86,7 +86,7 @@ func TestState(t *testing.T) { RootModule: root, RootModuleOutputs: outputs, ProviderFormatVersion: jsonprovider.FormatVersion, - ProviderSchemas: jsonprovider.MarshalForRenderer(tt.Schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(tt.Schemas), }) result := done(t).All() diff --git a/internal/command/jsonprovider/provider.go b/internal/command/jsonprovider/provider.go index 0ebb76f82b91..10fdcf7831f4 100644 --- a/internal/command/jsonprovider/provider.go +++ b/internal/command/jsonprovider/provider.go @@ -45,22 +45,22 @@ func newProviders() *Providers { // schema into the public structured JSON versions. // // This is a format that can be read by the structured plan renderer. -func MarshalForRenderer(s *terraform.Schemas, includeExperimentalSchemas bool) map[string]*Provider { +func MarshalForRenderer(s *terraform.Schemas) map[string]*Provider { schemas := make(map[string]*Provider, len(s.Providers)) for k, v := range s.Providers { - schemas[k.String()] = marshalProvider(v, includeExperimentalSchemas) + schemas[k.String()] = marshalProvider(v) } return schemas } -func Marshal(s *terraform.Schemas, includeExperimentalSchemas bool) ([]byte, error) { +func Marshal(s *terraform.Schemas) ([]byte, error) { providers := newProviders() - providers.Schemas = MarshalForRenderer(s, includeExperimentalSchemas) + providers.Schemas = MarshalForRenderer(s) ret, err := json.Marshal(providers) return ret, err } -func marshalProvider(tps providers.ProviderSchema, includeExperimentalSchemas bool) *Provider { +func marshalProvider(tps providers.ProviderSchema) *Provider { p := &Provider{ Provider: marshalSchema(tps.Provider), ResourceSchemas: marshalSchemas(tps.ResourceTypes), @@ -71,20 +71,18 @@ func marshalProvider(tps providers.ProviderSchema, includeExperimentalSchemas bo ActionSchemas: marshalActionSchemas(tps.Actions), } - if includeExperimentalSchemas { - // List resource schemas are nested under a "config" block, so we need to - // extract that block to get the actual provider schema for the list resource. - // When getting the provider schemas, Terraform adds this extra level to - // better match the actual configuration structure. - listSchemas := make(map[string]providers.Schema, len(tps.ListResourceTypes)) - for k, v := range tps.ListResourceTypes { - listSchemas[k] = providers.Schema{ - Body: &v.Body.BlockTypes["config"].Block, - Version: v.Version, - } + // List resource schemas are nested under a "config" block, so we need to + // extract that block to get the actual provider schema for the list resource. + // When getting the provider schemas, Terraform adds this extra level to + // better match the actual configuration structure. + listSchemas := make(map[string]providers.Schema, len(tps.ListResourceTypes)) + for k, v := range tps.ListResourceTypes { + listSchemas[k] = providers.Schema{ + Body: &v.Body.BlockTypes["config"].Block, + Version: v.Version, } - p.ListResourceSchemas = marshalSchemas(listSchemas) } + p.ListResourceSchemas = marshalSchemas(listSchemas) return p } diff --git a/internal/command/jsonprovider/provider_test.go b/internal/command/jsonprovider/provider_test.go index e65e4867869b..bb9ca97486b1 100644 --- a/internal/command/jsonprovider/provider_test.go +++ b/internal/command/jsonprovider/provider_test.go @@ -20,25 +20,23 @@ var cmpOpts = cmpopts.IgnoreUnexported(Provider{}) func TestMarshalProvider(t *testing.T) { tests := []struct { - Input providers.ProviderSchema - IncludeExperimental bool - Want *Provider + Input providers.ProviderSchema + Want *Provider }{ { providers.ProviderSchema{}, - false, &Provider{ Provider: &Schema{}, ResourceSchemas: map[string]*Schema{}, DataSourceSchemas: map[string]*Schema{}, EphemeralResourceSchemas: map[string]*Schema{}, ResourceIdentitySchemas: map[string]*IdentitySchema{}, + ListResourceSchemas: map[string]*Schema{}, ActionSchemas: map[string]*ActionSchema{}, }, }, { testProvider(), - false, &Provider{ Provider: &Schema{ Block: &Block{ @@ -212,53 +210,6 @@ func TestMarshalProvider(t *testing.T) { }, }, }, - ResourceIdentitySchemas: map[string]*IdentitySchema{}, - ActionSchemas: map[string]*ActionSchema{}, - }, - }, - { - providers.ProviderSchema{ - ListResourceTypes: map[string]providers.Schema{ - "test_list_resource": { - Version: 1, - Body: &configschema.Block{ - Attributes: map[string]*configschema.Attribute{ - "data": { - Type: cty.DynamicPseudoType, - Computed: true, - }, - }, - BlockTypes: map[string]*configschema.NestedBlock{ - "config": { - Block: configschema.Block{ - Attributes: map[string]*configschema.Attribute{ - "filter": {Type: cty.String, Optional: true}, - "items": {Type: cty.List(cty.String), Required: true}, - }, - }, - Nesting: configschema.NestingSingle, - }, - }, - }, - }, - }, - Actions: map[string]providers.ActionSchema{ - "test_action": { - ConfigSchema: &configschema.Block{ - Attributes: map[string]*configschema.Attribute{ - "opt_attr": {Type: cty.String, Optional: true}, - "req_attr": {Type: cty.List(cty.String), Required: true}, - }, - }, - }, - }, - }, - true, - &Provider{ - Provider: &Schema{}, - ResourceSchemas: map[string]*Schema{}, - DataSourceSchemas: map[string]*Schema{}, - EphemeralResourceSchemas: map[string]*Schema{}, ListResourceSchemas: map[string]*Schema{ "test_list_resource": { Version: 1, @@ -305,7 +256,7 @@ func TestMarshalProvider(t *testing.T) { for i, test := range tests { t.Run(fmt.Sprint(i), func(t *testing.T) { - got := marshalProvider(test.Input, test.IncludeExperimental) + got := marshalProvider(test.Input) if diff := cmp.Diff(test.Want, got, cmpOpts); diff != "" { t.Fatalf("wrong result:\n %s\n", diff) } @@ -431,5 +382,15 @@ func testProvider() providers.ProviderSchema { }, }, }, + Actions: map[string]providers.ActionSchema{ + "test_action": { + ConfigSchema: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "opt_attr": {Type: cty.String, Optional: true}, + "req_attr": {Type: cty.List(cty.String), Required: true}, + }, + }, + }, + }, } } diff --git a/internal/command/meta.go b/internal/command/meta.go index 0dc89ecdd0d8..1626109fbfb4 100644 --- a/internal/command/meta.go +++ b/internal/command/meta.go @@ -272,6 +272,9 @@ type Meta struct { // Used with commands which write state to allow users to write remote // state even if the remote and local Terraform versions don't match. ignoreRemoteVersion bool + + // set to true if query files should be parsed + includeQueryFiles bool } type testingOverrides struct { diff --git a/internal/command/meta_config.go b/internal/command/meta_config.go index 3887d77db420..6485a4347916 100644 --- a/internal/command/meta_config.go +++ b/internal/command/meta_config.go @@ -38,7 +38,7 @@ func (m *Meta) normalizePath(path string) string { // loadConfig reads a configuration from the given directory, which should // contain a root module and have already have any required descendant modules // installed. -func (m *Meta) loadConfig(rootDir string, parserOpts ...configs.Option) (*configs.Config, tfdiags.Diagnostics) { +func (m *Meta) loadConfig(rootDir string) (*configs.Config, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics rootDir = m.normalizePath(rootDir) @@ -48,7 +48,7 @@ func (m *Meta) loadConfig(rootDir string, parserOpts ...configs.Option) (*config return nil, diags } - config, hclDiags := loader.LoadConfig(rootDir, parserOpts...) + config, hclDiags := loader.LoadConfig(rootDir) diags = diags.Append(hclDiags) return config, diags } @@ -353,8 +353,9 @@ func (m *Meta) registerSynthConfigSource(filename string, src []byte) { func (m *Meta) initConfigLoader() (*configload.Loader, error) { if m.configLoader == nil { loader, err := configload.NewLoader(&configload.Config{ - ModulesDir: m.modulesDir(), - Services: m.Services, + ModulesDir: m.modulesDir(), + Services: m.Services, + IncludeQueryFiles: m.includeQueryFiles, }) if err != nil { return nil, err diff --git a/internal/command/plan_test.go b/internal/command/plan_test.go index e77ae0eb6ce6..b3e726c8c00f 100644 --- a/internal/command/plan_test.go +++ b/internal/command/plan_test.go @@ -1588,6 +1588,56 @@ func TestPlan_jsonGoldenReference(t *testing.T) { checkGoldenReference(t, output, "plan") } +// Tests related to how plan command behaves when there are query files in the configuration path +func TestPlan_QueryFiles(t *testing.T) { + // a plan succeeds regardless of valid or invalid + // tfquery files in the configuration path + t.Run("with invalid query files in the config path", func(t *testing.T) { + td := t.TempDir() + testCopyDir(t, testFixturePath("query/invalid-syntax"), td) + t.Chdir(td) + + p := planFixtureProvider() + view, done := testView(t) + c := &PlanCommand{ + Meta: Meta{ + testingOverrides: metaOverridesForProvider(p), + View: view, + }, + } + + args := []string{} + code := c.Run(args) + output := done(t) + if code != 0 { + t.Fatalf("bad: %d\n\n%s", code, output.Stderr()) + } + }) + + // the duplicate in the query should not matter because query files are not processed + t.Run("with duplicate variables across query and plan file", func(t *testing.T) { + td := t.TempDir() + testCopyDir(t, testFixturePath("query/duplicate-variables"), td) + t.Chdir(td) + + p := planFixtureProvider() + view, done := testView(t) + c := &PlanCommand{ + Meta: Meta{ + testingOverrides: metaOverridesForProvider(p), + View: view, + }, + } + + args := []string{"-var", "instance_name=foo"} + code := c.Run(args) + output := done(t) + if code != 0 { + t.Fatalf("bad: %d\n\n%s", code, output.Stderr()) + } + }) +} + // planFixtureSchema returns a schema suitable for processing the // configuration in testdata/plan . This schema should be // assigned to a mock provider named "test". diff --git a/internal/command/providers_schema.go b/internal/command/providers_schema.go index 0d51769133d3..919e1a57078c 100644 --- a/internal/command/providers_schema.go +++ b/internal/command/providers_schema.go @@ -107,7 +107,7 @@ func (c *ProvidersSchemaCommand) Run(args []string) int { return 1 } - jsonSchemas, err := jsonprovider.Marshal(schemas, c.AllowExperimentalFeatures) + jsonSchemas, err := jsonprovider.Marshal(schemas) if err != nil { c.Ui.Error(fmt.Sprintf("Failed to marshal provider schemas to json: %s", err)) return 1 diff --git a/internal/command/query.go b/internal/command/query.go index 6e1d00d73097..5faf2f0616d8 100644 --- a/internal/command/query.go +++ b/internal/command/query.go @@ -75,6 +75,7 @@ func (c *QueryCommand) Run(rawArgs []string) int { // migrated to views. c.Meta.color = !common.NoColor c.Meta.Color = c.Meta.color + c.Meta.includeQueryFiles = true // Parse and validate flags args, diags := arguments.ParseQuery(rawArgs) diff --git a/internal/command/query_test.go b/internal/command/query_test.go index 864194988f5e..36e048456d3d 100644 --- a/internal/command/query_test.go +++ b/internal/command/query_test.go @@ -80,7 +80,7 @@ configuration file (.tfquery.hcl file) and try again. name: "invalid query syntax", directory: "invalid-syntax", expectedOut: "", - initCode: 1, + initCode: 0, expectedErr: []string{` Error: Unsupported block type @@ -173,21 +173,6 @@ value. Use a -var or -var-file command line argument to provide a value for this variable. `}, }, - { - name: "error - duplicate variable across .tf and .tfquery files", - directory: "duplicate-variables", - expectedOut: "", - expectedErr: []string{` -Error: Duplicate variable declaration - - on query.tfquery.hcl line 2: - 2: variable "instance_name" { - -A variable named "instance_name" was already declared at main.tf:15,1-25. -Variable names must be unique within a module. -`}, - initCode: 1, - }, } for _, ts := range tests { diff --git a/internal/command/state_show.go b/internal/command/state_show.go index 4ef3bd80977c..b76d398ccd45 100644 --- a/internal/command/state_show.go +++ b/internal/command/state_show.go @@ -155,7 +155,7 @@ func (c *StateShowCommand) Run(args []string) int { ProviderFormatVersion: jsonprovider.FormatVersion, RootModule: root, RootModuleOutputs: outputs, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), } renderer := jsonformat.Renderer{ diff --git a/internal/command/views/operation.go b/internal/command/views/operation.go index ae9beca1b190..3b132991f9fa 100644 --- a/internal/command/views/operation.go +++ b/internal/command/views/operation.go @@ -110,7 +110,7 @@ func (v *OperationHuman) Plan(plan *plans.Plan, schemas *terraform.Schemas) { OutputChanges: outputs, ResourceChanges: changed, ResourceDrift: drift, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), RelevantAttributes: attrs, ActionInvocations: actions, } diff --git a/internal/command/views/show.go b/internal/command/views/show.go index 50429aa315f8..7eb76bf17e3d 100644 --- a/internal/command/views/show.go +++ b/internal/command/views/show.go @@ -83,7 +83,7 @@ func (v *ShowHuman) Display(config *configs.Config, plan *plans.Plan, planJSON * OutputChanges: outputs, ResourceChanges: changed, ResourceDrift: drift, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), RelevantAttributes: attrs, ActionInvocations: actions, } @@ -113,7 +113,7 @@ func (v *ShowHuman) Display(config *configs.Config, plan *plans.Plan, planJSON * ProviderFormatVersion: jsonprovider.FormatVersion, RootModule: root, RootModuleOutputs: outputs, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), } renderer.RenderHumanState(jstate) diff --git a/internal/command/views/test.go b/internal/command/views/test.go index 0feb2bab780d..e95e6afdc62a 100644 --- a/internal/command/views/test.go +++ b/internal/command/views/test.go @@ -203,7 +203,7 @@ func (t *TestHuman) Run(run *moduletest.Run, file *moduletest.File, progress mod ProviderFormatVersion: jsonprovider.FormatVersion, RootModule: root, RootModuleOutputs: outputs, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), } t.view.streams.Println() // Separate the state from any previous statements. @@ -225,7 +225,7 @@ func (t *TestHuman) Run(run *moduletest.Run, file *moduletest.File, progress mod OutputChanges: outputs, ResourceChanges: changed, ResourceDrift: drift, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), RelevantAttributes: attrs, ActionInvocations: actions, } @@ -568,7 +568,7 @@ func (t *TestJSON) Run(run *moduletest.Run, file *moduletest.File, progress modu ProviderFormatVersion: jsonprovider.FormatVersion, RootModule: root, RootModuleOutputs: outputs, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), } t.view.log.Info( @@ -592,7 +592,7 @@ func (t *TestJSON) Run(run *moduletest.Run, file *moduletest.File, progress modu OutputChanges: outputs, ResourceChanges: changed, ResourceDrift: drift, - ProviderSchemas: jsonprovider.MarshalForRenderer(schemas, false), + ProviderSchemas: jsonprovider.MarshalForRenderer(schemas), RelevantAttributes: attrs, ActionInvocations: actions, } diff --git a/internal/configs/config_build_test.go b/internal/configs/config_build_test.go index 496d03b2492b..1537de6e62cc 100644 --- a/internal/configs/config_build_test.go +++ b/internal/configs/config_build_test.go @@ -227,7 +227,12 @@ func TestBuildConfigInvalidModules(t *testing.T) { path := filepath.Join(testDir, name) parser.AllowLanguageExperiments(true) - mod, diags := parser.LoadConfigDirWithTests(path, "tests") + opts := []Option{MatchTestFiles("tests")} + if name == "list-in-child-module" { + opts = append(opts, MatchQueryFiles()) + } + + mod, diags := parser.LoadConfigDir(path, opts...) if diags.HasErrors() { // these tests should only trigger errors that are caught in // the config loader. @@ -265,7 +270,7 @@ func TestBuildConfigInvalidModules(t *testing.T) { // for simplicity, these tests will treat all source // addresses as relative to the root module sourcePath := filepath.Join(path, req.SourceAddr.String()) - mod, diags := parser.LoadConfigDir(sourcePath) + mod, diags := parser.LoadConfigDir(sourcePath, opts...) version, _ := version.NewVersion("1.0.0") return mod, version, diags }), diff --git a/internal/configs/configload/loader.go b/internal/configs/configload/loader.go index 07d68b30dd7e..07dfff0db6dd 100644 --- a/internal/configs/configload/loader.go +++ b/internal/configs/configload/loader.go @@ -27,6 +27,8 @@ type Loader struct { // modules is used to install and locate descendant modules that are // referenced (directly or indirectly) from the root module. modules moduleMgr + + parserOpts []configs.Option } // Config is used with NewLoader to specify configuration arguments for the @@ -43,6 +45,10 @@ type Config struct { // not supported, which should be true only in specialized circumstances // such as in tests. Services *disco.Disco + + // IncludeQueryFiles is set to true if query files should be parsed + // when running query commands. + IncludeQueryFiles bool } // NewLoader creates and returns a loader that reads configuration from the @@ -65,6 +71,7 @@ func NewLoader(config *Config) (*Loader, error) { Services: config.Services, Registry: reg, }, + parserOpts: make([]configs.Option, 0), } err := ret.modules.readModuleManifestSnapshot() @@ -72,6 +79,10 @@ func NewLoader(config *Config) (*Loader, error) { return nil, fmt.Errorf("failed to read module manifest: %s", err) } + if config.IncludeQueryFiles { + ret.parserOpts = append(ret.parserOpts, configs.MatchQueryFiles()) + } + return ret, nil } @@ -122,7 +133,7 @@ func (l *Loader) Sources() map[string][]byte { // least one Terraform configuration file. This is a wrapper around calling // the same method name on the loader's parser. func (l *Loader) IsConfigDir(path string) bool { - return l.parser.IsConfigDir(path) + return l.parser.IsConfigDir(path, l.parserOpts...) } // ImportSources writes into the receiver's source code map the given source diff --git a/internal/configs/configload/loader_load.go b/internal/configs/configload/loader_load.go index f7b776b86082..3b9407a32b6c 100644 --- a/internal/configs/configload/loader_load.go +++ b/internal/configs/configload/loader_load.go @@ -22,14 +22,14 @@ import ( // // LoadConfig performs the basic syntax and uniqueness validations that are // required to process the individual modules -func (l *Loader) LoadConfig(rootDir string, parserOpts ...configs.Option) (*configs.Config, hcl.Diagnostics) { - return l.loadConfig(l.parser.LoadConfigDir(rootDir, parserOpts...)) +func (l *Loader) LoadConfig(rootDir string) (*configs.Config, hcl.Diagnostics) { + return l.loadConfig(l.parser.LoadConfigDir(rootDir, l.parserOpts...)) } // LoadConfigWithTests matches LoadConfig, except the configs.Config contains // any relevant .tftest.hcl files. func (l *Loader) LoadConfigWithTests(rootDir string, testDir string) (*configs.Config, hcl.Diagnostics) { - return l.loadConfig(l.parser.LoadConfigDirWithTests(rootDir, testDir)) + return l.loadConfig(l.parser.LoadConfigDir(rootDir, append(l.parserOpts, configs.MatchTestFiles(testDir))...)) } func (l *Loader) loadConfig(rootMod *configs.Module, diags hcl.Diagnostics) (*configs.Config, hcl.Diagnostics) { diff --git a/internal/configs/configload/loader_snapshot.go b/internal/configs/configload/loader_snapshot.go index d8260cddd7ca..46efab362c6e 100644 --- a/internal/configs/configload/loader_snapshot.go +++ b/internal/configs/configload/loader_snapshot.go @@ -24,7 +24,7 @@ import ( // creates an in-memory snapshot of the configuration files used, which can // be later used to create a loader that may read only from this snapshot. func (l *Loader) LoadConfigWithSnapshot(rootDir string) (*configs.Config, *Snapshot, hcl.Diagnostics) { - rootMod, diags := l.parser.LoadConfigDir(rootDir) + rootMod, diags := l.parser.LoadConfigDir(rootDir, l.parserOpts...) if rootMod == nil { return nil, nil, diags } diff --git a/internal/configs/configload/testing.go b/internal/configs/configload/testing.go index bc90b2ef3cbc..537e86ac2c54 100644 --- a/internal/configs/configload/testing.go +++ b/internal/configs/configload/testing.go @@ -4,9 +4,10 @@ package configload import ( - "io/ioutil" "os" "testing" + + "github.com/hashicorp/terraform/internal/configs" ) // NewLoaderForTests is a variant of NewLoader that is intended to be more @@ -20,10 +21,10 @@ import ( // In the case of any errors, t.Fatal (or similar) will be called to halt // execution of the test, so the calling test does not need to handle errors // itself. -func NewLoaderForTests(t testing.TB) (*Loader, func()) { +func NewLoaderForTests(t testing.TB, parserOpts ...configs.Option) (*Loader, func()) { t.Helper() - modulesDir, err := ioutil.TempDir("", "tf-configs") + modulesDir, err := os.MkdirTemp("", "tf-configs") if err != nil { t.Fatalf("failed to create temporary modules dir: %s", err) return nil, func() {} @@ -36,6 +37,7 @@ func NewLoaderForTests(t testing.TB) (*Loader, func()) { loader, err := NewLoader(&Config{ ModulesDir: modulesDir, }) + loader.parserOpts = append(loader.parserOpts, parserOpts...) if err != nil { cleanup() t.Fatalf("failed to create config loader: %s", err) diff --git a/internal/configs/parser_config_dir.go b/internal/configs/parser_config_dir.go index 9c296bc01323..a4c220febc8e 100644 --- a/internal/configs/parser_config_dir.go +++ b/internal/configs/parser_config_dir.go @@ -153,8 +153,8 @@ func (p Parser) ConfigDirFiles(dir string, opts ...Option) (primary, override [] // exists and contains at least one Terraform config file (with a .tf or // .tf.json extension.). Note, we explicitely exclude checking for tests here // as tests must live alongside actual .tf config files. Same goes for query files. -func (p *Parser) IsConfigDir(path string) bool { - pathSet, _ := p.dirFileSet(path) +func (p *Parser) IsConfigDir(path string, opts ...Option) bool { + pathSet, _ := p.dirFileSet(path, opts...) return (len(pathSet.Primary) + len(pathSet.Override)) > 0 } diff --git a/internal/configs/parser_config_dir_test.go b/internal/configs/parser_config_dir_test.go index b1921a794ece..2fe176ca6822 100644 --- a/internal/configs/parser_config_dir_test.go +++ b/internal/configs/parser_config_dir_test.go @@ -167,27 +167,23 @@ func TestParserLoadConfigDirWithQueries(t *testing.T) { diagnostics []string listResources int managedResources int - allowExperiments bool }{ { - name: "simple", - directory: "testdata/query-files/valid/simple", - listResources: 3, - allowExperiments: true, + name: "simple", + directory: "testdata/query-files/valid/simple", + listResources: 3, }, { name: "mixed", directory: "testdata/query-files/valid/mixed", listResources: 3, managedResources: 1, - allowExperiments: true, }, { name: "loading query lists with no-experiments", directory: "testdata/query-files/valid/mixed", managedResources: 1, - listResources: 0, - allowExperiments: false, + listResources: 3, }, { name: "no-provider", @@ -195,7 +191,6 @@ func TestParserLoadConfigDirWithQueries(t *testing.T) { diagnostics: []string{ "testdata/query-files/invalid/no-provider/main.tfquery.hcl:1,1-27: Missing \"provider\" attribute; You must specify a provider attribute when defining a list block.", }, - allowExperiments: true, }, { name: "with-depends-on", @@ -203,16 +198,14 @@ func TestParserLoadConfigDirWithQueries(t *testing.T) { diagnostics: []string{ "testdata/query-files/invalid/with-depends-on/main.tfquery.hcl:23,3-13: Unsupported argument; An argument named \"depends_on\" is not expected here.", }, - listResources: 2, - allowExperiments: true, + listResources: 2, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { parser := NewParser(nil) - parser.AllowLanguageExperiments(test.allowExperiments) - mod, diags := parser.LoadConfigDir(test.directory) + mod, diags := parser.LoadConfigDir(test.directory, MatchQueryFiles()) if len(test.diagnostics) > 0 { if !diags.HasErrors() { t.Errorf("expected errors, but found none") diff --git a/internal/configs/parser_file_matcher.go b/internal/configs/parser_file_matcher.go index cb282a1a7d35..6644b421ee6c 100644 --- a/internal/configs/parser_file_matcher.go +++ b/internal/configs/parser_file_matcher.go @@ -64,9 +64,6 @@ func (p *Parser) dirFileSet(dir string, opts ...Option) (ConfigFileSet, hcl.Diag testDirectory: DefaultTestDirectory, fs: p.fs, } - if p.AllowsLanguageExperiments() { - cfg.matchers = append(cfg.matchers, &queryFiles{}) - } for _, opt := range opts { opt(cfg) } @@ -142,6 +139,13 @@ func MatchTestFiles(dir string) Option { } } +// MatchQueryFiles adds a matcher for Terraform query files (.tfquery.hcl and .tfquery.json) +func MatchQueryFiles() Option { + return func(o *parserConfig) { + o.matchers = append(o.matchers, &queryFiles{}) + } +} + // moduleFiles matches regular Terraform configuration files (.tf and .tf.json) type moduleFiles struct{} diff --git a/internal/initwd/testing.go b/internal/initwd/testing.go index 8c99778e1c6b..4331529131da 100644 --- a/internal/initwd/testing.go +++ b/internal/initwd/testing.go @@ -53,7 +53,7 @@ func LoadConfigForTests(t *testing.T, rootDir string, testsDir string) (*configs t.Fatalf("failed to refresh modules after installation: %s", err) } - config, hclDiags := loader.LoadConfig(rootDir, configs.MatchTestFiles(testsDir)) + config, hclDiags := loader.LoadConfigWithTests(rootDir, testsDir) diags = diags.Append(hclDiags) return config, loader, cleanup, diags } diff --git a/internal/terraform/terraform_test.go b/internal/terraform/terraform_test.go index e6e9dc8d077d..a988d30fc6f4 100644 --- a/internal/terraform/terraform_test.go +++ b/internal/terraform/terraform_test.go @@ -97,6 +97,8 @@ func testModuleInline(t testing.TB, sources map[string]string) *configs.Config { t.Fatal(err) } + var queryOpt configs.Option + for path, configStr := range sources { dir := filepath.Dir(path) if dir != "." { @@ -116,9 +118,18 @@ func testModuleInline(t testing.TB, sources map[string]string) *configs.Config { if err != nil { t.Fatalf("Error creating temporary file for config: %s", err) } + + if strings.HasSuffix(path, "tfquery.hcl") || strings.HasSuffix(path, "tfquery.json") { + queryOpt = configs.MatchQueryFiles() + } + } + + var parserOpts []configs.Option + if queryOpt != nil { + parserOpts = append(parserOpts, queryOpt) } - loader, cleanup := configload.NewLoaderForTests(t) + loader, cleanup := configload.NewLoaderForTests(t, parserOpts...) defer cleanup() // We need to be able to exercise experimental features in our integration tests. @@ -139,7 +150,7 @@ func testModuleInline(t testing.TB, sources map[string]string) *configs.Config { t.Fatalf("failed to refresh modules after installation: %s", err) } - config, diags := loader.LoadConfig(cfgPath, configs.MatchTestFiles("tests")) + config, diags := loader.LoadConfigWithTests(cfgPath, "tests") if diags.HasErrors() { t.Fatal(diags.Error()) } diff --git a/internal/tfdiags/object.go b/internal/tfdiags/object.go index 56da886c67e7..8fb115673e3d 100644 --- a/internal/tfdiags/object.go +++ b/internal/tfdiags/object.go @@ -4,6 +4,7 @@ package tfdiags import ( "fmt" + "slices" "strings" "github.com/zclconf/go-cty/cty" @@ -23,29 +24,39 @@ func ObjectToString(obj cty.Value) string { return "" } - if obj.Type().IsObjectType() { - result := "" - it := obj.ElementIterator() - for it.Next() { - key, val := it.Element() - keyStr := key.AsString() + if !obj.Type().IsObjectType() { + panic("not an object") + } - if result != "" { - result += "," - } + it := obj.ElementIterator() + keys := make([]string, 0, obj.LengthInt()) + objMap := make(map[string]cty.Value) + result := "" + // store the keys for the object, and sort them + // before appending to the result so that the final value is deterministic. + for it.Next() { + key, val := it.Element() + keyStr := key.AsString() + keys = append(keys, keyStr) + objMap[keyStr] = val + } - if val.IsNull() { - result += fmt.Sprintf("%s=", keyStr) - continue - } + slices.Sort(keys) + for _, key := range keys { + val := objMap[key] + if result != "" { + result += "," + } - result += fmt.Sprintf("%s=%s", keyStr, ValueToString(val)) + if val.IsNull() { + result += fmt.Sprintf("%s=", key) + continue } - return result + result += fmt.Sprintf("%s=%s", key, ValueToString(val)) } - panic("not an object") + return result } func ValueToString(val cty.Value) string { From 15a6cd208ba74fbaeb5431c0d277b10998020203 Mon Sep 17 00:00:00 2001 From: Liam Cervante Date: Fri, 19 Sep 2025 10:22:03 +0200 Subject: [PATCH 03/27] stacks: fix diagnostic referring to tfstacks command (#37639) --- .../stacks/stackruntime/internal/stackeval/provider_config.go | 2 +- internal/stacks/stackruntime/validate_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/stacks/stackruntime/internal/stackeval/provider_config.go b/internal/stacks/stackruntime/internal/stackeval/provider_config.go index ff8a7915ce55..dd6c44cf7adb 100644 --- a/internal/stacks/stackruntime/internal/stackeval/provider_config.go +++ b/internal/stacks/stackruntime/internal/stackeval/provider_config.go @@ -86,7 +86,7 @@ func CheckProviderInLockfile(locks depsfile.Locks, providerType *ProviderType, d Severity: hcl.DiagError, Summary: "Provider missing from lockfile", Detail: fmt.Sprintf( - "Provider %q is not in the lockfile. This provider must be in the lockfile to be used in the configuration. Please run `tfstacks providers lock` to update the lockfile and run this operation again with an updated configuration.", + "Provider %q is not in the lockfile. This provider must be in the lockfile to be used in the configuration. Please run `terraform stacks providers lock` to update the lockfile and run this operation again with an updated configuration.", providerType.Addr(), ), Subject: declRange, diff --git a/internal/stacks/stackruntime/validate_test.go b/internal/stacks/stackruntime/validate_test.go index afcf02aa8403..a88e0b58d74d 100644 --- a/internal/stacks/stackruntime/validate_test.go +++ b/internal/stacks/stackruntime/validate_test.go @@ -478,7 +478,7 @@ Terraform uses references to decide a suitable order for performing operations, return diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: "Provider missing from lockfile", - Detail: "Provider \"registry.terraform.io/hashicorp/testing\" is not in the lockfile. This provider must be in the lockfile to be used in the configuration. Please run `tfstacks providers lock` to update the lockfile and run this operation again with an updated configuration.", + Detail: "Provider \"registry.terraform.io/hashicorp/testing\" is not in the lockfile. This provider must be in the lockfile to be used in the configuration. Please run `terraform stacks providers lock` to update the lockfile and run this operation again with an updated configuration.", Subject: &hcl.Range{ Filename: "git::https://example.com/test.git//with-single-input/input-from-component/input-from-component.tfcomponent.hcl", Start: hcl.Pos{Line: 8, Column: 1, Byte: 98}, From 0dfa115d7d3d40cffbf778fba7618863ac911e49 Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Fri, 19 Sep 2025 12:42:13 +0100 Subject: [PATCH 04/27] First step to enable use of TF_REATTACH_PROVIDERS with PSS (#37634) * Add test coverage for `parseReattachProviders` * Add unhappy path test cases to parseReattachProviders test * Add `isProviderReattached` function, to help identify when a reattached provider is being used for PSS * Move reattach config-related code into its own package * Make calling code not need to know what the ENV is for reattach providers * Refactor IsProviderReattached to use pre-existing logic * Add test case, make spell check happy with US English * Add headers * Make calling code responsible for reading in the related ENV * Add godoc comment to TF_REATTACH_PROVIDERS const * Update internal/getproviders/reattach/reattach.go --- internal/getproviders/reattach/reattach.go | 99 ++++++ .../getproviders/reattach/reattach_test.go | 288 ++++++++++++++++++ main.go | 58 +--- 3 files changed, 389 insertions(+), 56 deletions(-) create mode 100644 internal/getproviders/reattach/reattach.go create mode 100644 internal/getproviders/reattach/reattach_test.go diff --git a/internal/getproviders/reattach/reattach.go b/internal/getproviders/reattach/reattach.go new file mode 100644 index 000000000000..2b351a020855 --- /dev/null +++ b/internal/getproviders/reattach/reattach.go @@ -0,0 +1,99 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package reattach + +import ( + "encoding/json" + "fmt" + "net" + + "github.com/hashicorp/go-plugin" + "github.com/hashicorp/terraform/internal/addrs" +) + +// TF_REATTACH_PROVIDERS is JSON string, containing a map of provider source to reattachment config. +// +// E.g this corresponds to a provider with source 'registry.terraform.io/hashicorp/foobar': +/* +{ +"foobar": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String":"/var/folders/xx/abcde12345/T/plugin12345" + } +} +*/ +const TF_REATTACH_PROVIDERS = "TF_REATTACH_PROVIDERS" + +// ParseReattachProviders parses information used for reattaching to unmanaged providers out of a +// JSON-encoded environment variable (TF_REATTACH_PROVIDERS). +// +// Calling code is expected to pass in the value of os.Getenv("TF_REATTACH_PROVIDERS") +func ParseReattachProviders(in string) (map[addrs.Provider]*plugin.ReattachConfig, error) { + unmanagedProviders := map[addrs.Provider]*plugin.ReattachConfig{} + if in != "" { + type reattachConfig struct { + Protocol string + ProtocolVersion int + Addr struct { + Network string + String string + } + Pid int + Test bool + } + var m map[string]reattachConfig + err := json.Unmarshal([]byte(in), &m) + if err != nil { + return unmanagedProviders, fmt.Errorf("Invalid format for %s: %w", TF_REATTACH_PROVIDERS, err) + } + for p, c := range m { + a, diags := addrs.ParseProviderSourceString(p) + if diags.HasErrors() { + return unmanagedProviders, fmt.Errorf("Error parsing %q as a provider address: %w", a, diags.Err()) + } + var addr net.Addr + switch c.Addr.Network { + case "unix": + addr, err = net.ResolveUnixAddr("unix", c.Addr.String) + if err != nil { + return unmanagedProviders, fmt.Errorf("Invalid unix socket path %q for %q: %w", c.Addr.String, p, err) + } + case "tcp": + addr, err = net.ResolveTCPAddr("tcp", c.Addr.String) + if err != nil { + return unmanagedProviders, fmt.Errorf("Invalid TCP address %q for %q: %w", c.Addr.String, p, err) + } + default: + return unmanagedProviders, fmt.Errorf("Unknown address type %q for %q", c.Addr.Network, p) + } + unmanagedProviders[a] = &plugin.ReattachConfig{ + Protocol: plugin.Protocol(c.Protocol), + ProtocolVersion: c.ProtocolVersion, + Pid: c.Pid, + Test: c.Test, + Addr: addr, + } + } + } + return unmanagedProviders, nil +} + +// IsProviderReattached determines if a given provider is being supplied to Terraform via the TF_REATTACH_PROVIDERS +// environment variable. +// +// Calling code is expected to pass in a provider address and the value of os.Getenv("TF_REATTACH_PROVIDERS") +func IsProviderReattached(provider addrs.Provider, in string) (bool, error) { + providers, err := ParseReattachProviders(in) + if err != nil { + return false, err + } + + _, ok := providers[provider] + return ok, nil +} diff --git a/internal/getproviders/reattach/reattach_test.go b/internal/getproviders/reattach/reattach_test.go new file mode 100644 index 000000000000..bbd9f2e3bc21 --- /dev/null +++ b/internal/getproviders/reattach/reattach_test.go @@ -0,0 +1,288 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package reattach + +import ( + "net" + "testing" + + "github.com/google/go-cmp/cmp" + "github.com/hashicorp/go-plugin" + tfaddr "github.com/hashicorp/terraform-registry-address" + "github.com/hashicorp/terraform/internal/addrs" +) + +func Test_parseReattachProviders(t *testing.T) { + cases := map[string]struct { + reattachProviders string + expectedOutput map[addrs.Provider]*plugin.ReattachConfig + expectErr bool + }{ + "simple parse - 1 provider": { + reattachProviders: `{ + "test": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String":"/var/folders/xx/abcde12345/T/plugin12345" + } + } + }`, + expectedOutput: map[addrs.Provider]*plugin.ReattachConfig{ + tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test"): func() *plugin.ReattachConfig { + addr, err := net.ResolveUnixAddr("unix", "/var/folders/xx/abcde12345/T/plugin12345") + if err != nil { + t.Fatal(err) + } + return &plugin.ReattachConfig{ + Protocol: plugin.Protocol("grpc"), + ProtocolVersion: 6, + Pid: 12345, + Test: true, + Addr: addr, + } + }(), + }, + }, + "complex parse - 2 providers via different protocols etc": { + reattachProviders: `{ + "test-grpc": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String": "/var/folders/xx/abcde12345/T/plugin12345" + } + }, + "test-netrpc": { + "Protocol": "netrpc", + "ProtocolVersion": 5, + "Pid": 6789, + "Test": false, + "Addr": { + "Network": "tcp", + "String":"127.0.0.1:1337" + } + } + }`, + expectedOutput: map[addrs.Provider]*plugin.ReattachConfig{ + //test-grpc + tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test-grpc"): func() *plugin.ReattachConfig { + addr, err := net.ResolveUnixAddr("unix", "/var/folders/xx/abcde12345/T/plugin12345") + if err != nil { + t.Fatal(err) + } + return &plugin.ReattachConfig{ + Protocol: plugin.Protocol("grpc"), + ProtocolVersion: 6, + Pid: 12345, + Test: true, + Addr: addr, + } + }(), + //test-netrpc + tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test-netrpc"): func() *plugin.ReattachConfig { + addr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:1337") + if err != nil { + t.Fatal(err) + } + return &plugin.ReattachConfig{ + Protocol: plugin.Protocol("netrpc"), + ProtocolVersion: 5, + Pid: 6789, + Test: false, + Addr: addr, + } + }(), + }, + }, + "can specify the providers host and namespace": { + // The key here has host and namespace data, vs. just "test" + reattachProviders: `{ + "example.com/my-org/test": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String":"/var/folders/xx/abcde12345/T/plugin12345" + } + } + }`, + expectedOutput: map[addrs.Provider]*plugin.ReattachConfig{ + tfaddr.NewProvider("example.com", "my-org", "test"): func() *plugin.ReattachConfig { + addr, err := net.ResolveUnixAddr("unix", "/var/folders/xx/abcde12345/T/plugin12345") + if err != nil { + t.Fatal(err) + } + return &plugin.ReattachConfig{ + Protocol: plugin.Protocol("grpc"), + ProtocolVersion: 6, + Pid: 12345, + Test: true, + Addr: addr, + } + }(), + }, + }, + "error - bad JSON": { + // Missing closing brace + reattachProviders: `{ + "test": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String":"/var/folders/xx/abcde12345/T/plugin12345" + } + } + `, + expectErr: true, + }, + "error - bad provider address": { + reattachProviders: `{ + "bad provider addr": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String":"/var/folders/xx/abcde12345/T/plugin12345" + } + } + }`, + expectErr: true, + }, + "error - unrecognized protocol": { + reattachProviders: `{ + "test": { + "Protocol": "carrier-pigeon", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "pigeon", + "String":"fly home little pigeon" + } + } + }`, + expectErr: true, + }, + "error - unrecognized network": { + reattachProviders: `{ + "test": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "linkedin", + "String":"http://www.linkedin.com/" + } + } + }`, + expectErr: true, + }, + "error - bad tcp address": { + // Addr.String has no port at the end + reattachProviders: `{ + "test": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "tcp", + "String":"127.0.0.1" + } + } + }`, + expectErr: true, + }, + } + + for tn, tc := range cases { + t.Run(tn, func(t *testing.T) { + output, err := ParseReattachProviders(tc.reattachProviders) + if err != nil { + if !tc.expectErr { + t.Fatal(err) + } + // an expected error occurred + return + } + if err == nil && tc.expectErr { + t.Fatal("expected error but there was none") + } + if diff := cmp.Diff(output, tc.expectedOutput); diff != "" { + t.Fatalf("expected diff:\n%s", diff) + } + }) + } +} + +func Test_isProviderReattached(t *testing.T) { + cases := map[string]struct { + provider addrs.Provider + reattachProviders string + expectedOutput bool + }{ + "identifies when a matching provider is present in TF_REATTACH_PROVIDERS": { + // Note that the source in the TF_REATTACH_PROVIDERS value is just the provider name. + // It'll be assumed to be under the default registry host and in the 'hashicorp' namespace. + reattachProviders: `{ + "test": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String":"/var/folders/xx/abcde12345/T/plugin12345" + } + } + }`, + provider: tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test"), + expectedOutput: true, + }, + "identifies when a provider doesn't have a match in TF_REATTACH_PROVIDERS": { + // Note the mismatch on namespace + reattachProviders: `{ + "hashicorp/test": { + "Protocol": "grpc", + "ProtocolVersion": 6, + "Pid": 12345, + "Test": true, + "Addr": { + "Network": "unix", + "String":"/var/folders/xx/abcde12345/T/plugin12345" + } + } + }`, + provider: tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "dadgarcorp", "test"), + expectedOutput: false, + }, + } + + for tn, tc := range cases { + t.Run(tn, func(t *testing.T) { + output, err := IsProviderReattached(tc.provider, tc.reattachProviders) + if err != nil { + t.Fatal(err) + } + if output != tc.expectedOutput { + t.Fatalf("expected returned value to be %v, got %v", tc.expectedOutput, output) + } + }) + } +} diff --git a/main.go b/main.go index cce3f5f998ad..fd4d88f137e6 100644 --- a/main.go +++ b/main.go @@ -5,10 +5,8 @@ package main import ( "context" - "encoding/json" "fmt" "log" - "net" "os" "path/filepath" "runtime" @@ -18,10 +16,10 @@ import ( "github.com/hashicorp/cli" "github.com/hashicorp/go-plugin" "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/command/cliconfig" "github.com/hashicorp/terraform/internal/command/format" "github.com/hashicorp/terraform/internal/didyoumean" + "github.com/hashicorp/terraform/internal/getproviders/reattach" "github.com/hashicorp/terraform/internal/httpclient" "github.com/hashicorp/terraform/internal/logging" "github.com/hashicorp/terraform/internal/terminal" @@ -204,7 +202,7 @@ func realMain() int { // The user can declare that certain providers are being managed on // Terraform's behalf using this environment variable. This is used // primarily by the SDK's acceptance testing framework. - unmanagedProviders, err := parseReattachProviders(os.Getenv("TF_REATTACH_PROVIDERS")) + unmanagedProviders, err := reattach.ParseReattachProviders(os.Getenv(reattach.TF_REATTACH_PROVIDERS)) if err != nil { Ui.Error(err.Error()) return 1 @@ -402,58 +400,6 @@ func mergeEnvArgs(envName string, cmd string, args []string) ([]string, error) { return newArgs, nil } -// parse information on reattaching to unmanaged providers out of a -// JSON-encoded environment variable. -func parseReattachProviders(in string) (map[addrs.Provider]*plugin.ReattachConfig, error) { - unmanagedProviders := map[addrs.Provider]*plugin.ReattachConfig{} - if in != "" { - type reattachConfig struct { - Protocol string - ProtocolVersion int - Addr struct { - Network string - String string - } - Pid int - Test bool - } - var m map[string]reattachConfig - err := json.Unmarshal([]byte(in), &m) - if err != nil { - return unmanagedProviders, fmt.Errorf("Invalid format for TF_REATTACH_PROVIDERS: %w", err) - } - for p, c := range m { - a, diags := addrs.ParseProviderSourceString(p) - if diags.HasErrors() { - return unmanagedProviders, fmt.Errorf("Error parsing %q as a provider address: %w", a, diags.Err()) - } - var addr net.Addr - switch c.Addr.Network { - case "unix": - addr, err = net.ResolveUnixAddr("unix", c.Addr.String) - if err != nil { - return unmanagedProviders, fmt.Errorf("Invalid unix socket path %q for %q: %w", c.Addr.String, p, err) - } - case "tcp": - addr, err = net.ResolveTCPAddr("tcp", c.Addr.String) - if err != nil { - return unmanagedProviders, fmt.Errorf("Invalid TCP address %q for %q: %w", c.Addr.String, p, err) - } - default: - return unmanagedProviders, fmt.Errorf("Unknown address type %q for %q", c.Addr.Network, p) - } - unmanagedProviders[a] = &plugin.ReattachConfig{ - Protocol: plugin.Protocol(c.Protocol), - ProtocolVersion: c.ProtocolVersion, - Pid: c.Pid, - Test: c.Test, - Addr: addr, - } - } - } - return unmanagedProviders, nil -} - func extractChdirOption(args []string) (string, []string, error) { if len(args) == 0 { return "", args, nil From e241e1ace1571058e7b571d27c2898dcbde2f962 Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Fri, 19 Sep 2025 08:54:30 -0400 Subject: [PATCH 05/27] actions: return an error if config is omitted but the schema has required attrs (#37626) * actions: improve handling of null config so we can properly report missing required arguments There are various methods in terraform that will let you know if you are missing required attributes - none of which work with nil inputs. This commit changes the handling, passing in an empty object if the config was null, and adding additional context to the error message when the config block is missing. --- internal/terraform/context_validate_test.go | 172 +++++++++++++------- internal/terraform/node_action_abstract.go | 5 +- internal/terraform/node_action_validate.go | 24 ++- 3 files changed, 135 insertions(+), 66 deletions(-) diff --git a/internal/terraform/context_validate_test.go b/internal/terraform/context_validate_test.go index 67beadb889fc..9344bbc0bfd8 100644 --- a/internal/terraform/context_validate_test.go +++ b/internal/terraform/context_validate_test.go @@ -3575,60 +3575,114 @@ func TestContext2Validate_queryList(t *testing.T) { // Action Validation is largely exercised in context_plan_actions_test.go func TestContext2Validate_action(t *testing.T) { tests := map[string]struct { - config string - wantErr string + config string + wantErr string + expectValidateCalled bool }{ "valid config": { ` -terraform { - required_providers { - test = { - source = "hashicorp/test" - version = "1.0.0" + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + action "test_register" "foo" { + config { + host = "cmdb.snot" + } + } + resource "test_instance" "foo" { + lifecycle { + action_trigger { + events = [after_create] + actions = [action.test_register.foo] + } + } + } + `, + "", + true, + }, + "validly null config": { // this doesn't seem likely, but let's make sure nothing panics. + ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } } - } -} -action "test_register" "foo" { - config { - host = "cmdb.snot" - } -} -resource "test_instance" "foo" { - lifecycle { - action_trigger { - events = [after_create] - actions = [action.test_register.foo] - } - } -} -`, + action "test_other" "foo" { + } + resource "test_instance" "foo" { + lifecycle { + action_trigger { + events = [after_create] + actions = [action.test_other.foo] + } + } + } + `, "", + true, }, "missing required config": { ` -terraform { - required_providers { - test = { - source = "hashicorp/test" - version = "1.0.0" + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } } - } -} -action "test_register" "foo" { - config {} -} -resource "test_instance" "foo" { - lifecycle { - action_trigger { - events = [after_create] - actions = [action.test_register.foo] - } - } -} -`, - "host is null", + action "test_register" "foo" { + config {} + } + resource "test_instance" "foo" { + lifecycle { + action_trigger { + events = [after_create] + actions = [action.test_register.foo] + } + } + } + `, + "Missing required argument: The argument \"host\" is required, but no definition was found.", + false, + }, + "invalid required config (provider validation)": { + ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + action "test_register" "foo" { + config { + host = "invalid" + } + } + resource "test_instance" "foo" { + lifecycle { + action_trigger { + events = [after_create] + actions = [action.test_register.foo] + } + } + } + `, + "Invalid value for required argument \"host\" because I said so", + true, }, - "invalid nil config config": { + "invalid nil config": { ` terraform { required_providers { @@ -3649,7 +3703,8 @@ resource "test_instance" "foo" { } } `, - "config is null", + "Missing required argument: The argument \"host\" is required, but was not set.", + false, }, } @@ -3669,6 +3724,14 @@ resource "test_instance" "foo" { }, Actions: map[string]*providers.ActionSchema{ "test_register": { + ConfigSchema: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "host": {Type: cty.String, Required: true}, + "output": {Type: cty.String, Computed: true, Optional: true}, + }, + }, + }, + "test_other": { ConfigSchema: &configschema.Block{ Attributes: map[string]*configschema.Attribute{ "host": {Type: cty.String, Optional: true}, @@ -3678,12 +3741,8 @@ resource "test_instance" "foo" { }, }) p.ValidateActionConfigFn = func(r providers.ValidateActionConfigRequest) (resp providers.ValidateActionConfigResponse) { - if r.Config.IsNull() { - resp.Diagnostics = resp.Diagnostics.Append(errors.New("config is null")) - return - } - if r.Config.GetAttr("host").IsNull() { - resp.Diagnostics = resp.Diagnostics.Append(errors.New("host is null")) + if r.Config.GetAttr("host") == cty.StringVal("invalid") { + resp.Diagnostics = resp.Diagnostics.Append(errors.New("Invalid value for required argument \"host\" because I said so")) } return } @@ -3695,10 +3754,6 @@ resource "test_instance" "foo" { }) diags := ctx.Validate(m, nil) - if !p.ValidateActionConfigCalled { - t.Fatal("ValidateAction RPC was not called") - } - if test.wantErr != "" { if !diags.HasErrors() { t.Errorf("unexpected success\nwant errors: %s", test.wantErr) @@ -3710,6 +3765,13 @@ resource "test_instance" "foo" { t.Errorf("unexpected error\ngot: %s", diags.Err().Error()) } } + if p.ValidateActionConfigCalled != test.expectValidateCalled { + if test.expectValidateCalled { + t.Fatal("provider Validate RPC was expected, but not called") + } else { + t.Fatal("unexpected Validate RCP call") + } + } }) } } diff --git a/internal/terraform/node_action_abstract.go b/internal/terraform/node_action_abstract.go index 2af00048d56c..3ca9a55b0d69 100644 --- a/internal/terraform/node_action_abstract.go +++ b/internal/terraform/node_action_abstract.go @@ -44,9 +44,8 @@ func (n NodeAbstractAction) Name() string { // abstract action to a concrete one of some type. type ConcreteActionNodeFunc func(*NodeAbstractAction) dag.Vertex -// I'm not sure why my ConcreteActionNodeFUnction kept being nil in tests, but -// this is much more robust. If it isn't a validate walk, we need -// nodeExpandActionDeclaration. +// DefaultConcreteActionNodeFunc is the default ConcreteActionNodeFunc used by +// everything except validate. func DefaultConcreteActionNodeFunc(a *NodeAbstractAction) dag.Vertex { return &nodeExpandActionDeclaration{ NodeAbstractAction: a, diff --git a/internal/terraform/node_action_validate.go b/internal/terraform/node_action_validate.go index 4ad63a7254d1..8c36de6309ec 100644 --- a/internal/terraform/node_action_validate.go +++ b/internal/terraform/node_action_validate.go @@ -82,16 +82,24 @@ func (n *NodeValidatableAction) Execute(ctx EvalContext, _ walkOperation) tfdiag return diags } - var configVal cty.Value - var valDiags tfdiags.Diagnostics - if n.Config.Config != nil { - configVal, _, valDiags = ctx.EvaluateBlock(n.Config.Config, schema.ConfigSchema, nil, keyData) - diags = diags.Append(valDiags) - if valDiags.HasErrors() { + config := n.Config.Config + if n.Config.Config == nil { + config = hcl.EmptyBody() + } + + configVal, _, valDiags := ctx.EvaluateBlock(config, schema.ConfigSchema, nil, keyData) + if valDiags.HasErrors() { + // If there was no config block at all, we'll add a Context range to the returned diagnostic + if n.Config.Config == nil { + for _, diag := range valDiags.ToHCL() { + diag.Context = &n.Config.DeclRange + diags = diags.Append(diag) + } + return diags + } else { + diags = diags.Append(valDiags) return diags } - } else { - configVal = cty.NullVal(n.Schema.ConfigSchema.ImpliedType()) } // Use unmarked value for validate request From 10f00d437f70b25b957acc62ae407aa868184526 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Fri, 19 Sep 2025 15:46:34 -0400 Subject: [PATCH 06/27] Use raw args in -help flag handling --- internal/command/stacks.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/command/stacks.go b/internal/command/stacks.go index 472d0ede4ec6..95e310648dd0 100644 --- a/internal/command/stacks.go +++ b/internal/command/stacks.go @@ -82,7 +82,6 @@ func (c *StacksCommand) realRun(args []string, stdout, stderr io.Writer) int { args = c.Meta.process(args) cmdFlags := c.Meta.defaultFlagSet("stacks") cmdFlags.StringVar(&pluginCacheDirOverride, "plugin-cache-dir", "", "plugin cache directory") - cmdFlags.Usage = func() { c.Ui.Error(c.Help()) } cmdFlags.Parse(args) if pluginCacheDirOverride != "" { @@ -379,8 +378,17 @@ func (c *StacksCommand) Run(args []string) int { // Help returns help text for the stacks command. func (c *StacksCommand) Help() string { helpText := new(bytes.Buffer) - if exitCode := c.realRun([]string{}, helpText, io.Discard); exitCode != 0 { - return "" + errorText := new(bytes.Buffer) + + parsedArgs := []string{} + for _, arg := range os.Args[1:] { + if arg == "stacks" { + continue // skip stacks command name + } + parsedArgs = append(parsedArgs, arg) + } + if exitCode := c.realRun(parsedArgs, helpText, errorText); exitCode != 0 { + return errorText.String() } return helpText.String() From 7f0ef4c8d0541e1374d029a98b591c93c5a013a3 Mon Sep 17 00:00:00 2001 From: Mark DeCrane Date: Fri, 19 Sep 2025 15:47:17 -0400 Subject: [PATCH 07/27] changelog entry --- .changes/v1.14/ENHANCEMENTS-20250919-115253.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/v1.14/ENHANCEMENTS-20250919-115253.yaml diff --git a/.changes/v1.14/ENHANCEMENTS-20250919-115253.yaml b/.changes/v1.14/ENHANCEMENTS-20250919-115253.yaml new file mode 100644 index 000000000000..6f521d0c0173 --- /dev/null +++ b/.changes/v1.14/ENHANCEMENTS-20250919-115253.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: '`terraform stacks` command support for `-help` flag' +time: 2025-09-19T11:52:53.923764-04:00 +custom: + Issue: "37645" From e65c562355cf9d46e65ae150f0464fd913485d8a Mon Sep 17 00:00:00 2001 From: Liam Cervante Date: Mon, 22 Sep 2025 11:41:53 +0200 Subject: [PATCH 08/27] actions: allow invoke only on local execution while TFC adds support (#37653) * actions: allow invoke only on local execution while TFC adds support * actually return early --- internal/command/plan.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/command/plan.go b/internal/command/plan.go index a6f0b1400181..73336696c4b5 100644 --- a/internal/command/plan.go +++ b/internal/command/plan.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/hashicorp/terraform/internal/backend/backendrun" + "github.com/hashicorp/terraform/internal/backend/local" "github.com/hashicorp/terraform/internal/command/arguments" "github.com/hashicorp/terraform/internal/command/views" "github.com/hashicorp/terraform/internal/tfdiags" @@ -78,6 +79,18 @@ func (c *PlanCommand) Run(rawArgs []string) int { return 1 } + if len(args.Operation.ActionTargets) > 0 { + if _, ok := be.(*local.Local); !ok { + // Temporarily block invoking actions when executing anything other + // than locally. + // TODO: Remove this when TFC supports remote operation of action + // invoke plans. + diags = diags.Append(tfdiags.Sourceless(tfdiags.Error, "Invalid argument", "The -invoke argument can currently only be used when Terraform is executing locally.")) + view.Diagnostics(diags) + return 1 + } + } + // Build the operation request opReq, opDiags := c.OperationRequest(be, view, args.ViewType, args.Operation, args.OutPath, args.GenerateConfigPath) diags = diags.Append(opDiags) From 8097ce9e5784974fd1f0d2db7f0057c806aab273 Mon Sep 17 00:00:00 2001 From: Andrew Babichev Date: Thu, 18 Sep 2025 23:42:06 +0100 Subject: [PATCH 09/27] docs(destroying): fix typos --- docs/destroying.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/destroying.md b/docs/destroying.md index 9643e26cbbc8..37bbe4ef7417 100644 --- a/docs/destroying.md +++ b/docs/destroying.md @@ -59,8 +59,8 @@ digraph update { Order of operations: 1. `A` is created -1. `B` is created -1. `C` is created +1. `B` is updated +1. `C` is updated ## Simple Resource Destruction @@ -87,7 +87,7 @@ digraph destroy { Order of operations: 1. `C` is destroyed 1. `B` is destroyed -1. `A` is Destroyed +1. `A` is destroyed ## Resource Replacement From f6ad8d3215b176a34efc7459a497c6bd1d2430d4 Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Tue, 23 Sep 2025 12:20:58 -0400 Subject: [PATCH 10/27] actions: fix panic during query plan by not planning actions We don't need to plan any actions during query plan mode. Test stolen from DanielMSchmidt, thank you! --- .../terraform/context_plan_actions_test.go | 107 +++++++++++++++++- internal/terraform/graph_builder_plan.go | 7 +- internal/terraform/transform_action_plan.go | 4 +- 3 files changed, 113 insertions(+), 5 deletions(-) diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index 5707875b87d4..c82245b72612 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -4,6 +4,7 @@ package terraform import ( + "maps" "path/filepath" "slices" "sort" @@ -144,7 +145,70 @@ action "test_action" "hello" {} } }, }, - + "query run": { + module: map[string]string{ + "main.tf": ` +action "test_action" "hello" {} +resource "test_object" "a" { + lifecycle { + action_trigger { + events = [before_create, after_update] + actions = [action.test_action.hello] + } + } +} +`, + "main.tfquery.hcl": ` +list "test_resource" "test1" { + provider = "test" + config { + filter = { + attr = "foo" + } + } +} +`, + }, + expectPlanActionCalled: false, + planOpts: &PlanOpts{ + Mode: plans.NormalMode, + Query: true, + }, + }, + "query run, action references resource": { + module: map[string]string{ + "main.tf": ` +action "test_action" "hello" { + config { + attr = resource.test_object.a + } +} +resource "test_object" "a" { + lifecycle { + action_trigger { + events = [before_create, after_update] + actions = [action.test_action.hello] + } + } +} +`, + "main.tfquery.hcl": ` +list "test_resource" "test1" { + provider = "test" + config { + filter = { + attr = "foo" + } + } +} +`, + }, + expectPlanActionCalled: false, + planOpts: &PlanOpts{ + Mode: plans.NormalMode, + Query: true, + }, + }, "invalid config": { module: map[string]string{ "main.tf": ` @@ -3269,6 +3333,47 @@ resource "test_object" "a" { }, }, }, + ListResourceTypes: map[string]providers.Schema{ + "test_resource": { + Body: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "data": { + Type: cty.DynamicPseudoType, + Computed: true, + }, + }, + BlockTypes: map[string]*configschema.NestedBlock{ + "config": { + Block: configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "filter": { + Required: true, + NestedType: &configschema.Object{ + Nesting: configschema.NestingSingle, + Attributes: map[string]*configschema.Attribute{ + "attr": { + Type: cty.String, + Required: true, + }, + }, + }, + }, + }, + }, + Nesting: configschema.NestingSingle, + }, + }, + }, + }, + }, + }, + ListResourceFn: func(req providers.ListResourceRequest) providers.ListResourceResponse { + resp := []cty.Value{} + ret := req.Config.AsValueMap() + maps.Copy(ret, map[string]cty.Value{ + "data": cty.TupleVal(resp), + }) + return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} }, } diff --git a/internal/terraform/graph_builder_plan.go b/internal/terraform/graph_builder_plan.go index 69776cff541c..87a8dab98582 100644 --- a/internal/terraform/graph_builder_plan.go +++ b/internal/terraform/graph_builder_plan.go @@ -174,9 +174,10 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { }, &ActionPlanTransformer{ - Config: b.Config, - Operation: b.Operation, - Targets: b.ActionTargets, + Config: b.Config, + Operation: b.Operation, + Targets: b.ActionTargets, + queryPlanMode: b.queryPlan, }, // Add dynamic values diff --git a/internal/terraform/transform_action_plan.go b/internal/terraform/transform_action_plan.go index 752a8e9b2f35..7f2fc8b4e281 100644 --- a/internal/terraform/transform_action_plan.go +++ b/internal/terraform/transform_action_plan.go @@ -16,10 +16,12 @@ type ActionPlanTransformer struct { Config *configs.Config Targets []addrs.Targetable Operation walkOperation + + queryPlanMode bool } func (t *ActionPlanTransformer) Transform(g *Graph) error { - if t.Operation != walkPlan { + if t.Operation != walkPlan || t.queryPlanMode { return nil } From a7504719efe0bc73958cac29e32cf1ec15830465 Mon Sep 17 00:00:00 2001 From: Samsondeen <40821565+dsa0x@users.noreply.github.com> Date: Wed, 24 Sep 2025 09:30:59 +0200 Subject: [PATCH 11/27] list: send non-null "config" object to provider when not present in the list block (#37620) --- internal/command/query_test.go | 8 +- internal/plugin/convert/schema.go | 40 +++ internal/plugin/grpc_provider.go | 36 +-- internal/plugin/grpc_provider_test.go | 79 ++++- internal/plugin6/convert/schema.go | 39 +++ internal/plugin6/grpc_provider.go | 37 +-- internal/plugin6/grpc_provider_test.go | 11 +- internal/providers/provider.go | 13 + internal/providers/schemas.go | 17 ++ internal/terraform/context_plan_query_test.go | 289 +++++++++++++++--- internal/terraform/evaluate_valid.go | 8 +- .../node_resource_plan_instance_query.go | 15 +- internal/terraform/node_resource_validate.go | 13 +- 13 files changed, 501 insertions(+), 104 deletions(-) diff --git a/internal/command/query_test.go b/internal/command/query_test.go index 36e048456d3d..95162d2ba861 100644 --- a/internal/command/query_test.go +++ b/internal/command/query_test.go @@ -271,7 +271,9 @@ func queryFixtureProvider() *testing_provider.MockProvider { }, }, }, - Nesting: configschema.NestingSingle, + Nesting: configschema.NestingSingle, + MinItems: 1, + MaxItems: 1, }, }, } @@ -292,7 +294,9 @@ func queryFixtureProvider() *testing_provider.MockProvider { }, }, }, - Nesting: configschema.NestingSingle, + Nesting: configschema.NestingSingle, + MinItems: 1, + MaxItems: 1, }, }, } diff --git a/internal/plugin/convert/schema.go b/internal/plugin/convert/schema.go index d07f91645fd7..d3b003d561ae 100644 --- a/internal/plugin/convert/schema.go +++ b/internal/plugin/convert/schema.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/providers" proto "github.com/hashicorp/terraform/internal/tfplugin5" + "github.com/zclconf/go-cty/cty" ) // ConfigSchemaToProto takes a *configschema.Block and converts it to a @@ -111,6 +112,45 @@ func ProtoToActionSchema(s *proto.ActionSchema) providers.ActionSchema { } } +func ProtoToListSchema(s *proto.Schema) providers.Schema { + listSchema := ProtoToProviderSchema(s, nil) + itemCount := 0 + // check if the provider has set some attributes/blocks as required. + // When yes, then we set minItem = 1, which + // validates that the configuration contains a "config" block. + for _, attrS := range listSchema.Body.Attributes { + if attrS.Required { + itemCount = 1 + break + } + } + for _, block := range listSchema.Body.BlockTypes { + if block.MinItems > 0 { + itemCount = 1 + break + } + } + return providers.Schema{ + Version: s.Version, + Body: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "data": { + Type: cty.DynamicPseudoType, + Computed: true, + }, + }, + BlockTypes: map[string]*configschema.NestedBlock{ + "config": { + Block: *listSchema.Body, + Nesting: configschema.NestingSingle, + MinItems: itemCount, + MaxItems: itemCount, + }, + }, + }, + } +} + // ProtoToConfigSchema takes the GetSchcema_Block from a grpc response and converts it // to a terraform *configschema.Block. func ProtoToConfigSchema(b *proto.Schema_Block) *configschema.Block { diff --git a/internal/plugin/grpc_provider.go b/internal/plugin/grpc_provider.go index c3c0793dc27c..3f8251b4a11d 100644 --- a/internal/plugin/grpc_provider.go +++ b/internal/plugin/grpc_provider.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc/status" "github.com/hashicorp/terraform/internal/addrs" - "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/logging" "github.com/hashicorp/terraform/internal/plugin/convert" "github.com/hashicorp/terraform/internal/providers" @@ -171,24 +170,7 @@ func (p *GRPCProvider) GetProviderSchema() providers.GetProviderSchemaResponse { } for name, list := range protoResp.ListResourceSchemas { - ret := convert.ProtoToProviderSchema(list, nil) - resp.ListResourceTypes[name] = providers.Schema{ - Version: ret.Version, - Body: &configschema.Block{ - Attributes: map[string]*configschema.Attribute{ - "data": { - Type: cty.DynamicPseudoType, - Computed: true, - }, - }, - BlockTypes: map[string]*configschema.NestedBlock{ - "config": { - Block: *ret.Body, - Nesting: configschema.NestingSingle, - }, - }, - }, - } + resp.ListResourceTypes[name] = convert.ProtoToListSchema(list) } for name, action := range protoResp.ActionSchemas { @@ -381,10 +363,12 @@ func (p *GRPCProvider) ValidateListResourceConfig(r providers.ValidateListResour } configSchema := listResourceSchema.Body.BlockTypes["config"] - config := cty.NullVal(configSchema.ImpliedType()) - if r.Config.Type().HasAttribute("config") { - config = r.Config.GetAttr("config") + if !r.Config.Type().HasAttribute("config") { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("missing required attribute \"config\"; this is a bug in Terraform - please report it")) + return resp } + + config := r.Config.GetAttr("config") mp, err := msgpack.Marshal(config, configSchema.ImpliedType()) if err != nil { resp.Diagnostics = resp.Diagnostics.Append(err) @@ -1342,10 +1326,12 @@ func (p *GRPCProvider) ListResource(r providers.ListResourceRequest) providers.L } configSchema := listResourceSchema.Body.BlockTypes["config"] - config := cty.NullVal(configSchema.ImpliedType()) - if r.Config.Type().HasAttribute("config") { - config = r.Config.GetAttr("config") + if !r.Config.Type().HasAttribute("config") { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("missing required attribute \"config\"; this is a bug in Terraform - please report it")) + return resp } + + config := r.Config.GetAttr("config") mp, err := msgpack.Marshal(config, configSchema.ImpliedType()) if err != nil { resp.Diagnostics = resp.Diagnostics.Append(err) diff --git a/internal/plugin/grpc_provider_test.go b/internal/plugin/grpc_provider_test.go index 657b8b7f33d3..34017d724406 100644 --- a/internal/plugin/grpc_provider_test.go +++ b/internal/plugin/grpc_provider_test.go @@ -146,6 +146,23 @@ func providerProtoSchema() *proto.GetProviderSchema_Response { Required: true, }, }, + BlockTypes: []*proto.Schema_NestedBlock{ + { + TypeName: "nested_filter", + Nesting: proto.Schema_NestedBlock_SINGLE, + Block: &proto.Schema_Block{ + Attributes: []*proto.Schema_Attribute{ + { + Name: "nested_attr", + Type: []byte(`"string"`), + Required: false, + }, + }, + }, + MinItems: 1, + MaxItems: 1, + }, + }, }, }, }, @@ -466,7 +483,7 @@ func TestGRPCProvider_ValidateListResourceConfig(t *testing.T) { gomock.Any(), ).Return(&proto.ValidateListResourceConfig_Response{}, nil) - cfg := hcl2shim.HCL2ValueFromConfigValue(map[string]interface{}{"config": map[string]interface{}{"filter_attr": "value"}}) + cfg := hcl2shim.HCL2ValueFromConfigValue(map[string]interface{}{"config": map[string]interface{}{"filter_attr": "value", "nested_filter": map[string]interface{}{"nested_attr": "value"}}}) resp := p.ValidateListResourceConfig(providers.ValidateListResourceConfigRequest{ TypeName: "list", Config: cfg, @@ -478,8 +495,18 @@ func TestGRPCProvider_ValidateListResourceConfig_OptionalCfg(t *testing.T) { ctrl := gomock.NewController(t) client := mockproto.NewMockProviderClient(ctrl) sch := providerProtoSchema() - sch.ListResourceSchemas["list"].Block.Attributes[0].Optional = true - sch.ListResourceSchemas["list"].Block.Attributes[0].Required = false + + // mock the schema in a way that makes the config attributes optional + listSchema := sch.ListResourceSchemas["list"].Block + // filter_attr is optional + listSchema.Attributes[0].Optional = true + listSchema.Attributes[0].Required = false + + // nested_filter is optional + listSchema.BlockTypes[0].MinItems = 0 + listSchema.BlockTypes[0].MaxItems = 0 + + sch.ListResourceSchemas["list"].Block = listSchema // we always need a GetSchema method client.EXPECT().GetSchema( gomock.Any(), @@ -502,10 +529,15 @@ func TestGRPCProvider_ValidateListResourceConfig_OptionalCfg(t *testing.T) { gomock.Any(), ).Return(&proto.ValidateListResourceConfig_Response{}, nil) - cfg := hcl2shim.HCL2ValueFromConfigValue(map[string]interface{}{}) + converted := convert.ProtoToListSchema(sch.ListResourceSchemas["list"]) + cfg := hcl2shim.HCL2ValueFromConfigValue(map[string]any{}) + coercedCfg, err := converted.Body.CoerceValue(cfg) + if err != nil { + t.Fatalf("failed to coerce config: %v", err) + } resp := p.ValidateListResourceConfig(providers.ValidateListResourceConfigRequest{ TypeName: "list", - Config: cfg, + Config: coercedCfg, }) checkDiags(t, resp.Diagnostics) } @@ -1438,8 +1470,25 @@ func TestGRPCProvider_GetSchema_ListResourceTypes(t *testing.T) { Required: true, }, }, + BlockTypes: map[string]*configschema.NestedBlock{ + "nested_filter": { + Block: configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "nested_attr": { + Type: cty.String, + Required: false, + }, + }, + }, + Nesting: configschema.NestingSingle, + MinItems: 1, + MaxItems: 1, + }, + }, }, - Nesting: configschema.NestingSingle, + Nesting: configschema.NestingSingle, + MinItems: 1, + MaxItems: 1, }, }, }, @@ -1485,6 +1534,9 @@ func TestGRPCProvider_Encode(t *testing.T) { Before: cty.NullVal(cty.Object(map[string]cty.Type{ "config": cty.Object(map[string]cty.Type{ "filter_attr": cty.String, + "nested_filter": cty.Object(map[string]cty.Type{ + "nested_attr": cty.String, + }), }), "data": cty.List(cty.Object(map[string]cty.Type{ "state": cty.Object(map[string]cty.Type{ @@ -1498,6 +1550,9 @@ func TestGRPCProvider_Encode(t *testing.T) { After: cty.ObjectVal(map[string]cty.Value{ "config": cty.ObjectVal(map[string]cty.Value{ "filter_attr": cty.StringVal("value"), + "nested_filter": cty.ObjectVal(map[string]cty.Value{ + "nested_attr": cty.StringVal("value"), + }), }), "data": cty.ListVal([]cty.Value{ cty.ObjectVal(map[string]cty.Value{ @@ -1649,6 +1704,9 @@ func TestGRPCProvider_ListResource(t *testing.T) { configVal := cty.ObjectVal(map[string]cty.Value{ "config": cty.ObjectVal(map[string]cty.Value{ "filter_attr": cty.StringVal("filter-value"), + "nested_filter": cty.ObjectVal(map[string]cty.Value{ + "nested_attr": cty.StringVal("value"), + }), }), }) request := providers.ListResourceRequest{ @@ -1731,6 +1789,9 @@ func TestGRPCProvider_ListResource_Error(t *testing.T) { configVal := cty.ObjectVal(map[string]cty.Value{ "config": cty.ObjectVal(map[string]cty.Value{ "filter_attr": cty.StringVal("filter-value"), + "nested_filter": cty.ObjectVal(map[string]cty.Value{ + "nested_attr": cty.StringVal("value"), + }), }), }) request := providers.ListResourceRequest{ @@ -1746,6 +1807,9 @@ func TestGRPCProvider_ListResource_Diagnostics(t *testing.T) { configVal := cty.ObjectVal(map[string]cty.Value{ "config": cty.ObjectVal(map[string]cty.Value{ "filter_attr": cty.StringVal("filter-value"), + "nested_filter": cty.ObjectVal(map[string]cty.Value{ + "nested_attr": cty.StringVal("value"), + }), }), }) request := providers.ListResourceRequest{ @@ -2009,6 +2073,9 @@ func TestGRPCProvider_ListResource_Limit(t *testing.T) { configVal := cty.ObjectVal(map[string]cty.Value{ "config": cty.ObjectVal(map[string]cty.Value{ "filter_attr": cty.StringVal("filter-value"), + "nested_filter": cty.ObjectVal(map[string]cty.Value{ + "nested_attr": cty.StringVal("value"), + }), }), }) request := providers.ListResourceRequest{ diff --git a/internal/plugin6/convert/schema.go b/internal/plugin6/convert/schema.go index a762590862ca..4ea6a8faf507 100644 --- a/internal/plugin6/convert/schema.go +++ b/internal/plugin6/convert/schema.go @@ -118,6 +118,45 @@ func ProtoToActionSchema(s *proto.ActionSchema) providers.ActionSchema { } } +func ProtoToListSchema(s *proto.Schema) providers.Schema { + listSchema := ProtoToProviderSchema(s, nil) + itemCount := 0 + // check if the provider has set some attributes/blocks as required. + // When yes, then we set minItem = 1, which + // validates that the configuration contains a "config" block. + for _, attrS := range listSchema.Body.Attributes { + if attrS.Required { + itemCount = 1 + break + } + } + for _, block := range listSchema.Body.BlockTypes { + if block.MinItems > 0 { + itemCount = 1 + break + } + } + return providers.Schema{ + Version: listSchema.Version, + Body: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "data": { + Type: cty.DynamicPseudoType, + Computed: true, + }, + }, + BlockTypes: map[string]*configschema.NestedBlock{ + "config": { + Block: *listSchema.Body, + Nesting: configschema.NestingSingle, + MinItems: itemCount, + MaxItems: itemCount, + }, + }, + }, + } +} + func ProtoToIdentitySchema(attributes []*proto.ResourceIdentitySchema_IdentityAttribute) *configschema.Object { obj := &configschema.Object{ Attributes: make(map[string]*configschema.Attribute), diff --git a/internal/plugin6/grpc_provider.go b/internal/plugin6/grpc_provider.go index b991ed6b8d0f..0ab7da98b1a2 100644 --- a/internal/plugin6/grpc_provider.go +++ b/internal/plugin6/grpc_provider.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc/status" "github.com/hashicorp/terraform/internal/addrs" - "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/logging" "github.com/hashicorp/terraform/internal/plugin6/convert" "github.com/hashicorp/terraform/internal/providers" @@ -172,24 +171,7 @@ func (p *GRPCProvider) GetProviderSchema() providers.GetProviderSchemaResponse { } for name, list := range protoResp.ListResourceSchemas { - ret := convert.ProtoToProviderSchema(list, nil) - resp.ListResourceTypes[name] = providers.Schema{ - Version: ret.Version, - Body: &configschema.Block{ - Attributes: map[string]*configschema.Attribute{ - "data": { - Type: cty.DynamicPseudoType, - Computed: true, - }, - }, - BlockTypes: map[string]*configschema.NestedBlock{ - "config": { - Block: *ret.Body, - Nesting: configschema.NestingSingle, - }, - }, - }, - } + resp.ListResourceTypes[name] = convert.ProtoToListSchema(list) } for name, store := range protoResp.StateStoreSchemas { @@ -377,11 +359,14 @@ func (p *GRPCProvider) ValidateListResourceConfig(r providers.ValidateListResour resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("unknown list resource type %q", r.TypeName)) return resp } + configSchema := listResourceSchema.Body.BlockTypes["config"] - config := cty.NullVal(configSchema.ImpliedType()) - if r.Config.Type().HasAttribute("config") { - config = r.Config.GetAttr("config") + if !r.Config.Type().HasAttribute("config") { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("missing required attribute \"config\"; this is a bug in Terraform - please report it")) + return resp } + + config := r.Config.GetAttr("config") mp, err := msgpack.Marshal(config, configSchema.ImpliedType()) if err != nil { resp.Diagnostics = resp.Diagnostics.Append(err) @@ -1337,10 +1322,12 @@ func (p *GRPCProvider) ListResource(r providers.ListResourceRequest) providers.L } configSchema := listResourceSchema.Body.BlockTypes["config"] - config := cty.NullVal(configSchema.ImpliedType()) - if r.Config.Type().HasAttribute("config") { - config = r.Config.GetAttr("config") + if !r.Config.Type().HasAttribute("config") { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("missing required attribute \"config\"; this is a bug in Terraform - please report it")) + return resp } + + config := r.Config.GetAttr("config") mp, err := msgpack.Marshal(config, configSchema.ImpliedType()) if err != nil { resp.Diagnostics = resp.Diagnostics.Append(err) diff --git a/internal/plugin6/grpc_provider_test.go b/internal/plugin6/grpc_provider_test.go index 5e375c66ce53..44fb722dcff3 100644 --- a/internal/plugin6/grpc_provider_test.go +++ b/internal/plugin6/grpc_provider_test.go @@ -522,10 +522,15 @@ func TestGRPCProvider_ValidateListResourceConfig_OptionalCfg(t *testing.T) { gomock.Any(), ).Return(&proto.ValidateListResourceConfig_Response{}, nil) + converted := convert.ProtoToListSchema(sch.ListResourceSchemas["list"]) cfg := hcl2shim.HCL2ValueFromConfigValue(map[string]interface{}{}) + coercedCfg, err := converted.Body.CoerceValue(cfg) + if err != nil { + t.Fatalf("failed to coerce config: %v", err) + } resp := p.ValidateListResourceConfig(providers.ValidateListResourceConfigRequest{ TypeName: "list", - Config: cfg, + Config: coercedCfg, }) checkDiags(t, resp.Diagnostics) } @@ -1458,7 +1463,9 @@ func TestGRPCProvider_GetSchema_ListResourceTypes(t *testing.T) { }, }, }, - Nesting: configschema.NestingSingle, + Nesting: configschema.NestingSingle, + MinItems: 1, + MaxItems: 1, }, }, }, diff --git a/internal/providers/provider.go b/internal/providers/provider.go index b19c1451a501..579626c3699f 100644 --- a/internal/providers/provider.go +++ b/internal/providers/provider.go @@ -220,6 +220,19 @@ func (a ActionSchema) IsNil() bool { return a.ConfigSchema == nil } +type ListResourceSchema struct { + // schema for the nested "config" block. + ConfigSchema *configschema.Block + + // schema for the entire block (including "config" block) + FullSchema *configschema.Block +} + +// IsNil() returns true if there is no list resource schema at all. +func (l ListResourceSchema) IsNil() bool { + return l.FullSchema == nil +} + // Schema pairs a provider or resource schema with that schema's version. // This is used to be able to upgrade the schema in UpgradeResourceState. // diff --git a/internal/providers/schemas.go b/internal/providers/schemas.go index 4d02c8bdc897..9cb64b5ecfef 100644 --- a/internal/providers/schemas.go +++ b/internal/providers/schemas.go @@ -47,3 +47,20 @@ func (ss ProviderSchema) SchemaForActionType(typeName string) (schema ActionSche } return ActionSchema{} } + +// SchemaForListResourceType attempts to find a schema for the given type. Returns an +// empty schema if none is available. +func (ss ProviderSchema) SchemaForListResourceType(typeName string) ListResourceSchema { + schema, ok := ss.ListResourceTypes[typeName] + ret := ListResourceSchema{FullSchema: schema.Body} + if !ok || schema.Body == nil { + return ret + } + // The configuration for the list block is nested within a "config" block. + configSchema, ok := schema.Body.BlockTypes["config"] + if !ok { + return ret + } + ret.ConfigSchema = &configSchema.Block + return ret +} diff --git a/internal/terraform/context_plan_query_test.go b/internal/terraform/context_plan_query_test.go index 3f95027dcd26..7578fe0c1d8e 100644 --- a/internal/terraform/context_plan_query_test.go +++ b/internal/terraform/context_plan_query_test.go @@ -12,6 +12,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" + "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/plans" @@ -24,15 +25,16 @@ import ( func TestContext2Plan_queryList(t *testing.T) { cases := []struct { - name string - mainConfig string - queryConfig string - generatedPath string - diagCount int - expectedErrMsg []string - assertState func(*states.State) - assertChanges func(providers.ProviderSchema, *plans.ChangesSrc) - listResourceFn func(request providers.ListResourceRequest) providers.ListResourceResponse + name string + mainConfig string + queryConfig string + generatedPath string + expectedErrMsg []string + transformSchema func(*providers.GetProviderSchemaResponse) + assertState func(*states.State) + assertValidateDiags func(t *testing.T, diags tfdiags.Diagnostics) + assertChanges func(providers.ProviderSchema, *plans.ChangesSrc) + listResourceFn func(request providers.ListResourceRequest) providers.ListResourceResponse }{ { name: "valid list reference - generates config", @@ -261,6 +263,186 @@ func TestContext2Plan_queryList(t *testing.T) { } }, }, + { + name: "with empty config when it is required", + mainConfig: ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + `, + queryConfig: ` + variable "input" { + type = string + default = "foo" + } + + list "test_resource" "test" { + provider = test + } + `, + + transformSchema: func(schema *providers.GetProviderSchemaResponse) { + schema.ListResourceTypes["test_resource"].Body.BlockTypes = map[string]*configschema.NestedBlock{ + "config": { + Block: configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "filter": { + Required: true, + NestedType: &configschema.Object{ + Nesting: configschema.NestingSingle, + Attributes: map[string]*configschema.Attribute{ + "attr": { + Type: cty.String, + Optional: true, + }, + }, + }, + }, + }, + }, + Nesting: configschema.NestingSingle, + MinItems: 1, + MaxItems: 1, + }, + } + + }, + assertValidateDiags: func(t *testing.T, diags tfdiags.Diagnostics) { + tfdiags.AssertDiagnosticCount(t, diags, 1) + var exp tfdiags.Diagnostics + exp = exp.Append(&hcl.Diagnostic{ + Summary: "Missing config block", + Detail: "A block of type \"config\" is required here.", + Subject: diags[0].Source().Subject.ToHCL().Ptr(), + }) + tfdiags.AssertDiagnosticsMatch(t, diags, exp) + }, + }, + { + name: "with empty optional config", + mainConfig: ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + `, + queryConfig: ` + variable "input" { + type = string + default = "foo" + } + + list "test_resource" "test" { + provider = test + } + `, + transformSchema: func(schema *providers.GetProviderSchemaResponse) { + schema.ListResourceTypes["test_resource"].Body.BlockTypes = map[string]*configschema.NestedBlock{ + "config": { + Block: configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "filter": { + Optional: true, + NestedType: &configschema.Object{ + Nesting: configschema.NestingSingle, + Attributes: map[string]*configschema.Attribute{ + "attr": { + Type: cty.String, + Optional: true, + }, + }, + }, + }, + }, + }, + Nesting: configschema.NestingSingle, + }, + } + + }, + listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { + madeUp := []cty.Value{ + cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-123456")}), + cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-654321")}), + } + ids := []cty.Value{} + for i := range madeUp { + ids = append(ids, cty.ObjectVal(map[string]cty.Value{ + "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), + })) + } + + resp := []cty.Value{} + for i, v := range madeUp { + resp = append(resp, cty.ObjectVal(map[string]cty.Value{ + "state": v, + "identity": ids[i], + "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), + })) + } + + ret := map[string]cty.Value{ + "data": cty.TupleVal(resp), + } + for k, v := range request.Config.AsValueMap() { + if k != "data" { + ret[k] = v + } + } + + return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} + }, + assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { + expectedResources := []string{"list.test_resource.test"} + actualResources := make([]string, 0) + for _, change := range changes.Queries { + actualResources = append(actualResources, change.Addr.String()) + schema := sch.ListResourceTypes[change.Addr.Resource.Resource.Type] + cs, err := change.Decode(schema) + if err != nil { + t.Fatalf("failed to decode change: %s", err) + } + + // Verify instance types + expectedTypes := []string{"ami-123456", "ami-654321"} + actualTypes := make([]string, 0) + obj := cs.Results.Value.GetAttr("data") + if obj.IsNull() { + t.Fatalf("Expected 'data' attribute to be present, but it is null") + } + obj.ForEachElement(func(key cty.Value, val cty.Value) bool { + val = val.GetAttr("state") + if val.IsNull() { + t.Fatalf("Expected 'state' attribute to be present, but it is null") + } + if val.GetAttr("instance_type").IsNull() { + t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") + } + actualTypes = append(actualTypes, val.GetAttr("instance_type").AsString()) + return false + }) + sort.Strings(actualTypes) + sort.Strings(expectedTypes) + if diff := cmp.Diff(expectedTypes, actualTypes); diff != "" { + t.Fatalf("Expected instance types to match, but they differ: %s", diff) + } + } + sort.Strings(actualResources) + sort.Strings(expectedResources) + if diff := cmp.Diff(expectedResources, actualResources); diff != "" { + t.Fatalf("Expected resources to match, but they differ: %s", diff) + } + }, + }, { name: "invalid list result's attribute reference", mainConfig: ` @@ -301,10 +483,17 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - diagCount: 1, - expectedErrMsg: []string{ - "Invalid list resource traversal", - "The first step in the traversal for a list resource must be an attribute \"data\"", + assertValidateDiags: func(t *testing.T, diags tfdiags.Diagnostics) { + tfdiags.AssertDiagnosticCount(t, diags, 1) + var exp tfdiags.Diagnostics + exp = exp.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid list resource traversal", + Detail: "The first step in the traversal for a list resource must be an attribute \"data\".", + Subject: diags[0].Source().Subject.ToHCL().Ptr(), + }) + + tfdiags.AssertDiagnosticsMatch(t, diags, exp) }, }, { @@ -332,9 +521,18 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - diagCount: 1, - expectedErrMsg: []string{ - "A list resource \"non_existent\" \"attr\" has not been declared in the root module.", + assertValidateDiags: func(t *testing.T, diags tfdiags.Diagnostics) { + tfdiags.AssertDiagnosticCount(t, diags, 1) + var exp tfdiags.Diagnostics + + exp = exp.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Reference to undeclared resource", + Detail: "A list resource \"non_existent\" \"attr\" has not been declared in the root module.", + Subject: diags[0].Source().Subject.ToHCL().Ptr(), + }) + + tfdiags.AssertDiagnosticsMatch(t, diags, exp) }, }, { @@ -373,9 +571,18 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - diagCount: 1, - expectedErrMsg: []string{ - "Unsupported attribute: This object has no argument, nested block, or exported attribute named \"invalid_attr\".", + assertValidateDiags: func(t *testing.T, diags tfdiags.Diagnostics) { + tfdiags.AssertDiagnosticCount(t, diags, 1) + var exp tfdiags.Diagnostics + + exp = exp.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Unsupported attribute", + Detail: "This object has no argument, nested block, or exported attribute named \"invalid_attr\".", + Subject: diags[0].Source().Subject.ToHCL().Ptr(), + }) + + tfdiags.AssertDiagnosticsMatch(t, diags, exp) }, listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { madeUp := []cty.Value{ @@ -444,9 +651,14 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - diagCount: 1, - expectedErrMsg: []string{ - "Cycle: list.test_resource", + assertValidateDiags: func(t *testing.T, diags tfdiags.Diagnostics) { + tfdiags.AssertDiagnosticCount(t, diags, 1) + if !strings.Contains(diags[0].Description().Summary, "Cycle: list.test_resource") { + t.Errorf("Expected error message to contain 'Cycle: list.test_resource', got %q", diags[0].Description().Summary) + } + if diags[0].Severity() != tfdiags.Error { + t.Errorf("Expected error severity to be Error, got %s", diags[0].Severity()) + } }, }, { @@ -564,8 +776,7 @@ func TestContext2Plan_queryList(t *testing.T) { }, }, { - // Test list reference with index but without data field - name: "list reference with index but without data field", + name: "list reference as for_each", mainConfig: ` terraform { required_providers { @@ -688,8 +899,14 @@ func TestContext2Plan_queryList(t *testing.T) { provider := testProvider("test") provider.ConfigureProvider(providers.ConfigureProviderRequest{}) provider.GetProviderSchemaResponse = getListProviderSchemaResp() + if tc.transformSchema != nil { + tc.transformSchema(provider.GetProviderSchemaResponse) + } var requestConfigs = make(map[string]cty.Value) provider.ListResourceFn = func(request providers.ListResourceRequest) providers.ListResourceResponse { + if request.Config.IsNull() || request.Config.GetAttr("config").IsNull() { + t.Fatalf("config should never be null, got null for %s", request.TypeName) + } requestConfigs[request.TypeName] = request.Config fn := tc.listResourceFn if fn == nil { @@ -705,15 +922,21 @@ func TestContext2Plan_queryList(t *testing.T) { }) tfdiags.AssertNoDiagnostics(t, diags) + diags = ctx.Validate(mod, &ValidateOpts{}) + if tc.assertValidateDiags != nil { + tc.assertValidateDiags(t, diags) + return + } else { + tfdiags.AssertNoDiagnostics(t, diags) + } + plan, diags := ctx.Plan(mod, states.NewState(), &PlanOpts{ Mode: plans.NormalMode, SetVariables: testInputValuesUnset(mod.Module.Variables), Query: true, GenerateConfigPath: tc.generatedPath, }) - if len(diags) != tc.diagCount { - t.Fatalf("expected %d diagnostics, got %d \n -diags: %s", tc.diagCount, len(diags), diags) - } + tfdiags.AssertNoDiagnostics(t, diags) if tc.assertChanges != nil { sch, err := ctx.Schemas(mod, states.NewState()) @@ -722,15 +945,6 @@ func TestContext2Plan_queryList(t *testing.T) { } tc.assertChanges(sch.Providers[providerAddr], plan.Changes) } - - if tc.diagCount > 0 { - for _, err := range tc.expectedErrMsg { - if !strings.Contains(diags.Err().Error(), err) { - t.Fatalf("expected error message %q, but got %q", err, diags.Err().Error()) - } - } - } - }) } } @@ -837,6 +1051,9 @@ func TestContext2Plan_queryListArgs(t *testing.T) { provider.GetProviderSchemaResponse = getListProviderSchemaResp() var recordedRequest providers.ListResourceRequest provider.ListResourceFn = func(request providers.ListResourceRequest) providers.ListResourceResponse { + if request.Config.IsNull() || request.Config.GetAttr("config").IsNull() { + t.Fatalf("config should never be null, got null for %s", request.TypeName) + } recordedRequest = request return provider.ListResourceResponse } diff --git a/internal/terraform/evaluate_valid.go b/internal/terraform/evaluate_valid.go index 16315abd5da5..9ce292d25153 100644 --- a/internal/terraform/evaluate_valid.go +++ b/internal/terraform/evaluate_valid.go @@ -303,7 +303,7 @@ func staticValidateResourceReference(modCfg *configs.Config, addr addrs.Resource diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: `Invalid list resource traversal`, - Detail: fmt.Sprintf(`The first step in the traversal for a %s resource must be an attribute "data", but got %q instead.`, modeAdjective, remain[0]), + Detail: fmt.Sprintf(`The first step in the traversal for a %s resource must be an attribute "data".`, modeAdjective), Subject: rng.ToHCL().Ptr(), }) return diags @@ -315,7 +315,7 @@ func staticValidateResourceReference(modCfg *configs.Config, addr addrs.Resource diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: `Invalid list resource traversal`, - Detail: fmt.Sprintf(`The second step in the traversal for a %s resource must be an index, but got %q instead.`, modeAdjective, remain[0]), + Detail: fmt.Sprintf(`The second step in the traversal for a %s resource must be an index.`, modeAdjective), Subject: rng.ToHCL().Ptr(), }) return diags @@ -331,7 +331,7 @@ func staticValidateResourceReference(modCfg *configs.Config, addr addrs.Resource diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: `Invalid list resource traversal`, - Detail: fmt.Sprintf(`The third step in the traversal for a %s resource must be an attribute "state" or "identity", but got %q instead.`, modeAdjective, remain[0]), + Detail: fmt.Sprintf(`The third step in the traversal for a %s resource must be an attribute "state" or "identity".`, modeAdjective), Subject: rng.ToHCL().Ptr(), }) return diags @@ -340,7 +340,7 @@ func staticValidateResourceReference(modCfg *configs.Config, addr addrs.Resource diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: `Invalid list resource traversal`, - Detail: fmt.Sprintf(`The third step in the traversal for a %s resource must be an attribute "state" or "identity", but got %q instead.`, modeAdjective, stateOrIdent.Name), + Detail: fmt.Sprintf(`The third step in the traversal for a %s resource must be an attribute "state" or "identity".`, modeAdjective), Subject: rng.ToHCL().Ptr(), }) return diags diff --git a/internal/terraform/node_resource_plan_instance_query.go b/internal/terraform/node_resource_plan_instance_query.go index 2a517f3af8c4..c1ddf131fcb6 100644 --- a/internal/terraform/node_resource_plan_instance_query.go +++ b/internal/terraform/node_resource_plan_instance_query.go @@ -36,9 +36,15 @@ func (n *NodePlannableResourceInstance) listResourceExecute(ctx EvalContext) (di keyData = EvalDataForInstanceKey(addr.Resource.Key, forEach) } + schema := providerSchema.SchemaForListResourceType(n.Config.Type) + if schema.IsNil() { // Not possible, as the schema should have already been validated to exist + diags = diags.Append(fmt.Errorf("no schema available for %s; this is a bug in Terraform and should be reported", addr)) + return diags + } + // evaluate the list config block var configDiags tfdiags.Diagnostics - blockVal, _, configDiags := ctx.EvaluateBlock(config.Config, n.Schema.Body, nil, keyData) + blockVal, _, configDiags := ctx.EvaluateBlock(config.Config, schema.FullSchema, nil, keyData) diags = diags.Append(configDiags) if diags.HasErrors() { return diags @@ -79,6 +85,13 @@ func (n *NodePlannableResourceInstance) listResourceExecute(ctx EvalContext) (di } log.Printf("[TRACE] NodePlannableResourceInstance: Re-validating config for %s", n.Addr) + // if the config value is null, we still want to send a full object with all attributes being null + if !unmarkedBlockVal.IsNull() && unmarkedBlockVal.GetAttr("config").IsNull() { + mp := unmarkedBlockVal.AsValueMap() + mp["config"] = schema.ConfigSchema.EmptyValue() + unmarkedBlockVal = cty.ObjectVal(mp) + } + validateResp := provider.ValidateListResourceConfig( providers.ValidateListResourceConfigRequest{ TypeName: n.Config.Type, diff --git a/internal/terraform/node_resource_validate.go b/internal/terraform/node_resource_validate.go index 8d106bc16856..7dd60e24c177 100644 --- a/internal/terraform/node_resource_validate.go +++ b/internal/terraform/node_resource_validate.go @@ -471,8 +471,8 @@ func (n *NodeValidatableResource) validateResource(ctx EvalContext) tfdiags.Diag resp := provider.ValidateEphemeralResourceConfig(req) diags = diags.Append(resp.Diagnostics.InConfigBody(n.Config.Config, n.Addr.String())) case addrs.ListResourceMode: - schema := providerSchema.SchemaForResourceType(n.Config.Mode, n.Config.Type) - if schema.Body == nil { + schema := providerSchema.SchemaForListResourceType(n.Config.Type) + if schema.IsNil() { diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: "Invalid list resource", @@ -482,7 +482,7 @@ func (n *NodeValidatableResource) validateResource(ctx EvalContext) tfdiags.Diag return diags } - blockVal, _, valDiags := ctx.EvaluateBlock(n.Config.Config, schema.Body, nil, keyData) + blockVal, _, valDiags := ctx.EvaluateBlock(n.Config.Config, schema.FullSchema, nil, keyData) diags = diags.Append(valDiags) if valDiags.HasErrors() { return diags @@ -502,6 +502,13 @@ func (n *NodeValidatableResource) validateResource(ctx EvalContext) tfdiags.Diag // Use unmarked value for validate request unmarkedBlockVal, _ := blockVal.UnmarkDeep() + + // if the config value is null, we still want to send a full object with all attributes being null + if !unmarkedBlockVal.IsNull() && unmarkedBlockVal.GetAttr("config").IsNull() { + mp := unmarkedBlockVal.AsValueMap() + mp["config"] = schema.ConfigSchema.EmptyValue() + unmarkedBlockVal = cty.ObjectVal(mp) + } req := providers.ValidateListResourceConfigRequest{ TypeName: n.Config.Type, Config: unmarkedBlockVal, From 1e414491c7f586a58c026f302eff9baf73dd9b83 Mon Sep 17 00:00:00 2001 From: Liam Cervante Date: Wed, 24 Sep 2025 16:27:43 +0200 Subject: [PATCH 12/27] evaluate: return diagnostics instead of unknown for uninitialised locals and resources (#37663) * evaluate: return diagnostics instead of unknown for uninitialised locals and resources * changelog * also input variables --- .changes/v1.14/BUG FIXES-20250924-110416.yaml | 5 + internal/command/test_test.go | 129 +++++++++++++++++- .../invalid-reference-with-target/main.tf | 10 ++ .../main.tftest.hcl | 17 +++ .../terraform/context_plan_actions_test.go | 1 + internal/terraform/evaluate.go | 32 ++++- 6 files changed, 184 insertions(+), 10 deletions(-) create mode 100644 .changes/v1.14/BUG FIXES-20250924-110416.yaml create mode 100644 internal/command/testdata/test/invalid-reference-with-target/main.tf create mode 100644 internal/command/testdata/test/invalid-reference-with-target/main.tftest.hcl diff --git a/.changes/v1.14/BUG FIXES-20250924-110416.yaml b/.changes/v1.14/BUG FIXES-20250924-110416.yaml new file mode 100644 index 000000000000..3ddb833d6ea4 --- /dev/null +++ b/.changes/v1.14/BUG FIXES-20250924-110416.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: 'console and test: return explicit diagnostics when referencing resources that were not included in the most recent operation.' +time: 2025-09-24T11:04:16.860364+02:00 +custom: + Issue: "37663" diff --git a/internal/command/test_test.go b/internal/command/test_test.go index 36b05cb9e418..7d8e6a91c5b4 100644 --- a/internal/command/test_test.go +++ b/internal/command/test_test.go @@ -412,11 +412,6 @@ func TestTest_Runs(t *testing.T) { "no-tests": { code: 0, }, - "expect-failures-assertions": { - expectedOut: []string{"0 passed, 1 failed."}, - expectedErr: []string{"Test assertion failed"}, - code: 1, - }, } for name, tc := range tcs { t.Run(name, func(t *testing.T) { @@ -5454,6 +5449,130 @@ func TestTest_JUnitOutput(t *testing.T) { } } +func TestTest_ReferencesIntoIncompletePlan(t *testing.T) { + td := t.TempDir() + testCopyDir(t, testFixturePath(path.Join("test", "expect-failures-assertions")), td) + t.Chdir(td) + + provider := testing_command.NewProvider(nil) + providerSource, close := newMockProviderSource(t, map[string][]string{ + "test": {"1.0.0"}, + }) + defer close() + + streams, done := terminal.StreamsForTesting(t) + view := views.NewView(streams) + ui := new(cli.MockUi) + + meta := Meta{ + testingOverrides: metaOverridesForProvider(provider.Provider), + Ui: ui, + View: view, + Streams: streams, + ProviderSource: providerSource, + } + + init := &InitCommand{ + Meta: meta, + } + + if code := init.Run(nil); code != 0 { + output := done(t) + t.Fatalf("expected status code %d but got %d: %s", 0, code, output.All()) + } + + // Reset the streams for the next command. + streams, done = terminal.StreamsForTesting(t) + meta.Streams = streams + meta.View = views.NewView(streams) + + c := &TestCommand{ + Meta: meta, + } + + code := c.Run([]string{"-no-color"}) + if code != 1 { + t.Errorf("expected status code %d but got %d", 0, code) + } + output := done(t) + + out, err := output.Stdout(), output.Stderr() + + expectedOut := `main.tftest.hcl... in progress + run "fail"... fail +main.tftest.hcl... tearing down +main.tftest.hcl... fail + +Failure! 0 passed, 1 failed. +` + + if diff := cmp.Diff(out, expectedOut); len(diff) > 0 { + t.Errorf("expected:\n%s\nactual:\n%s\ndiff:\n%s", expectedOut, out, diff) + } + + if !strings.Contains(err, "Reference to uninitialized resource") { + t.Errorf("missing reference to uninitialized resource error: \n%s", err) + } + + if !strings.Contains(err, "Reference to uninitialized local") { + t.Errorf("missing reference to uninitialized local error: \n%s", err) + } +} + +func TestTest_ReferencesIntoTargetedPlan(t *testing.T) { + td := t.TempDir() + testCopyDir(t, testFixturePath(path.Join("test", "invalid-reference-with-target")), td) + t.Chdir(td) + + provider := testing_command.NewProvider(nil) + providerSource, close := newMockProviderSource(t, map[string][]string{ + "test": {"1.0.0"}, + }) + defer close() + + streams, done := terminal.StreamsForTesting(t) + view := views.NewView(streams) + ui := new(cli.MockUi) + + meta := Meta{ + testingOverrides: metaOverridesForProvider(provider.Provider), + Ui: ui, + View: view, + Streams: streams, + ProviderSource: providerSource, + } + + init := &InitCommand{ + Meta: meta, + } + + if code := init.Run(nil); code != 0 { + output := done(t) + t.Fatalf("expected status code %d but got %d: %s", 0, code, output.All()) + } + + // Reset the streams for the next command. + streams, done = terminal.StreamsForTesting(t) + meta.Streams = streams + meta.View = views.NewView(streams) + + c := &TestCommand{ + Meta: meta, + } + + code := c.Run([]string{"-no-color"}) + if code != 1 { + t.Errorf("expected status code %d but got %d", 0, code) + } + output := done(t) + + err := output.Stderr() + + if !strings.Contains(err, "Reference to uninitialized variable") { + t.Errorf("missing reference to uninitialized variable error: \n%s", err) + } +} + // https://github.com/hashicorp/terraform/issues/37546 func TestTest_TeardownOrder(t *testing.T) { td := t.TempDir() diff --git a/internal/command/testdata/test/invalid-reference-with-target/main.tf b/internal/command/testdata/test/invalid-reference-with-target/main.tf new file mode 100644 index 000000000000..1b912297a3b5 --- /dev/null +++ b/internal/command/testdata/test/invalid-reference-with-target/main.tf @@ -0,0 +1,10 @@ + +variable "input" { + type = string +} + +resource "test_resource" "one" { + value = var.input +} + +resource "test_resource" "two" {} \ No newline at end of file diff --git a/internal/command/testdata/test/invalid-reference-with-target/main.tftest.hcl b/internal/command/testdata/test/invalid-reference-with-target/main.tftest.hcl new file mode 100644 index 000000000000..9b9aac66126d --- /dev/null +++ b/internal/command/testdata/test/invalid-reference-with-target/main.tftest.hcl @@ -0,0 +1,17 @@ + +run "test" { + command = plan + + plan_options { + target = [test_resource.two] + } + + variables { + input = "hello" + } + + assert { + condition = var.input == "hello" + error_message = "wrong input" + } +} \ No newline at end of file diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index c82245b72612..99a482682957 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -176,6 +176,7 @@ list "test_resource" "test1" { }, }, "query run, action references resource": { + toBeImplemented: true, // TODO: Fix the graph built by query operations. module: map[string]string{ "main.tf": ` action "test_action" "hello" { diff --git a/internal/terraform/evaluate.go b/internal/terraform/evaluate.go index 6a1cb5163cc5..68c9d8aba5b7 100644 --- a/internal/terraform/evaluate.go +++ b/internal/terraform/evaluate.go @@ -297,7 +297,18 @@ func (d *evaluationStateData) GetInputVariable(addr addrs.InputVariable, rng tfd return ret, diags } - val := d.Evaluator.NamedValues.GetInputVariableValue(d.ModulePath.InputVariable(addr.Name)) + var val cty.Value + if target := d.ModulePath.InputVariable(addr.Name); !d.Evaluator.NamedValues.HasInputVariableValue(target) { + val = cty.DynamicVal + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Reference to uninitialized variable", + Detail: fmt.Sprintf("The variable %s was not processed by the most recent operation, this likely means the previous operation either failed or was incomplete due to targeting.", addr), + Subject: rng.ToHCL().Ptr(), + }) + } else { + val = d.Evaluator.NamedValues.GetInputVariableValue(target) + } // Mark if sensitive and/or ephemeral if config.Sensitive { @@ -342,11 +353,17 @@ func (d *evaluationStateData) GetLocalValue(addr addrs.LocalValue, rng tfdiags.S return cty.DynamicVal, diags } - if target := addr.Absolute(d.ModulePath); d.Evaluator.NamedValues.HasLocalValue(target) { - return d.Evaluator.NamedValues.GetLocalValue(addr.Absolute(d.ModulePath)), diags + target := addr.Absolute(d.ModulePath) + if !d.Evaluator.NamedValues.HasLocalValue(target) { + return cty.DynamicVal, diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Reference to uninitialized local value", + Detail: fmt.Sprintf("The local value %s was not processed by the most recent operation, this likely means the previous operation either failed or was incomplete due to targeting.", addr), + Subject: rng.ToHCL().Ptr(), + }) } - return cty.DynamicVal, diags + return d.Evaluator.NamedValues.GetLocalValue(target), diags } func (d *evaluationStateData) GetModule(addr addrs.ModuleCall, rng tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) { @@ -556,7 +573,12 @@ func (d *evaluationStateData) GetResource(addr addrs.Resource, rng tfdiags.Sourc if addr.Mode == addrs.EphemeralResourceMode { unknownVal = unknownVal.Mark(marks.Ephemeral) } - return unknownVal, diags + return unknownVal, diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Reference to uninitialized resource", + Detail: fmt.Sprintf("The resource %s was not processed by the most recent operation, this likely means the previous operation either failed or was incomplete due to targeting.", addr), + Subject: rng.ToHCL().Ptr(), + }) } if _, _, hasUnknownKeys := d.Evaluator.Instances.ResourceInstanceKeys(addr.Absolute(moduleAddr)); hasUnknownKeys { From b9522561c8787473c8c12c0afe177f3bf4b538da Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Wed, 24 Sep 2025 16:21:23 +0100 Subject: [PATCH 13/27] PSS: Add reusable method for obtaining the provider factory needed for accessing a state store. (#37665) * Add method to allow accessing factories from locks that are in memory * Create new getStateStoreProviderFactory method for accessing a factory from config * Update getStateStoreProviderFactory to use in memory locks instead of reading them from the deps lock file. Update calling code to accommodate this. * Add tests for getStateStoreProviderFactory, improve errors returned from method * Update test following schema change in simple providers * Move test case into e2etest package, so we protect against environments where building binaries isn't possible * Fix issues with running test in e2etest package * Update code comments Co-authored-by: Radek Simko --------- Co-authored-by: Radek Simko --- internal/command/e2etest/meta_backend_test.go | 85 +++++++++++++++++++ .../command/e2etest/providers_schema_test.go | 2 + internal/command/init.go | 33 +------ internal/command/init_run.go | 6 +- internal/command/init_run_experiment.go | 4 +- internal/command/meta.go | 2 +- internal/command/meta_backend.go | 52 ++++++++++++ internal/command/meta_backend_test.go | 77 +++++++++++++++++ internal/command/meta_providers.go | 34 +++++++- internal/provider-simple-v6/provider.go | 4 +- internal/provider-simple/provider.go | 4 +- 11 files changed, 263 insertions(+), 40 deletions(-) create mode 100644 internal/command/e2etest/meta_backend_test.go diff --git a/internal/command/e2etest/meta_backend_test.go b/internal/command/e2etest/meta_backend_test.go new file mode 100644 index 000000000000..c14898ff383e --- /dev/null +++ b/internal/command/e2etest/meta_backend_test.go @@ -0,0 +1,85 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package e2etest + +import ( + "fmt" + "os" + "path/filepath" + "testing" + + "github.com/apparentlymart/go-versions/versions" + tfaddr "github.com/hashicorp/terraform-registry-address" + "github.com/hashicorp/terraform/internal/addrs" + "github.com/hashicorp/terraform/internal/command" + "github.com/hashicorp/terraform/internal/configs" + "github.com/hashicorp/terraform/internal/depsfile" + "github.com/hashicorp/terraform/internal/e2e" + "github.com/hashicorp/terraform/internal/getproviders" + "github.com/hashicorp/terraform/internal/getproviders/providerreqs" +) + +func TestMetaBackend_GetStateStoreProviderFactory(t *testing.T) { + t.Run("gets the matching factory from local provider cache", func(t *testing.T) { + if !canRunGoBuild { + // We're running in a separate-build-then-run context, so we can't + // currently execute this test which depends on being able to build + // new executable at runtime. + // + // (See the comment on canRunGoBuild's declaration for more information.) + t.Skip("can't run without building a new provider executable") + } + + // Set up locks + locks := depsfile.NewLocks() + providerAddr := addrs.MustParseProviderSourceString("registry.terraform.io/hashicorp/simple") + constraint, err := providerreqs.ParseVersionConstraints(">1.0.0") + if err != nil { + t.Fatalf("test setup failed when making constraint: %s", err) + } + locks.SetProvider( + providerAddr, + versions.MustParseVersion("9.9.9"), + constraint, + []providerreqs.Hash{""}, + ) + + // Set up a local provider cache for the test to use + // 1. Build a binary for the current platform + simple6Provider := filepath.Join(".", "terraform-provider-simple6") + simple6ProviderExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/provider-simple-v6/main", simple6Provider) + // 2. Create a working directory with .terraform/providers directory + td := t.TempDir() + t.Chdir(td) + providerPath := fmt.Sprintf(".terraform/providers/registry.terraform.io/hashicorp/simple/9.9.9/%s", getproviders.CurrentPlatform.String()) + err = os.MkdirAll(providerPath, os.ModePerm) + if err != nil { + t.Fatal(err) + } + // 3. Move the binary into the cache folder created above. + os.Rename(simple6ProviderExe, fmt.Sprintf("%s/%s/terraform-provider-simple", td, providerPath)) + + config := &configs.StateStore{ + ProviderAddr: tfaddr.MustParseProviderSource("registry.terraform.io/hashicorp/simple"), + // No other fields necessary for test. + } + + // Setup the meta and test GetStateStoreProviderFactory + m := command.Meta{} + factory, diags := m.GetStateStoreProviderFactory(config, locks) + if diags.HasErrors() { + t.Fatalf("unexpected error : %s", err) + } + + p, _ := factory() + defer p.Close() + s := p.GetProviderSchema() + expectedProviderDescription := "This is terraform-provider-simple v6" + if s.Provider.Body.Description != expectedProviderDescription { + t.Fatalf("expected description to be %q, but got %q", expectedProviderDescription, s.Provider.Body.Description) + } + }) + + // See command/meta_backend_test.go for other test cases +} diff --git a/internal/command/e2etest/providers_schema_test.go b/internal/command/e2etest/providers_schema_test.go index 582a21710c21..d729afdbacd6 100644 --- a/internal/command/e2etest/providers_schema_test.go +++ b/internal/command/e2etest/providers_schema_test.go @@ -71,6 +71,7 @@ func TestProvidersSchema(t *testing.T) { "provider": { "version": 0, "block": { + "description": "This is terraform-provider-simple v5", "description_kind": "plain" } }, @@ -165,6 +166,7 @@ func TestProvidersSchema(t *testing.T) { "provider": { "version": 0, "block": { + "description": "This is terraform-provider-simple v6", "description_kind": "plain" } }, diff --git a/internal/command/init.go b/internal/command/init.go index 114ce62a291b..984c6be63f87 100644 --- a/internal/command/init.go +++ b/internal/command/init.go @@ -159,7 +159,7 @@ func (c *InitCommand) initCloud(ctx context.Context, root *configs.Module, extra return back, true, diags } -func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, extraConfig arguments.FlagNameValueSlice, viewType arguments.ViewType, view views.Init) (be backend.Backend, output bool, diags tfdiags.Diagnostics) { +func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, extraConfig arguments.FlagNameValueSlice, viewType arguments.ViewType, configLocks *depsfile.Locks, view views.Init) (be backend.Backend, output bool, diags tfdiags.Diagnostics) { ctx, span := tracer.Start(ctx, "initialize backend") _ = ctx // prevent staticcheck from complaining to avoid a maintenance hazard of having the wrong ctx in scope here defer span.End() @@ -187,34 +187,9 @@ func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, ext return nil, true, diags case root.StateStore != nil: // state_store config present - // Access provider factories - ctxOpts, err := c.contextOpts() - if err != nil { - diags = diags.Append(err) - return nil, true, diags - } - - if root.StateStore.ProviderAddr.IsZero() { - // This should not happen; this data is populated when parsing config, - // even for builtin providers - panic(fmt.Sprintf("unknown provider while beginning to initialize state store %q from provider %q", - root.StateStore.Type, - root.StateStore.Provider.Name)) - } - - var exists bool - factory, exists := ctxOpts.Providers[root.StateStore.ProviderAddr] - if !exists { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Provider unavailable", - Detail: fmt.Sprintf("The provider %s (%q) is required to initialize the %q state store, but the matching provider factory is missing. This is a bug in Terraform and should be reported.", - root.StateStore.Provider.Name, - root.StateStore.ProviderAddr, - root.StateStore.Type, - ), - Subject: &root.StateStore.TypeRange, - }) + factory, fDiags := c.Meta.GetStateStoreProviderFactory(root.StateStore, configLocks) + diags = diags.Append(fDiags) + if fDiags.HasErrors() { return nil, true, diags } diff --git a/internal/command/init_run.go b/internal/command/init_run.go index a030e856d97d..e2f4044dcad2 100644 --- a/internal/command/init_run.go +++ b/internal/command/init_run.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform/internal/command/arguments" "github.com/hashicorp/terraform/internal/command/views" "github.com/hashicorp/terraform/internal/configs" + "github.com/hashicorp/terraform/internal/depsfile" "github.com/hashicorp/terraform/internal/states" "github.com/hashicorp/terraform/internal/terraform" "github.com/hashicorp/terraform/internal/tfdiags" @@ -170,7 +171,10 @@ func (c *InitCommand) run(initArgs *arguments.Init, view views.Init) int { case initArgs.Cloud && rootModEarly.CloudConfig != nil: back, backendOutput, backDiags = c.initCloud(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) case initArgs.Backend: - back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) + // initBackend has new parameters that aren't relevant to the original (unpluggable) version of the init command logic here. + // So for this version of the init command, we pass in empty locks intentionally. + emptyLocks := depsfile.NewLocks() + back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, emptyLocks, view) default: // load the previously-stored backend config back, backDiags = c.Meta.backendFromState(ctx) diff --git a/internal/command/init_run_experiment.go b/internal/command/init_run_experiment.go index db97b9b40b02..f546f1444f5b 100644 --- a/internal/command/init_run_experiment.go +++ b/internal/command/init_run_experiment.go @@ -205,9 +205,7 @@ func (c *InitCommand) runPssInit(initArgs *arguments.Init, view views.Init) int case initArgs.Cloud && rootModEarly.CloudConfig != nil: back, backendOutput, backDiags = c.initCloud(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) case initArgs.Backend: - // TODO(SarahFrench/radeksimko) - pass information about config locks (`configLocks`) into initBackend to - // enable PSS - back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) + back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, configLocks, view) default: // load the previously-stored backend config back, backDiags = c.Meta.backendFromState(ctx) diff --git a/internal/command/meta.go b/internal/command/meta.go index 1626109fbfb4..b7e60acc1c6e 100644 --- a/internal/command/meta.go +++ b/internal/command/meta.go @@ -546,7 +546,7 @@ func (m *Meta) contextOpts() (*terraform.ContextOpts, error) { opts.Provisioners = m.testingOverrides.Provisioners } else { var providerFactories map[addrs.Provider]providers.Factory - providerFactories, err = m.providerFactories() + providerFactories, err = m.ProviderFactories() opts.Providers = providerFactories opts.Provisioners = m.provisionerFactories() } diff --git a/internal/command/meta_backend.go b/internal/command/meta_backend.go index 41ef334afbb2..059ef2993771 100644 --- a/internal/command/meta_backend.go +++ b/internal/command/meta_backend.go @@ -33,6 +33,7 @@ import ( "github.com/hashicorp/terraform/internal/command/views" "github.com/hashicorp/terraform/internal/command/workdir" "github.com/hashicorp/terraform/internal/configs" + "github.com/hashicorp/terraform/internal/depsfile" "github.com/hashicorp/terraform/internal/didyoumean" "github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/providers" @@ -1746,6 +1747,57 @@ func (m *Meta) assertSupportedCloudInitOptions(mode cloud.ConfigChangeMode) tfdi return diags } +func (m *Meta) GetStateStoreProviderFactory(config *configs.StateStore, locks *depsfile.Locks) (providers.Factory, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + + if config == nil || locks == nil { + panic(fmt.Sprintf("nil config or nil locks passed to GetStateStoreProviderFactory: config %#v, locks %#v", config, locks)) + } + + if config.ProviderAddr.IsZero() { + // This should not happen; this data is populated when parsing config, + // even for builtin providers + return nil, diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Unknown provider used for state storage", + Detail: "Terraform could not find the provider used with the state_store. This is a bug in Terraform and should be reported.", + Subject: &config.TypeRange, + }) + } + + factories, err := m.ProviderFactoriesFromLocks(locks) + if err != nil { + // This may happen if the provider isn't present in the provider cache. + // This should be caught earlier by logic that diffs the config against the backend state file. + return nil, diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Provider unavailable", + Detail: fmt.Sprintf("Terraform experienced an error when trying to use provider %s (%q) to initialize the %q state store: %s", + config.Provider.Name, + config.ProviderAddr, + config.Type, + err), + Subject: &config.TypeRange, + }) + } + + factory, exists := factories[config.ProviderAddr] + if !exists { + return nil, diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Provider unavailable", + Detail: fmt.Sprintf("The provider %s (%q) is required to initialize the %q state store, but the matching provider factory is missing. This is a bug in Terraform and should be reported.", + config.Provider.Name, + config.ProviderAddr, + config.Type, + ), + Subject: &config.TypeRange, + }) + } + + return factory, diags +} + //------------------------------------------------------------------- // Output constants and initialization code //------------------------------------------------------------------- diff --git a/internal/command/meta_backend_test.go b/internal/command/meta_backend_test.go index 9f049ccf0871..9821bfe9903c 100644 --- a/internal/command/meta_backend_test.go +++ b/internal/command/meta_backend_test.go @@ -13,7 +13,9 @@ import ( "strings" "testing" + "github.com/apparentlymart/go-versions/versions" "github.com/hashicorp/cli" + tfaddr "github.com/hashicorp/terraform-registry-address" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/cloud" @@ -21,6 +23,8 @@ import ( "github.com/hashicorp/terraform/internal/configs" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/copy" + "github.com/hashicorp/terraform/internal/depsfile" + "github.com/hashicorp/terraform/internal/getproviders/providerreqs" "github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/providers" testing_provider "github.com/hashicorp/terraform/internal/providers/testing" @@ -2397,6 +2401,79 @@ func TestMetaBackend_configureStateStoreVariableUse(t *testing.T) { } } +func TestMetaBackend_GetStateStoreProviderFactory(t *testing.T) { + // See internal/command/e2etest/meta_backend_test.go for test case + // where a provider factory is found using a local provider cache + + t.Run("returns an error if a matching factory can't be found", func(t *testing.T) { + // Set up locks + locks := depsfile.NewLocks() + providerAddr := addrs.MustParseProviderSourceString("registry.terraform.io/hashicorp/simple") + constraint, err := providerreqs.ParseVersionConstraints(">1.0.0") + if err != nil { + t.Fatalf("test setup failed when making constraint: %s", err) + } + locks.SetProvider( + providerAddr, + versions.MustParseVersion("9.9.9"), + constraint, + []providerreqs.Hash{""}, + ) + + config := &configs.StateStore{ + ProviderAddr: tfaddr.MustParseProviderSource("registry.terraform.io/hashicorp/simple"), + Provider: &configs.Provider{ + Name: "foobar", + }, + Type: "store", + } + + // Setup the meta and test providerFactoriesDuringInit + m := testMetaBackend(t, nil) + _, diags := m.GetStateStoreProviderFactory(config, locks) + if !diags.HasErrors() { + t.Fatalf("expected error but got none") + } + expectedErr := "Provider unavailable" + expectedDetail := "Terraform experienced an error when trying to use provider foobar (\"registry.terraform.io/hashicorp/simple\") to initialize the \"store\" state store" + if diags[0].Description().Summary != expectedErr { + t.Fatalf("expected error summary to include %q but got: %s", + expectedErr, + diags[0].Description().Summary, + ) + } + if !strings.Contains(diags[0].Description().Detail, expectedDetail) { + t.Fatalf("expected error detail to include %q but got: %s", + expectedErr, + diags[0].Description().Detail, + ) + } + }) + + t.Run("returns an error if provider addr data is missing", func(t *testing.T) { + // Only minimal locks needed + locks := depsfile.NewLocks() + + config := &configs.StateStore{ + ProviderAddr: tfaddr.Provider{}, // Empty + } + + // Setup the meta and test providerFactoriesDuringInit + m := testMetaBackend(t, nil) + _, diags := m.GetStateStoreProviderFactory(config, locks) + if !diags.HasErrors() { + t.Fatal("expected and error but got none") + } + expectedErr := "Unknown provider used for state storage" + if !strings.Contains(diags.Err().Error(), expectedErr) { + t.Fatalf("expected error to include %q but got: %s", + expectedErr, + diags.Err().Error(), + ) + } + }) +} + func testMetaBackend(t *testing.T, args []string) *Meta { var m Meta m.Ui = new(cli.MockUi) diff --git a/internal/command/meta_providers.go b/internal/command/meta_providers.go index 9d8bd2763aac..8a356b966555 100644 --- a/internal/command/meta_providers.go +++ b/internal/command/meta_providers.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform/internal/addrs" builtinProviders "github.com/hashicorp/terraform/internal/builtin/providers" + "github.com/hashicorp/terraform/internal/depsfile" "github.com/hashicorp/terraform/internal/getproviders" "github.com/hashicorp/terraform/internal/logging" tfplugin "github.com/hashicorp/terraform/internal/plugin" @@ -246,23 +247,48 @@ func (m *Meta) providerDevOverrideRuntimeWarningsRemoteExecution() tfdiags.Diagn } } -// providerFactories uses the selections made previously by an installer in +// ProviderFactories uses the selections made previously by an installer in // the local cache directory (m.providerLocalCacheDir) to produce a map -// from provider addresses to factory functions to create instances of +// of provider addresses to factory functions to create instances of // those providers. // -// providerFactories will return an error if the installer's selections cannot +// ProviderFactories will return an error if the installer's selections cannot // be honored with what is currently in the cache, such as if a selected // package has been removed from the cache or if the contents of a selected // package have been modified outside of the installer. If it returns an error, // the returned map may be incomplete or invalid, but will be as complete // as possible given the cause of the error. -func (m *Meta) providerFactories() (map[addrs.Provider]providers.Factory, error) { +func (m *Meta) ProviderFactories() (map[addrs.Provider]providers.Factory, error) { locks, diags := m.lockedDependencies() if diags.HasErrors() { return nil, fmt.Errorf("failed to read dependency lock file: %s", diags.Err()) } + return m.providerFactoriesFromLocks(locks) +} + +// ProviderFactoriesFromLocks receives in memory locks and uses them to produce a map +// of provider addresses to factory functions to create instances of +// those providers. +// +// ProviderFactoriesFromLocks should only be used if the calling code relies on locks +// that have not yet been persisted to a dependency lock file on disk. Realistically, this +// means only code in the init command should use this method. +func (m *Meta) ProviderFactoriesFromLocks(configLocks *depsfile.Locks) (map[addrs.Provider]providers.Factory, error) { + // Ensure overrides and unmanaged providers are reflected in the returned list of factories, + // while avoiding mutating the in-memory + locks := m.annotateDependencyLocksWithOverrides(configLocks.DeepCopy()) + + return m.providerFactoriesFromLocks(locks) +} + +// providerFactoriesFromLocks returns a map of provider factories from a given set of locks. +// +// In most cases, calling code should not use this method directly. +// Instead, use: +// * `ProviderFactoriesFromLocks` - for use when locks aren't yet persisted to a dependency lock file. +// * `ProviderFactories` - for use when Terraform is guaranteed to read all necessary locks from a dependency lock file. +func (m *Meta) providerFactoriesFromLocks(locks *depsfile.Locks) (map[addrs.Provider]providers.Factory, error) { // We'll always run through all of our providers, even if one of them // encounters an error, so that we can potentially report multiple errors // where appropriate and so that callers can potentially make use of the diff --git a/internal/provider-simple-v6/provider.go b/internal/provider-simple-v6/provider.go index 45462d08bb39..dae2e4a728b4 100644 --- a/internal/provider-simple-v6/provider.go +++ b/internal/provider-simple-v6/provider.go @@ -49,7 +49,9 @@ func Provider() providers.Interface { return simple{ schema: providers.GetProviderSchemaResponse{ Provider: providers.Schema{ - Body: nil, + Body: &configschema.Block{ + Description: "This is terraform-provider-simple v6", + }, }, ResourceTypes: map[string]providers.Schema{ "simple_resource": simpleResource, diff --git a/internal/provider-simple/provider.go b/internal/provider-simple/provider.go index 1da26521350d..314ca9fcd5b3 100644 --- a/internal/provider-simple/provider.go +++ b/internal/provider-simple/provider.go @@ -47,7 +47,9 @@ func Provider() providers.Interface { return simple{ schema: providers.GetProviderSchemaResponse{ Provider: providers.Schema{ - Body: nil, + Body: &configschema.Block{ + Description: "This is terraform-provider-simple v5", + }, }, ResourceTypes: map[string]providers.Schema{ "simple_resource": simpleResource, From ab41592fb74f0805375aa7b0144fd77228bbdb31 Mon Sep 17 00:00:00 2001 From: Samsondeen <40821565+dsa0x@users.noreply.github.com> Date: Thu, 25 Sep 2025 13:50:34 +0200 Subject: [PATCH 14/27] query: propagate graph node removal to descendants (#37664) --- internal/backend/local/backend_local.go | 4 +- internal/terraform/context_apply2_test.go | 75 ++++ .../terraform/context_plan_actions_test.go | 24 +- internal/terraform/context_plan_query_test.go | 408 +++++++++--------- internal/terraform/context_validate.go | 4 + internal/terraform/context_validate_test.go | 81 +++- internal/terraform/graph_builder_apply.go | 4 - internal/terraform/graph_builder_plan.go | 11 +- internal/terraform/terraform_test.go | 13 +- internal/terraform/transform_config.go | 11 - internal/terraform/transform_query.go | 56 +++ 11 files changed, 432 insertions(+), 259 deletions(-) create mode 100644 internal/terraform/transform_query.go diff --git a/internal/backend/local/backend_local.go b/internal/backend/local/backend_local.go index 962663af3573..4e900de9efd7 100644 --- a/internal/backend/local/backend_local.go +++ b/internal/backend/local/backend_local.go @@ -132,7 +132,9 @@ func (b *Local) localRun(op *backendrun.Operation) (*backendrun.LocalRun, *confi // If validation is enabled, validate if b.OpValidation { log.Printf("[TRACE] backend/local: running validation operation") - validateDiags := ret.Core.Validate(ret.Config, nil) + // TODO: Implement query validate command. op.Query is false when running the command "terraform validate" + opts := &terraform.ValidateOpts{Query: op.Query} + validateDiags := ret.Core.Validate(ret.Config, opts) diags = diags.Append(validateDiags) } } diff --git a/internal/terraform/context_apply2_test.go b/internal/terraform/context_apply2_test.go index 098288715d56..d9e6b16e23b2 100644 --- a/internal/terraform/context_apply2_test.go +++ b/internal/terraform/context_apply2_test.go @@ -4271,3 +4271,78 @@ resource "test_resource" "foo" { t.Fatalf("missing identity in state, got %q", fooState.Current.IdentityJSON) } } + +func TestContext2Apply_noListValidated(t *testing.T) { + tests := map[string]struct { + name string + mainConfig string + queryConfig string + query bool + }{ + "query files not validated in default validate mode": { + mainConfig: ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + `, + queryConfig: ` + // This config is invalid, but should not be validated in default validate mode + list "test_resource" "test" { + provider = test + + config { + filter = { + attr = list.non_existent.attr + } + } + } + + locals { + test = list.non_existent.attr + } + `, + query: false, + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + configFiles := map[string]string{"main.tf": tc.mainConfig} + if tc.queryConfig != "" { + configFiles["main.tfquery.hcl"] = tc.queryConfig + } + + opts := []configs.Option{} + if tc.query { + opts = append(opts, configs.MatchQueryFiles()) + } + + m := testModuleInline(t, configFiles, opts...) + + p := testProvider("test") + p.GetProviderSchemaResponse = getListProviderSchemaResp() + + ctx := testContext2(t, &ContextOpts{ + Providers: map[addrs.Provider]providers.Factory{ + addrs.NewDefaultProvider("test"): testProviderFuncFixed(p), + }, + }) + + diags := ctx.Validate(m, &ValidateOpts{ + Query: tc.query, + }) + tfdiags.AssertNoErrors(t, diags) + + plan, diags := ctx.Plan(m, states.NewState(), SimplePlanOpts(plans.NormalMode, testInputValuesUnset(m.Module.Variables))) + tfdiags.AssertNoErrors(t, diags) + + _, diags = ctx.Apply(plan, m, nil) + tfdiags.AssertNoErrors(t, diags) + }) + } +} diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index 99a482682957..f9d8782397ea 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -176,12 +176,11 @@ list "test_resource" "test1" { }, }, "query run, action references resource": { - toBeImplemented: true, // TODO: Fix the graph built by query operations. module: map[string]string{ "main.tf": ` action "test_action" "hello" { config { - attr = resource.test_object.a + attr = resource.test_object.a.name } } resource "test_object" "a" { @@ -3313,7 +3312,17 @@ resource "test_object" "a" { t.Skip("Test not implemented yet") } - m := testModuleInline(t, tc.module) + opts := SimplePlanOpts(plans.NormalMode, InputValues{}) + if tc.planOpts != nil { + opts = tc.planOpts + } + + configOpts := []configs.Option{} + if opts.Query { + configOpts = append(configOpts, configs.MatchQueryFiles()) + } + + m := testModuleInline(t, tc.module, configOpts...) p := &testing_provider.MockProvider{ GetProviderSchemaResponse: &providers.GetProviderSchemaResponse{ @@ -3444,7 +3453,9 @@ resource "test_object" "a" { }, }) - diags := ctx.Validate(m, &ValidateOpts{}) + diags := ctx.Validate(m, &ValidateOpts{ + Query: opts.Query, + }) if tc.expectValidateDiagnostics != nil { tfdiags.AssertDiagnosticsMatch(t, diags, tc.expectValidateDiagnostics(m)) } else if tc.assertValidateDiagnostics != nil { @@ -3462,11 +3473,6 @@ resource "test_object" "a" { prevRunState = states.BuildState(tc.buildState) } - opts := SimplePlanOpts(plans.NormalMode, InputValues{}) - if tc.planOpts != nil { - opts = tc.planOpts - } - plan, diags := ctx.Plan(m, prevRunState, opts) if tc.expectPlanDiagnostics != nil { diff --git a/internal/terraform/context_plan_query_test.go b/internal/terraform/context_plan_query_test.go index 7578fe0c1d8e..902f6cf972bc 100644 --- a/internal/terraform/context_plan_query_test.go +++ b/internal/terraform/context_plan_query_test.go @@ -5,7 +5,6 @@ package terraform import ( "fmt" - "maps" "sort" "strings" "testing" @@ -14,6 +13,7 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform/internal/addrs" + "github.com/hashicorp/terraform/internal/configs" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/providers" @@ -24,6 +24,44 @@ import ( ) func TestContext2Plan_queryList(t *testing.T) { + listResourceFn := func(request providers.ListResourceRequest) providers.ListResourceResponse { + instanceTypes := []string{"ami-123456", "ami-654321", "ami-789012"} + madeUp := []cty.Value{} + for i := range len(instanceTypes) { + madeUp = append(madeUp, cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal(instanceTypes[i])})) + } + + ids := []cty.Value{} + for i := range madeUp { + ids = append(ids, cty.ObjectVal(map[string]cty.Value{ + "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), + })) + } + + resp := []cty.Value{} + for i, v := range madeUp { + mp := map[string]cty.Value{ + "identity": ids[i], + "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), + } + if request.IncludeResourceObject { + mp["state"] = v + } + resp = append(resp, cty.ObjectVal(mp)) + } + + ret := map[string]cty.Value{ + "data": cty.TupleVal(resp), + } + for k, v := range request.Config.AsValueMap() { + if k != "data" { + ret[k] = v + } + } + + return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} + } + cases := []struct { name string mainConfig string @@ -33,6 +71,7 @@ func TestContext2Plan_queryList(t *testing.T) { transformSchema func(*providers.GetProviderSchemaResponse) assertState func(*states.State) assertValidateDiags func(t *testing.T, diags tfdiags.Diagnostics) + assertPlanDiags func(t *testing.T, diags tfdiags.Diagnostics) assertChanges func(providers.ProviderSchema, *plans.ChangesSrc) listResourceFn func(request providers.ListResourceRequest) providers.ListResourceResponse }{ @@ -75,39 +114,8 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - generatedPath: t.TempDir(), - listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { - madeUp := []cty.Value{ - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-123456")}), - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-654321")}), - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-789012")}), - } - ids := []cty.Value{} - for i := range madeUp { - ids = append(ids, cty.ObjectVal(map[string]cty.Value{ - "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), - })) - } - - resp := []cty.Value{} - for i, v := range madeUp { - mp := map[string]cty.Value{ - "identity": ids[i], - "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), - } - if request.IncludeResourceObject { - mp["state"] = v - } - resp = append(resp, cty.ObjectVal(mp)) - } - - ret := request.Config.AsValueMap() - maps.Copy(ret, map[string]cty.Value{ - "data": cty.TupleVal(resp), - }) - - return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} - }, + generatedPath: t.TempDir(), + listResourceFn: listResourceFn, assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { expectedResources := []string{"list.test_resource.test", "list.test_resource.test2"} actualResources := make([]string, 0) @@ -189,38 +197,7 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { - madeUp := []cty.Value{ - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-123456")}), - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-654321")}), - } - ids := []cty.Value{} - for i := range madeUp { - ids = append(ids, cty.ObjectVal(map[string]cty.Value{ - "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), - })) - } - - resp := []cty.Value{} - for i, v := range madeUp { - resp = append(resp, cty.ObjectVal(map[string]cty.Value{ - "state": v, - "identity": ids[i], - "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), - })) - } - - ret := map[string]cty.Value{ - "data": cty.TupleVal(resp), - } - for k, v := range request.Config.AsValueMap() { - if k != "data" { - ret[k] = v - } - } - - return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} - }, + listResourceFn: listResourceFn, assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { expectedResources := []string{"list.test_resource.test[0]", "list.test_resource.test2"} actualResources := make([]string, 0) @@ -233,7 +210,7 @@ func TestContext2Plan_queryList(t *testing.T) { } // Verify instance types - expectedTypes := []string{"ami-123456", "ami-654321"} + expectedTypes := []string{"ami-123456", "ami-654321", "ami-789012"} actualTypes := make([]string, 0) obj := cs.Results.Value.GetAttr("data") if obj.IsNull() { @@ -369,38 +346,7 @@ func TestContext2Plan_queryList(t *testing.T) { } }, - listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { - madeUp := []cty.Value{ - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-123456")}), - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-654321")}), - } - ids := []cty.Value{} - for i := range madeUp { - ids = append(ids, cty.ObjectVal(map[string]cty.Value{ - "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), - })) - } - - resp := []cty.Value{} - for i, v := range madeUp { - resp = append(resp, cty.ObjectVal(map[string]cty.Value{ - "state": v, - "identity": ids[i], - "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), - })) - } - - ret := map[string]cty.Value{ - "data": cty.TupleVal(resp), - } - for k, v := range request.Config.AsValueMap() { - if k != "data" { - ret[k] = v - } - } - - return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} - }, + listResourceFn: listResourceFn, assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { expectedResources := []string{"list.test_resource.test"} actualResources := make([]string, 0) @@ -412,22 +358,22 @@ func TestContext2Plan_queryList(t *testing.T) { t.Fatalf("failed to decode change: %s", err) } - // Verify instance types - expectedTypes := []string{"ami-123456", "ami-654321"} + // Verify identities + expectedTypes := []string{"i-v1", "i-v2", "i-v3"} actualTypes := make([]string, 0) obj := cs.Results.Value.GetAttr("data") if obj.IsNull() { t.Fatalf("Expected 'data' attribute to be present, but it is null") } obj.ForEachElement(func(key cty.Value, val cty.Value) bool { - val = val.GetAttr("state") + val = val.GetAttr("identity") if val.IsNull() { - t.Fatalf("Expected 'state' attribute to be present, but it is null") + t.Fatalf("Expected 'identity' attribute to be present, but it is null") } - if val.GetAttr("instance_type").IsNull() { - t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") + if val.GetAttr("id").IsNull() { + t.Fatalf("Expected 'id' attribute to be present, but it is missing") } - actualTypes = append(actualTypes, val.GetAttr("instance_type").AsString()) + actualTypes = append(actualTypes, val.GetAttr("id").AsString()) return false }) sort.Strings(actualTypes) @@ -584,37 +530,7 @@ func TestContext2Plan_queryList(t *testing.T) { tfdiags.AssertDiagnosticsMatch(t, diags, exp) }, - listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { - madeUp := []cty.Value{ - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-123456")}), - } - ids := []cty.Value{} - for i := range madeUp { - ids = append(ids, cty.ObjectVal(map[string]cty.Value{ - "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), - })) - } - - resp := []cty.Value{} - for i, v := range madeUp { - resp = append(resp, cty.ObjectVal(map[string]cty.Value{ - "state": v, - "identity": ids[i], - "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), - })) - } - - ret := map[string]cty.Value{ - "data": cty.TupleVal(resp), - } - for k, v := range request.Config.AsValueMap() { - if k != "data" { - ret[k] = v - } - } - - return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} - }, + listResourceFn: listResourceFn, }, { name: "circular reference between list resources", @@ -702,37 +618,7 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { - madeUp := []cty.Value{ - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-123456")}), - } - ids := []cty.Value{} - for i := range madeUp { - ids = append(ids, cty.ObjectVal(map[string]cty.Value{ - "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), - })) - } - - resp := []cty.Value{} - for i, v := range madeUp { - resp = append(resp, cty.ObjectVal(map[string]cty.Value{ - "state": v, - "identity": ids[i], - "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), - })) - } - - ret := map[string]cty.Value{ - "data": cty.TupleVal(resp), - } - for k, v := range request.Config.AsValueMap() { - if k != "data" { - ret[k] = v - } - } - - return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} - }, + listResourceFn: listResourceFn, assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { expectedResources := []string{"list.test_resource.test1", "list.test_resource.test2"} actualResources := make([]string, 0) @@ -745,7 +631,7 @@ func TestContext2Plan_queryList(t *testing.T) { } // Verify instance types - expectedTypes := []string{"ami-123456"} + expectedTypes := []string{"ami-123456", "ami-654321", "ami-789012"} actualTypes := make([]string, 0) obj := cs.Results.Value.GetAttr("data") if obj.IsNull() { @@ -812,37 +698,7 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: func(request providers.ListResourceRequest) providers.ListResourceResponse { - madeUp := []cty.Value{ - cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal("ami-123456")}), - } - ids := []cty.Value{} - for i := range madeUp { - ids = append(ids, cty.ObjectVal(map[string]cty.Value{ - "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), - })) - } - - resp := []cty.Value{} - for i, v := range madeUp { - resp = append(resp, cty.ObjectVal(map[string]cty.Value{ - "state": v, - "identity": ids[i], - "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), - })) - } - - ret := map[string]cty.Value{ - "data": cty.TupleVal(resp), - } - for k, v := range request.Config.AsValueMap() { - if k != "data" { - ret[k] = v - } - } - - return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} - }, + listResourceFn: listResourceFn, assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { expectedResources := []string{"list.test_resource.test1[\"foo\"]", "list.test_resource.test1[\"bar\"]", "list.test_resource.test2[\"foo\"]", "list.test_resource.test2[\"bar\"]"} actualResources := make([]string, 0) @@ -855,7 +711,7 @@ func TestContext2Plan_queryList(t *testing.T) { } // Verify instance types - expectedTypes := []string{"ami-123456"} + expectedTypes := []string{"ami-123456", "ami-654321", "ami-789012"} actualTypes := make([]string, 0) obj := cs.Results.Value.GetAttr("data") if obj.IsNull() { @@ -885,16 +741,135 @@ func TestContext2Plan_queryList(t *testing.T) { } }, }, + { + name: ".tf file blocks should not be evaluated in query mode unless in path of list resources", + mainConfig: ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + + locals { + foo = "bar" + // This local variable is not evaluated in query mode, but it is still validated + bar = resource.test_resource.example.instance_type + } + + // This would produce a plan error if triggered, but we expect it to be ignored in query mode + // because no list resource depends on it + resource "test_resource" "example" { + instance_type = "ami-123456" + + lifecycle { + precondition { + condition = local.foo != "bar" + error_message = "This should not be executed" + } + } + } + + `, + queryConfig: ` + list "test_resource" "test" { + provider = test + include_resource = true + + config { + filter = { + attr = "foo" + } + } + } + `, + listResourceFn: listResourceFn, + assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { + expectedResources := []string{"list.test_resource.test"} + actualResources := make([]string, 0) + for _, change := range changes.Queries { + actualResources = append(actualResources, change.Addr.String()) + } + if diff := cmp.Diff(expectedResources, actualResources); diff != "" { + t.Fatalf("Expected resources to match, but they differ: %s", diff) + } + }, + }, + { + name: "when list provider depends on managed resource", + mainConfig: ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + + locals { + foo = "bar" + bar = resource.test_resource.example.instance_type + } + + provider "test" { + alias = "example" + region = resource.test_resource.example.instance_type + } + + // The list resource depends on this via the provider, + // so this resource will be evaluated as well. + resource "test_resource" "example" { + instance_type = "ami-123456" + } + + `, + queryConfig: ` + list "test_resource" "test" { + provider = test.example + include_resource = true + + config { + filter = { + attr = "foo" + } + } + } + `, + listResourceFn: listResourceFn, + assertChanges: func(ps providers.ProviderSchema, changes *plans.ChangesSrc) { + expectedListResources := []string{"list.test_resource.test"} + actualResources := make([]string, 0) + for _, change := range changes.Queries { + actualResources = append(actualResources, change.Addr.String()) + } + if diff := cmp.Diff(expectedListResources, actualResources); diff != "" { + t.Fatalf("Expected resources to match, but they differ: %s", diff) + } + + expectedManagedResources := []string{"test_resource.example"} + actualResources = make([]string, 0) + for _, change := range changes.Resources { + actualResources = append(actualResources, change.Addr.String()) + } + if diff := cmp.Diff(expectedManagedResources, actualResources); diff != "" { + t.Fatalf("Expected resources to match, but they differ: %s", diff) + } + + }, + }, } for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - configs := map[string]string{"main.tf": tc.mainConfig} + configFiles := map[string]string{"main.tf": tc.mainConfig} if tc.queryConfig != "" { - configs["main.tfquery.hcl"] = tc.queryConfig + configFiles["main.tfquery.hcl"] = tc.queryConfig } - mod := testModuleInline(t, configs) + mod := testModuleInline(t, configFiles, configs.MatchQueryFiles()) providerAddr := addrs.NewDefaultProvider("test") provider := testProvider("test") provider.ConfigureProvider(providers.ConfigureProviderRequest{}) @@ -922,7 +897,9 @@ func TestContext2Plan_queryList(t *testing.T) { }) tfdiags.AssertNoDiagnostics(t, diags) - diags = ctx.Validate(mod, &ValidateOpts{}) + diags = ctx.Validate(mod, &ValidateOpts{ + Query: true, + }) if tc.assertValidateDiags != nil { tc.assertValidateDiags(t, diags) return @@ -936,7 +913,12 @@ func TestContext2Plan_queryList(t *testing.T) { Query: true, GenerateConfigPath: tc.generatedPath, }) - tfdiags.AssertNoDiagnostics(t, diags) + if tc.assertPlanDiags != nil { + tc.assertPlanDiags(t, diags) + return + } else { + tfdiags.AssertNoDiagnostics(t, diags) + } if tc.assertChanges != nil { sch, err := ctx.Schemas(mod, states.NewState()) @@ -1040,10 +1022,10 @@ func TestContext2Plan_queryListArgs(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - configs := map[string]string{"main.tf": mainConfig} - configs["main.tfquery.hcl"] = tc.queryConfig + configFiles := map[string]string{"main.tf": mainConfig} + configFiles["main.tfquery.hcl"] = tc.queryConfig - mod := testModuleInline(t, configs) + mod := testModuleInline(t, configFiles, configs.MatchQueryFiles()) providerAddr := addrs.NewDefaultProvider("test") provider := testProvider("test") @@ -1125,6 +1107,14 @@ func getListProviderSchemaResp() *providers.GetProviderSchemaResponse { } return getProviderSchemaResponseFromProviderSchema(&providerSchema{ + Provider: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "region": { + Type: cty.String, + Optional: true, + }, + }, + }, ResourceTypes: map[string]*configschema.Block{ "list": { Attributes: map[string]*configschema.Attribute{ diff --git a/internal/terraform/context_validate.go b/internal/terraform/context_validate.go index 5d22330e75db..d154590afccc 100644 --- a/internal/terraform/context_validate.go +++ b/internal/terraform/context_validate.go @@ -34,6 +34,9 @@ type ValidateOpts struct { // not available to this function. Therefore, it is the responsibility of // the caller to ensure that the provider configurations are valid. ExternalProviders map[addrs.RootProviderConfig]providers.Interface + + // When true, query files will also be validated. + Query bool } // Validate performs semantic validation of a configuration, and returns @@ -105,6 +108,7 @@ func (c *Context) Validate(config *configs.Config, opts *ValidateOpts) tfdiags.D Operation: walkValidate, ExternalProviderConfigs: opts.ExternalProviders, ImportTargets: c.findImportTargets(config), + queryPlan: opts.Query, }).Build(addrs.RootModuleInstance) diags = diags.Append(moreDiags) if moreDiags.HasErrors() { diff --git a/internal/terraform/context_validate_test.go b/internal/terraform/context_validate_test.go index 9344bbc0bfd8..44083b467e93 100644 --- a/internal/terraform/context_validate_test.go +++ b/internal/terraform/context_validate_test.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform/internal/addrs" + "github.com/hashicorp/terraform/internal/configs" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/providers" testing_provider "github.com/hashicorp/terraform/internal/providers/testing" @@ -3521,13 +3522,13 @@ func TestContext2Validate_queryList(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - configs := map[string]string{"main.tf": tc.mainConfig} + configFiles := map[string]string{"main.tf": tc.mainConfig} if tc.queryConfig != "" { - configs["main.tfquery.hcl"] = tc.queryConfig + configFiles["main.tfquery.hcl"] = tc.queryConfig } - maps.Copy(configs, tc.extraConfig) + maps.Copy(configFiles, tc.extraConfig) - m := testModuleInline(t, configs) + m := testModuleInline(t, configFiles, configs.MatchQueryFiles()) providerAddr := addrs.NewDefaultProvider("test") provider := testProvider("test") @@ -3555,7 +3556,9 @@ func TestContext2Validate_queryList(t *testing.T) { // true externally. provider.ConfigureProviderCalled = true - diags = ctx.Validate(m, nil) + diags = ctx.Validate(m, &ValidateOpts{ + Query: true, + }) if len(diags) != tc.diagCount { t.Fatalf("expected %d diagnostics, got %d \n -diags: %s", tc.diagCount, len(diags), diags) } @@ -3775,3 +3778,71 @@ resource "test_instance" "foo" { }) } } + +func TestContext2Validate_noListValidated(t *testing.T) { + tests := map[string]struct { + name string + mainConfig string + queryConfig string + query bool + }{ + "query files not validated in default validate mode": { + mainConfig: ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + `, + queryConfig: ` + list "test_resource" "test" { + provider = test + + config { + filter = { + attr = list.non_existent.attr + } + } + } + + locals { + test = list.non_existent.attr + } + `, + query: false, + }, + } + + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + configFiles := map[string]string{"main.tf": tc.mainConfig} + if tc.queryConfig != "" { + configFiles["main.tfquery.hcl"] = tc.queryConfig + } + + opts := []configs.Option{} + if tc.query { + opts = append(opts, configs.MatchQueryFiles()) + } + + m := testModuleInline(t, configFiles, opts...) + + p := testProvider("test") + p.GetProviderSchemaResponse = getListProviderSchemaResp() + + ctx := testContext2(t, &ContextOpts{ + Providers: map[addrs.Provider]providers.Factory{ + addrs.NewDefaultProvider("test"): testProviderFuncFixed(p), + }, + }) + + diags := ctx.Validate(m, &ValidateOpts{ + Query: tc.query, + }) + tfdiags.AssertNoDiagnostics(t, diags) + }) + } +} diff --git a/internal/terraform/graph_builder_apply.go b/internal/terraform/graph_builder_apply.go index b81f1b6f2a2d..326a05a2dc7a 100644 --- a/internal/terraform/graph_builder_apply.go +++ b/internal/terraform/graph_builder_apply.go @@ -122,10 +122,6 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer { &ConfigTransformer{ Concrete: concreteResource, Config: b.Config, - resourceMatcher: func(mode addrs.ResourceMode) bool { - // list resources are not added to the graph during apply - return mode != addrs.ListResourceMode - }, }, // Add dynamic values diff --git a/internal/terraform/graph_builder_plan.go b/internal/terraform/graph_builder_plan.go index 87a8dab98582..479db64030cb 100644 --- a/internal/terraform/graph_builder_plan.go +++ b/internal/terraform/graph_builder_plan.go @@ -159,14 +159,6 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { ConcreteAction: b.ConcreteAction, Config: b.Config, destroy: b.Operation == walkDestroy || b.Operation == walkPlanDestroy, - resourceMatcher: func(mode addrs.ResourceMode) bool { - // all resources are included during validation. - if b.Operation == walkValidate { - return true - } - - return b.queryPlan == (mode == addrs.ListResourceMode) - }, importTargets: b.ImportTargets, @@ -290,6 +282,9 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer { // Target &TargetsTransformer{Targets: b.Targets}, + // Filter the graph to only include nodes that are relevant to the query operation. + &QueryTransformer{queryPlan: b.queryPlan, validate: b.Operation == walkValidate}, + // Detect when create_before_destroy must be forced on for a particular // node due to dependency edges, to avoid graph cycles during apply. &ForcedCBDTransformer{}, diff --git a/internal/terraform/terraform_test.go b/internal/terraform/terraform_test.go index a988d30fc6f4..14be79f5375b 100644 --- a/internal/terraform/terraform_test.go +++ b/internal/terraform/terraform_test.go @@ -89,7 +89,7 @@ func testModuleWithSnapshot(t *testing.T, name string) (*configs.Config, *config // testModuleInline takes a map of path -> config strings and yields a config // structure with those files loaded from disk -func testModuleInline(t testing.TB, sources map[string]string) *configs.Config { +func testModuleInline(t testing.TB, sources map[string]string, parserOpts ...configs.Option) *configs.Config { t.Helper() cfgPath, err := filepath.EvalSymlinks(t.TempDir()) @@ -97,8 +97,6 @@ func testModuleInline(t testing.TB, sources map[string]string) *configs.Config { t.Fatal(err) } - var queryOpt configs.Option - for path, configStr := range sources { dir := filepath.Dir(path) if dir != "." { @@ -118,15 +116,6 @@ func testModuleInline(t testing.TB, sources map[string]string) *configs.Config { if err != nil { t.Fatalf("Error creating temporary file for config: %s", err) } - - if strings.HasSuffix(path, "tfquery.hcl") || strings.HasSuffix(path, "tfquery.json") { - queryOpt = configs.MatchQueryFiles() - } - } - - var parserOpts []configs.Option - if queryOpt != nil { - parserOpts = append(parserOpts, queryOpt) } loader, cleanup := configload.NewLoaderForTests(t, parserOpts...) diff --git a/internal/terraform/transform_config.go b/internal/terraform/transform_config.go index 236e8ee6a945..8198faad96c2 100644 --- a/internal/terraform/transform_config.go +++ b/internal/terraform/transform_config.go @@ -53,8 +53,6 @@ type ConfigTransformer struct { // try to delete the imported resource unless the config is updated // manually. generateConfigPathForImportTargets string - - resourceMatcher func(addrs.ResourceMode) bool } func (t *ConfigTransformer) Transform(g *Graph) error { @@ -163,11 +161,6 @@ func (t *ConfigTransformer) transformSingle(g *Graph, config *configs.Config) er continue } - if t.resourceMatcher != nil && !t.resourceMatcher(r.Mode) { - // Skip resources that do not match the filter - continue - } - // Verify that any actions referenced in the resource's ActionTriggers exist in this module var diags tfdiags.Diagnostics if r.Managed != nil && r.Managed.ActionTriggers != nil { @@ -262,10 +255,6 @@ func (t *ConfigTransformer) transformSingle(g *Graph, config *configs.Config) er // If any import targets were not claimed by resources we may be // generating configuration. Add them to the graph for validation. for _, i := range importTargets { - if t.resourceMatcher != nil && !t.resourceMatcher(i.Config.ToResource.Resource.Mode) { - // Skip resources that do not match the filter - continue - } log.Printf("[DEBUG] ConfigTransformer: adding config generation node for %s", i.Config.ToResource) diff --git a/internal/terraform/transform_query.go b/internal/terraform/transform_query.go new file mode 100644 index 000000000000..64c725772f58 --- /dev/null +++ b/internal/terraform/transform_query.go @@ -0,0 +1,56 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +package terraform + +import ( + "github.com/hashicorp/terraform/internal/addrs" + "github.com/hashicorp/terraform/internal/dag" +) + +type QueryTransformer struct { + // queryPlan is true when we are planning list resources. + queryPlan bool + + // if validate is true, we are in validate mode and should not exclude any resources. + validate bool +} + +func (t *QueryTransformer) Transform(g *Graph) error { + if !t.queryPlan { + // if we are not running a query-specific operation, we don't need to transform the graph + // as query-related files would not have been part of the parsed config. + return nil + } + + if t.validate { + // if we are validating query files, we validate all resources + return nil + } + + // a set to hold the resources that we want to keep and vertices along its path. + keep := dag.Set{} + + for v := range dag.SelectSeq[GraphNodeConfigResource](g.VerticesSeq()) { + // we only get here if we are building a query plan, but not validating. + // + // By now, the graph already contains all resources from the config, including non-list resources. + // We start from each list resource node, look at its ancestors, and keep all vertices along its path. + if v.ResourceAddr().Resource.Mode == addrs.ListResourceMode { + keep.Add(v) + deps := g.Ancestors(v) + for node := range deps { + keep.Add(node) + } + } + } + + // Remove all nodes that are not in the keep set. + for v := range g.VerticesSeq() { + if _, ok := keep[v]; !ok { + g.Remove(v) + } + } + + return nil +} From a4cc769e5bea770aa5cdb5d726a3fe401f906c71 Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Thu, 25 Sep 2025 13:25:23 +0200 Subject: [PATCH 15/27] actions: add extra test cases around conditions referencing the triggering resource --- .../terraform/context_apply_action_test.go | 40 +++++++++++ .../terraform/context_plan_actions_test.go | 67 +++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/internal/terraform/context_apply_action_test.go b/internal/terraform/context_apply_action_test.go index 454e7d2f04bd..ee15c7a3c887 100644 --- a/internal/terraform/context_apply_action_test.go +++ b/internal/terraform/context_apply_action_test.go @@ -1852,6 +1852,46 @@ resource "test_object" "a" { }, expectInvokeActionCalled: true, }, + "referencing triggering resource in after_* condition": { + module: map[string]string{ + "main.tf": ` +action "action_example" "hello" { + config { + attr = "hello" + } +} +action "action_example" "world" { + config { + attr = "world" + } +} +resource "test_object" "a" { + name = "foo" + lifecycle { + action_trigger { + events = [after_create] + condition = test_object.a.name == "foo" + actions = [action.action_example.hello] + } + action_trigger { + events = [after_update] + condition = test_object.a.name == "bar" + actions = [action.action_example.world] + } + } +} +`, + }, + expectInvokeActionCalled: true, + expectInvokeActionCalls: []providers.InvokeActionRequest{ + { + ActionType: "action_example", + PlannedActionData: cty.ObjectVal(map[string]cty.Value{ + "attr": cty.StringVal("hello"), + }), + }, + }, + }, "multiple events triggering in same action trigger": { module: map[string]string{ "main.tf": ` diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index f9d8782397ea..b928fd6252d7 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -3053,6 +3053,73 @@ resource "test_object" "a" { }, }, + "referencing triggering resource in before_* condition": { + module: map[string]string{ + "main.tf": ` +action "test_action" "hello" {} +action "test_action" "world" {} +resource "test_object" "a" { + name = "foo" + lifecycle { + action_trigger { + events = [before_create] + condition = test_object.a.name == "foo" + actions = [action.test_action.hello] + } + action_trigger { + events = [before_update] + condition = test_object.a.name == "bar" + actions = [action.test_action.world] + } + } +} +`, + }, + expectPlanActionCalled: true, + + assertPlanDiagnostics: func(t *testing.T, diags tfdiags.Diagnostics) { + if !diags.HasErrors() { + t.Errorf("expected errors, got none") + } + + err := diags.Err().Error() + if !strings.Contains(err, "Cycle:") || !strings.Contains(err, "action.test_action.hello") || !strings.Contains(err, "test_object.a") { + t.Fatalf("Expected '[Error] Cycle: action.test_action.hello (instance), test_object.a', got '%s'", err) + } + }, + }, + + "referencing triggering resource in after_* condition": { + module: map[string]string{ + "main.tf": ` +action "test_action" "hello" {} +action "test_action" "world" {} +resource "test_object" "a" { + name = "foo" + lifecycle { + action_trigger { + events = [after_create] + condition = test_object.a.name == "foo" + actions = [action.test_action.hello] + } + action_trigger { + events = [after_update] + condition = test_object.a.name == "bar" + actions = [action.test_action.world] + } + } +} +`, + }, + expectPlanActionCalled: true, + + assertPlan: func(t *testing.T, p *plans.Plan) { + if len(p.Changes.ActionInvocations) != 1 { + t.Errorf("expected 1 action invocation, got %d", len(p.Changes.ActionInvocations)) + } + }, + }, + "using each in before_* condition": { module: map[string]string{ "main.tf": ` From 51fc4c161f8fce81598890ddd101b5fcf5baf217 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Fri, 26 Sep 2025 17:03:02 +0100 Subject: [PATCH 16/27] PSS: Implement `ReadStateBytes` + `WriteStateBytes` (#37440) * Implement ReadStateBytes + WriteStateBytes * [WIP] - Testing ReadStateBytes and WriteStateBytes (#37464) * Fix nil pointer error * Add WIP test for ReadStateBytes * Move test mock to separate testing file * Update mock to send unexpected EOF when there's a problem returning data and it's not a true EOF * Add test case for when length != expected length * Add test for when trying to read state from a store type that doesn't exist * Change symbol names to lowercase * Add ability to force a diagnostic to be returned from `mockReadStateBytesClient`'s `Recv` method * Add test showing error diagnostics raised by the ReadStateBytes client are returned * Add missing header * Simplify mock by using an embedded type * Rename `mockOpts` to `mockReadStateBytesOpts` * Update existing tests to assert what arguments are passed to the RPC method call * Add mock WriteStateBytesClient which uses `go.uber.org/mock/gomock` to enable assertions about calls to Send * Add a test for WriteStateBytes that makes assertions about calls to the Send method * Update test case to explicitly test writing data smaller than the chunk size * Implement chunking in WriteStateBytes, add test case to assert expected chunking behaviour * Add generated mock for Provider_WriteStateBytesClient in protocol v6 * Update tests to use new `MockProvider_WriteStateBytesClient`, remove handwritten mock * Update code comments in test * Add tests for diagnostics and errors returned during WriteStateBytes * Add generated mock for Provider_ReadStateBytesClient in protocol v6, replace old mock * Add test case for grpc errors in ReadStateBytes, fix how error is returned * Typo in comment * Add missing warning test, rename some test cases * Update proto file definition of Read/WriteStateBytes RPCs (#37529) * Update Read/WriteStateBytes RPCs to match https://github.com/hashicorp/terraform-plugin-go/pull/531 * Run `make protobuf` * Run `make generate` * Update use of `proto.ReadStateBytes_ResponseChunk` in tests * Fix how diagnostics are handled alongside EOF error, update ReadStateBytes test * More fixes - test setup was incorrect I think? I assume that a response would be returned full of zero-values when EOF is encountered. * WIP - avoid crash if chunk is nil * Sarah's updates to radek/pss-read-write (#37642) * Update code to not expect a chunk when EOF encountered * Return early if any grpc errors are encountered during ReadStateBytes * Close the stream with CloseSend once everything's read without error. Add test case about handling grpc errors from CloseSend. * Fix test case about warnings: We would expect to receive a chunk with data alongside the warning and have a normal closing of the stream after EOF * Add log line, remove unneeded type info * Implement configurable state chunk size * handle metadata in WriteStateBytes correctly * validate chunk sizes received from provider * ReadStateBytes: avoid early return on warnings --------- Co-authored-by: Sarah French <15078782+SarahFrench@users.noreply.github.com> --- docs/plugin-protocol/tfplugin6.proto | 53 +- .../builtin/providers/terraform/provider.go | 12 + internal/grpcwrap/provider6.go | 8 + internal/plugin/grpc_provider.go | 8 + internal/plugin6/grpc_provider.go | 256 ++- internal/plugin6/grpc_provider_test.go | 809 ++++++++ internal/plugin6/mock_proto/generate.go | 2 +- internal/plugin6/mock_proto/mock.go | 306 ++- internal/provider-simple-v6/provider.go | 8 + internal/provider-simple/provider.go | 8 + internal/providers/mock.go | 8 + internal/providers/provider.go | 49 + internal/providers/testing/provider_mock.go | 36 + internal/refactoring/mock_provider.go | 8 + .../internal/stackeval/stubs/errored.go | 28 + .../internal/stackeval/stubs/offline.go | 28 + .../internal/stackeval/stubs/unknown.go | 28 + internal/tfplugin6/tfplugin6.pb.go | 1673 ++++++++++++----- 18 files changed, 2840 insertions(+), 488 deletions(-) diff --git a/docs/plugin-protocol/tfplugin6.proto b/docs/plugin-protocol/tfplugin6.proto index f001b4a4798f..b487ea578e5d 100644 --- a/docs/plugin-protocol/tfplugin6.proto +++ b/docs/plugin-protocol/tfplugin6.proto @@ -390,6 +390,11 @@ service Provider { // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider rpc ConfigureStateStore(ConfigureStateStore.Request) returns (ConfigureStateStore.Response); + // ReadStateBytes streams byte chunks of a given state file from a state store + rpc ReadStateBytes(ReadStateBytes.Request) returns (stream ReadStateBytes.Response); + // WriteStateBytes streams byte chunks of a given state file into a state store + rpc WriteStateBytes(stream WriteStateBytes.RequestChunk) returns (WriteStateBytes.Response); + // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store rpc GetStates(GetStates.Request) returns (GetStates.Response); // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) @@ -896,7 +901,6 @@ message ValidateListResourceConfig { } } - message ValidateStateStore { message Request { string type_name = 1; @@ -911,12 +915,59 @@ message ConfigureStateStore { message Request { string type_name = 1; DynamicValue config = 2; + StateStoreClientCapabilities capabilities = 3; } message Response { repeated Diagnostic diagnostics = 1; + StateStoreServerCapabilities capabilities = 2; } } +message StateStoreClientCapabilities { + int64 chunk_size = 1; // suggested chunk size by Core +} + +message StateStoreServerCapabilities { + int64 chunk_size = 1; // chosen chunk size by plugin +} + +message ReadStateBytes { + message Request { + string type_name = 1; + string state_id = 2; + } + message Response { + bytes bytes = 1; + int64 total_length = 2; + StateRange range = 3; + repeated Diagnostic diagnostics = 4; + } +} + +message WriteStateBytes { + message RequestChunk { + // meta is sent with the first chunk only + optional RequestChunkMeta meta = 1; + + bytes bytes = 2; + int64 total_length = 3; + StateRange range = 4; + } + message Response { + repeated Diagnostic diagnostics = 1; + } +} + +message RequestChunkMeta { + string type_name = 1; + string state_id = 2; +} + +message StateRange { + int64 start = 1; + int64 end = 2; +} + message GetStates { message Request { string type_name = 1; diff --git a/internal/builtin/providers/terraform/provider.go b/internal/builtin/providers/terraform/provider.go index 6028fe7c0fea..89030e394c6e 100644 --- a/internal/builtin/providers/terraform/provider.go +++ b/internal/builtin/providers/terraform/provider.go @@ -295,6 +295,18 @@ func (p *Provider) ConfigureStateStore(req providers.ConfigureStateStoreRequest) return resp } +func (p *Provider) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + var resp providers.ReadStateBytesResponse + resp.Diagnostics.Append(fmt.Errorf("unsupported state store type %q", req.TypeName)) + return resp +} + +func (p *Provider) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + var resp providers.WriteStateBytesResponse + resp.Diagnostics.Append(fmt.Errorf("unsupported state store type %q", req.TypeName)) + return resp +} + func (p *Provider) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { var resp providers.GetStatesResponse resp.Diagnostics.Append(fmt.Errorf("unsupported state store type %q", req.TypeName)) diff --git a/internal/grpcwrap/provider6.go b/internal/grpcwrap/provider6.go index d16d6d086ade..78bf0b369de8 100644 --- a/internal/grpcwrap/provider6.go +++ b/internal/grpcwrap/provider6.go @@ -907,6 +907,14 @@ func (p *provider6) ConfigureStateStore(ctx context.Context, req *tfplugin6.Conf panic("not implemented") } +func (p *provider6) ReadStateBytes(req *tfplugin6.ReadStateBytes_Request, srv tfplugin6.Provider_ReadStateBytesServer) error { + panic("not implemented") +} + +func (p *provider6) WriteStateBytes(srv tfplugin6.Provider_WriteStateBytesServer) error { + panic("not implemented") +} + func (p *provider6) GetStates(ctx context.Context, req *tfplugin6.GetStates_Request) (*tfplugin6.GetStates_Response, error) { panic("not implemented") } diff --git a/internal/plugin/grpc_provider.go b/internal/plugin/grpc_provider.go index 3f8251b4a11d..f416e6e28904 100644 --- a/internal/plugin/grpc_provider.go +++ b/internal/plugin/grpc_provider.go @@ -1444,6 +1444,14 @@ func (p *GRPCProvider) ConfigureStateStore(r providers.ConfigureStateStoreReques panic("not implemented") } +func (p *GRPCProvider) ReadStateBytes(r providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + panic("not implemented") +} + +func (p *GRPCProvider) WriteStateBytes(r providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + panic("not implemented") +} + func (p *GRPCProvider) GetStates(r providers.GetStatesRequest) providers.GetStatesResponse { panic("not implemented") } diff --git a/internal/plugin6/grpc_provider.go b/internal/plugin6/grpc_provider.go index 0ab7da98b1a2..a475ec66549a 100644 --- a/internal/plugin6/grpc_provider.go +++ b/internal/plugin6/grpc_provider.go @@ -4,6 +4,7 @@ package plugin6 import ( + "bytes" "context" "errors" "fmt" @@ -11,6 +12,7 @@ import ( "sync" plugin "github.com/hashicorp/go-plugin" + "github.com/hashicorp/hcl/v2" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" ctyjson "github.com/zclconf/go-cty/cty/json" @@ -46,6 +48,11 @@ func (p *GRPCProviderPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Serve return nil } +// grpcMaxMessageSize is the maximum gRPC send and receive message sizes +// This matches the maximum set by a server implemented via terraform-plugin-go. +// See https://github.com/hashicorp/terraform-plugin-go/blob/a361c9bf/tfprotov6/tf6server/server.go#L88 +const grpcMaxMessageSize = 256 << 20 + // GRPCProvider handles the client, or core side of the plugin rpc connection. // The GRPCProvider methods are mostly a translation layer between the // terraform providers types and the grpc proto types, directly converting @@ -73,8 +80,12 @@ type GRPCProvider struct { // schema stores the schema for this provider. This is used to properly // serialize the requests for schemas. - mu sync.Mutex schema providers.GetProviderSchemaResponse + // stateChunkSize stores the negotiated chunk size for any implemented + // state store (keyed by type name) that have gone through successful configuration. + stateChunkSize map[string]int + + mu sync.Mutex } func (p *GRPCProvider) GetProviderSchema() providers.GetProviderSchemaResponse { @@ -1489,11 +1500,15 @@ func (p *GRPCProvider) ConfigureStateStore(r providers.ConfigureStateStoreReques return resp } + clientCapabilities := stateStoreClientCapabilitiesToProto(r.Capabilities) + logger.Trace("GRPCProvider.v6: ConfigureStateStore: proposing client capabilities", clientCapabilities) + protoReq := &proto6.ConfigureStateStore_Request{ TypeName: r.TypeName, Config: &proto6.DynamicValue{ Msgpack: mp, }, + Capabilities: clientCapabilities, } protoResp, err := p.client.ConfigureStateStore(p.ctx, protoReq) @@ -1501,10 +1516,237 @@ func (p *GRPCProvider) ConfigureStateStore(r providers.ConfigureStateStoreReques resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) return resp } + resp.Capabilities = stateStoreServerCapabilitiesFromProto(protoResp.Capabilities) + logger.Trace("GRPCProvider.v6: ConfigureStateStore: received server capabilities", resp.Capabilities) + resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(protoResp.Diagnostics)) return resp } +func (p *GRPCProvider) ReadStateBytes(r providers.ReadStateBytesRequest) (resp providers.ReadStateBytesResponse) { + logger.Trace("GRPCProvider.v6: ReadStateBytes") + + // ReadStateBytes can be more sensitive to message sizes + // so we ensure it aligns with (the lower) terraform-plugin-go. + opts := grpc.MaxRecvMsgSizeCallOption{ + MaxRecvMsgSize: grpcMaxMessageSize, + } + + schema := p.GetProviderSchema() + if schema.Diagnostics.HasErrors() { + resp.Diagnostics = schema.Diagnostics + return resp + } + + if _, ok := schema.StateStores[r.TypeName]; !ok { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("unknown state store type %q", r.TypeName)) + return resp + } + + protoReq := &proto6.ReadStateBytes_Request{ + TypeName: r.TypeName, + StateId: r.StateId, + } + + // Start the streaming RPC with a context. The context will be cancelled + // when this function returns, which will stop the stream if it is still + // running. + ctx, cancel := context.WithCancel(p.ctx) + defer cancel() + + client, err := p.client.ReadStateBytes(ctx, protoReq, opts) + if err != nil { + resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) + return resp + } + + buf := &bytes.Buffer{} + var expectedTotalLength int + for { + chunk, err := client.Recv() + if err == io.EOF { + // No chunk is returned alongside an EOF. + // And as EOF is a sentinel error it isn't wrapped as a diagnostic. + break + } + if err != nil { + resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) + break + } + resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(chunk.Diagnostics)) + if resp.Diagnostics.HasErrors() { + // If we have errors, we stop processing and return early + break + } + + if expectedTotalLength == 0 { + expectedTotalLength = int(chunk.TotalLength) + } + logger.Trace("GRPCProvider.v6: ReadStateBytes: received chunk for range", chunk.Range) + + // check the size of chunks matches to what was agreed + chunkSize, ok := p.stateChunkSize[r.TypeName] + if !ok { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("Unable to determine chunk size for provider %s; this is a bug in Terraform - please report it", r.TypeName)) + return resp + } + if chunk.Range.End < chunk.TotalLength { + // all but last chunk must match exactly + if len(chunk.Bytes) != chunkSize { + resp.Diagnostics = resp.Diagnostics.Append(&hcl.Diagnostic{ + Severity: hcl.DiagWarning, + Summary: "Unexpected size of chunk received", + Detail: fmt.Sprintf("Unexpected chunk of size %d was received, expected %d; this is a bug in the provider %s - please report it there", + len(chunk.Bytes), chunkSize, r.TypeName), + }) + } + } else { + // last chunk must be still within the agreed size + if len(chunk.Bytes) > chunkSize { + resp.Diagnostics = resp.Diagnostics.Append(&hcl.Diagnostic{ + Severity: hcl.DiagWarning, + Summary: "Unexpected size of last chunk received", + Detail: fmt.Sprintf("Last chunk exceeded agreed size, expected %d, given %d; this is a bug in the provider %s - please report it there", + chunkSize, len(chunk.Bytes), r.TypeName), + }) + } + } + + n, err := buf.Write(chunk.Bytes) + if err != nil { + resp.Diagnostics = resp.Diagnostics.Append(err) + break + } + logger.Trace("GRPCProvider.v6: ReadStateBytes: read bytes of a chunk", n) + } + + if resp.Diagnostics.HasErrors() { + logger.Trace("GRPCProvider.v6: ReadStateBytes: experienced an error when receiving state data from the provider", resp.Diagnostics.Err()) + return resp + } + + if buf.Len() != expectedTotalLength { + logger.Trace("GRPCProvider.v6: ReadStateBytes: received %d bytes but expected the total bytes to be %d.", buf.Len(), expectedTotalLength) + + err = fmt.Errorf("expected state file of total %d bytes, received %d bytes", + expectedTotalLength, buf.Len()) + resp.Diagnostics = resp.Diagnostics.Append(err) + return resp + } + + // We're done, so close the stream + logger.Trace("GRPCProvider.v6: ReadStateBytes: received all chunks, total bytes: ", buf.Len()) + err = client.CloseSend() + if err != nil { + resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) + return resp + } + + // Add the state data in the response once we know there are no errors + resp.Bytes = buf.Bytes() + + return resp +} + +func (p *GRPCProvider) WriteStateBytes(r providers.WriteStateBytesRequest) (resp providers.WriteStateBytesResponse) { + logger.Trace("GRPCProvider.v6: WriteStateBytes") + + // WriteStateBytes can be more sensitive to message sizes + // so we ensure it aligns with (the lower) terraform-plugin-go. + opts := grpc.MaxSendMsgSizeCallOption{ + MaxSendMsgSize: grpcMaxMessageSize, + } + + chunkSize, ok := p.stateChunkSize[r.TypeName] + if !ok { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("Unable to determine chunk size for provider %s; this is a bug in Terraform - please report it", r.TypeName)) + return resp + } + + schema := p.GetProviderSchema() + if schema.Diagnostics.HasErrors() { + resp.Diagnostics = schema.Diagnostics + return resp + } + + if _, ok := schema.StateStores[r.TypeName]; !ok { + resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("unknown state store type %q", r.TypeName)) + return resp + } + + // Start the streaming RPC with a context. The context will be cancelled + // when this function returns, which will stop the stream if it is still + // running. + ctx, cancel := context.WithCancel(p.ctx) + defer cancel() + + client, err := p.client.WriteStateBytes(ctx, opts) + if err != nil { + resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) + return resp + } + + buf := bytes.NewBuffer(r.Bytes) + var totalLength int64 = int64(len(r.Bytes)) + var totalBytesProcessed int + for { + chunk := buf.Next(chunkSize) + + if len(chunk) == 0 { + // The previous iteration read the last of the data. Now we finish up. + protoResp, err := client.CloseAndRecv() + if err != nil { + resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) + return resp + } + resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(protoResp.Diagnostics)) + if resp.Diagnostics.HasErrors() { + return resp + } + break + } + + var meta *proto6.RequestChunkMeta + if totalBytesProcessed == 0 { + // Send metadata with the first chunk only + meta = &proto6.RequestChunkMeta{ + TypeName: r.TypeName, + StateId: r.StateId, + } + } + + // There is more data to write + protoReq := &proto6.WriteStateBytes_RequestChunk{ + Meta: meta, + Bytes: chunk, + TotalLength: totalLength, + Range: &proto6.StateRange{ + Start: int64(totalBytesProcessed), + End: int64(totalBytesProcessed + len(chunk)), + }, + } + err = client.Send(protoReq) + if err != nil { + resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) + return resp + } + + // Track progress before next iteration + totalBytesProcessed += len(chunk) + } + + return resp +} + +func (p *GRPCProvider) SetStateStoreChunkSize(typeName string, size int) { + p.mu.Lock() + defer p.mu.Unlock() + if p.stateChunkSize == nil { + p.stateChunkSize = make(map[string]int, 1) + } + p.stateChunkSize[typeName] = size +} + func (p *GRPCProvider) GetStates(r providers.GetStatesRequest) (resp providers.GetStatesResponse) { logger.Trace("GRPCProvider.v6: GetStates") @@ -1758,3 +2000,15 @@ func clientCapabilitiesToProto(c providers.ClientCapabilities) *proto6.ClientCap WriteOnlyAttributesAllowed: c.WriteOnlyAttributesAllowed, } } + +func stateStoreClientCapabilitiesToProto(c providers.StateStoreClientCapabilities) *proto6.StateStoreClientCapabilities { + return &proto6.StateStoreClientCapabilities{ + ChunkSize: c.ChunkSize, + } +} + +func stateStoreServerCapabilitiesFromProto(c *proto6.StateStoreServerCapabilities) providers.StateStoreServerCapabilities { + return providers.StateStoreServerCapabilities{ + ChunkSize: c.ChunkSize, + } +} diff --git a/internal/plugin6/grpc_provider_test.go b/internal/plugin6/grpc_provider_test.go index 44fb722dcff3..226fb1578d35 100644 --- a/internal/plugin6/grpc_provider_test.go +++ b/internal/plugin6/grpc_provider_test.go @@ -6,6 +6,7 @@ package plugin6 import ( "bytes" "context" + "errors" "fmt" "io" "testing" @@ -20,6 +21,7 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/hashicorp/terraform/internal/addrs" + "github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/configs/hcl2shim" "github.com/hashicorp/terraform/internal/plans" @@ -60,6 +62,16 @@ func mockProviderClient(t *testing.T) *mockproto.MockProviderClient { return client } +func mockReadStateBytesClient(t *testing.T) *mockproto.MockProvider_ReadStateBytesClient { + ctrl := gomock.NewController(t) + return mockproto.NewMockProvider_ReadStateBytesClient(ctrl) +} + +func mockWriteStateBytesClient(t *testing.T) *mockproto.MockProvider_WriteStateBytesClient { + ctrl := gomock.NewController(t) + return mockproto.NewMockProvider_WriteStateBytesClient(ctrl) +} + func checkDiags(t *testing.T, d tfdiags.Diagnostics) { t.Helper() if d.HasErrors() { @@ -2277,6 +2289,7 @@ func TestGRPCProvider_ValidateStateStoreConfig_schema_errors(t *testing.T) { func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T) { storeName := "mock_store" // mockProviderClient returns a mock that has this state store in its schemas + chunkSize := 4 << 20 // 4MB t.Run("no validation error raised", func(t *testing.T) { typeName := storeName @@ -2292,6 +2305,9 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T gomock.Any(), gomock.Any(), ).Return(&proto.ConfigureStateStore_Response{ + Capabilities: &proto.StateStoreServerCapabilities{ + ChunkSize: int64(chunkSize), + }, Diagnostics: diagnostic, }, nil) @@ -2300,6 +2316,9 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T Config: cty.ObjectVal(map[string]cty.Value{ "region": cty.StringVal("neptune"), }), + Capabilities: providers.StateStoreClientCapabilities{ + ChunkSize: int64(chunkSize), + }, } // Act @@ -2330,6 +2349,9 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T gomock.Any(), gomock.Any(), ).Return(&proto.ConfigureStateStore_Response{ + Capabilities: &proto.StateStoreServerCapabilities{ + ChunkSize: int64(chunkSize), + }, Diagnostics: diagnostic, }, nil) @@ -2338,6 +2360,9 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T Config: cty.ObjectVal(map[string]cty.Value{ "region": cty.StringVal("neptune"), }), + Capabilities: providers.StateStoreClientCapabilities{ + ChunkSize: int64(chunkSize), + }, } // Act @@ -2556,3 +2581,787 @@ func TestGRPCProvider_DeleteState(t *testing.T) { } }) } + +func TestGRPCProvider_ReadStateBytes(t *testing.T) { + chunkSize := 4 << 20 // 4MB + + t.Run("can process multiple chunks", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", 5) + + // Call to ReadStateBytes + // > Assert the arguments received + // > Define the returned mock client + expectedReq := &proto.ReadStateBytes_Request{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + } + mockReadBytesClient := mockReadStateBytesClient(t) + client.EXPECT().ReadStateBytes( + gomock.Any(), + gomock.Eq(expectedReq), + gomock.Any(), + ).Return(mockReadBytesClient, nil) + + // Define what will be returned by each call to Recv + chunks := []string{"hello", "world"} + totalLength := len(chunks[0]) + len(chunks[1]) + mockResp := map[int]struct { + resp *proto.ReadStateBytes_Response + err error + }{ + 0: { + resp: &proto.ReadStateBytes_Response{ + Bytes: []byte(chunks[0]), + TotalLength: int64(totalLength), + Range: &proto.StateRange{ + Start: 0, + End: int64(len(chunks[0])), + }, + }, + err: nil, + }, + 1: { + resp: &proto.ReadStateBytes_Response{ + Bytes: []byte(chunks[1]), + TotalLength: int64(totalLength), + Range: &proto.StateRange{ + Start: int64(len(chunks[0])), + End: int64(len(chunks[1])), + }, + }, + err: nil, + }, + 2: { + resp: &proto.ReadStateBytes_Response{}, + err: io.EOF, + }, + } + var count int + mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { + ret := mockResp[count] + count++ + return ret.resp, ret.err + }).Times(3) + + // There will be a call to CloseSend to close the stream + mockReadBytesClient.EXPECT().CloseSend().Return(nil).Times(1) + + // Act + request := providers.ReadStateBytesRequest{ + TypeName: expectedReq.TypeName, + StateId: expectedReq.StateId, + } + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiags(t, resp.Diagnostics) + if string(resp.Bytes) != "helloworld" { + t.Fatalf("expected data to be %q, got: %q", "helloworld", string(resp.Bytes)) + } + }) + + t.Run("an error diagnostic is returned when final length does not match expectations", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", 5) + + // Call to ReadStateBytes + // > Assert the arguments received + // > Define the returned mock client + mockReadBytesClient := mockReadStateBytesClient(t) + expectedReq := &proto.ReadStateBytes_Request{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + } + client.EXPECT().ReadStateBytes( + gomock.Any(), + gomock.Eq(expectedReq), + gomock.Any(), + ).Return(mockReadBytesClient, nil) + + // Define what will be returned by each call to Recv + chunks := []string{"hello", "world"} + var incorrectLength int64 = 999 + correctLength := len(chunks[0]) + len(chunks[1]) + mockResp := map[int]struct { + resp *proto.ReadStateBytes_Response + err error + }{ + 0: { + resp: &proto.ReadStateBytes_Response{ + Bytes: []byte(chunks[0]), + TotalLength: incorrectLength, + Range: &proto.StateRange{ + Start: 0, + End: int64(len(chunks[0])), + }, + }, + err: nil, + }, + 1: { + resp: &proto.ReadStateBytes_Response{ + Bytes: []byte(chunks[1]), + TotalLength: incorrectLength, + Range: &proto.StateRange{ + Start: int64(len(chunks[0])), + End: int64(len(chunks[1])), + }, + }, + err: nil, + }, + 2: { + resp: &proto.ReadStateBytes_Response{}, + err: io.EOF, + }, + } + var count int + mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { + ret := mockResp[count] + count++ + return ret.resp, ret.err + }).Times(3) + + // Act + request := providers.ReadStateBytesRequest{ + TypeName: expectedReq.TypeName, + StateId: expectedReq.StateId, + } + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiagsHasError(t, resp.Diagnostics) + expectedErr := fmt.Sprintf("expected state file of total %d bytes, received %d bytes", incorrectLength, correctLength) + if resp.Diagnostics.Err().Error() != expectedErr { + t.Fatalf("expected error diagnostic %q, but got: %q", expectedErr, resp.Diagnostics.Err()) + } + if len(resp.Bytes) != 0 { + t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) + } + }) + + t.Run("an error diagnostic is returned when store type does not exist", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // In this scenario the method returns before the call to the + // ReadStateBytes RPC, so no mocking needed + + badStoreType := "doesnt_exist" + request := providers.ReadStateBytesRequest{ + TypeName: badStoreType, + StateId: backend.DefaultStateName, + } + + // Act + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiagsHasError(t, resp.Diagnostics) + expectedErr := fmt.Sprintf("unknown state store type %q", badStoreType) + if resp.Diagnostics.Err().Error() != expectedErr { + t.Fatalf("expected error diagnostic %q, but got: %q", expectedErr, resp.Diagnostics.Err()) + } + if len(resp.Bytes) != 0 { + t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) + } + }) + + t.Run("error diagnostics from the provider are returned", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Call to ReadStateBytes + // > Assert the arguments received + // > Define the returned mock client + mockReadBytesClient := mockReadStateBytesClient(t) + + expectedReq := &proto.ReadStateBytes_Request{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + } + client.EXPECT().ReadStateBytes( + gomock.Any(), + gomock.Eq(expectedReq), + gomock.Any(), + ).Return(mockReadBytesClient, nil) + + // Define what will be returned by each call to Recv + mockReadBytesClient.EXPECT().Recv().Return(&proto.ReadStateBytes_Response{ + Diagnostics: []*proto.Diagnostic{ + { + Severity: proto.Diagnostic_ERROR, + Summary: "Error from test", + Detail: "This error is forced by the test case", + }, + }, + }, nil) + + // Act + request := providers.ReadStateBytesRequest{ + TypeName: expectedReq.TypeName, + StateId: expectedReq.StateId, + } + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiagsHasError(t, resp.Diagnostics) + expectedErr := "Error from test: This error is forced by the test case" + if resp.Diagnostics.Err().Error() != expectedErr { + t.Fatalf("expected error diagnostic %q, but got: %q", expectedErr, resp.Diagnostics.Err()) + } + if len(resp.Bytes) != 0 { + t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) + } + }) + + t.Run("warning diagnostics from the provider are returned", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Call to ReadStateBytes + // > Assert the arguments received + // > Define the returned mock client + mockReadBytesClient := mockReadStateBytesClient(t) + + expectedReq := &proto.ReadStateBytes_Request{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + } + client.EXPECT().ReadStateBytes( + gomock.Any(), + gomock.Eq(expectedReq), + gomock.Any(), + ).Return(mockReadBytesClient, nil) + + // Define what will be returned by each call to Recv + chunk := "hello world" + totalLength := len(chunk) + mockResp := map[int]struct { + resp *proto.ReadStateBytes_Response + err error + }{ + 0: { + resp: &proto.ReadStateBytes_Response{ + Bytes: []byte(chunk), + TotalLength: int64(totalLength), + Range: &proto.StateRange{ + Start: 0, + End: int64(len(chunk)), + }, + Diagnostics: []*proto.Diagnostic{ + { + Severity: proto.Diagnostic_WARNING, + Summary: "Warning from test", + Detail: "This warning is forced by the test case", + }, + }, + }, + err: nil, + }, + 1: { + resp: &proto.ReadStateBytes_Response{}, + err: io.EOF, + }, + } + var count int + mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { + ret := mockResp[count] + count++ + return ret.resp, ret.err + }).Times(2) + + // There will be a call to CloseSend to close the stream + mockReadBytesClient.EXPECT().CloseSend().Return(nil).Times(1) + + // Act + request := providers.ReadStateBytesRequest{ + TypeName: expectedReq.TypeName, + StateId: expectedReq.StateId, + } + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiags(t, resp.Diagnostics) + expectedWarn := "Warning from test: This warning is forced by the test case" + if resp.Diagnostics.ErrWithWarnings().Error() != expectedWarn { + t.Fatalf("expected warning diagnostic %q, but got: %q", expectedWarn, resp.Diagnostics.ErrWithWarnings().Error()) + } + if len(resp.Bytes) == 0 { + t.Fatal("expected data to included despite warnings, but got no bytes") + } + }) + + t.Run("when reading data, grpc errors are surfaced via diagnostics", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Call to ReadStateBytes + // > Assert the arguments received + // > Define the returned mock client + mockClient := mockReadStateBytesClient(t) + expectedReq := &proto.ReadStateBytes_Request{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + } + client.EXPECT().ReadStateBytes( + gomock.Any(), + gomock.Eq(expectedReq), + gomock.Any(), + ).Return(mockClient, nil) + + mockError := errors.New("grpc error forced in test") + mockClient.EXPECT().Recv().Return(&proto.ReadStateBytes_Response{}, mockError) + + // Act + request := providers.ReadStateBytesRequest{ + TypeName: expectedReq.TypeName, + StateId: expectedReq.StateId, + } + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiagsHasError(t, resp.Diagnostics) + wantErr := fmt.Sprintf("Plugin error: The plugin returned an unexpected error from plugin6.(*GRPCProvider).ReadStateBytes: %s", mockError) + if resp.Diagnostics.Err().Error() != wantErr { + t.Fatalf("expected error diagnostic %q, but got: %q", wantErr, resp.Diagnostics.Err()) + } + if len(resp.Bytes) != 0 { + t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) + } + }) + + t.Run("when closing the stream, grpc errors are surfaced via diagnostics", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Call to ReadStateBytes + // > Assert the arguments received + // > Define the returned mock client + mockClient := mockReadStateBytesClient(t) + expectedReq := &proto.ReadStateBytes_Request{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + } + client.EXPECT().ReadStateBytes( + gomock.Any(), + gomock.Eq(expectedReq), + gomock.Any(), + ).Return(mockClient, nil) + + // Sufficient mocking of Recv to get to the call to CloseSend + mockClient.EXPECT().Recv().Return(&proto.ReadStateBytes_Response{}, io.EOF) + + // Force a gRPC error from CloseSend + mockError := errors.New("grpc error forced in test") + mockClient.EXPECT().CloseSend().Return(mockError).Times(1) + + // Act + request := providers.ReadStateBytesRequest{ + TypeName: expectedReq.TypeName, + StateId: expectedReq.StateId, + } + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiagsHasError(t, resp.Diagnostics) + wantErr := fmt.Sprintf("Plugin error: The plugin returned an unexpected error from plugin6.(*GRPCProvider).ReadStateBytes: %s", mockError) + if resp.Diagnostics.Err().Error() != wantErr { + t.Fatalf("expected error diagnostic %q, but got: %q", wantErr, resp.Diagnostics.Err()) + } + if len(resp.Bytes) != 0 { + t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) + } + }) + + t.Run("when reading the data, warnings are raised when chunk sizes mismatch", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", 5) + + // Call to ReadStateBytes + // > Assert the arguments received + // > Define the returned mock client + mockReadBytesClient := mockReadStateBytesClient(t) + + expectedReq := &proto.ReadStateBytes_Request{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + } + client.EXPECT().ReadStateBytes( + gomock.Any(), + gomock.Eq(expectedReq), + gomock.Any(), + ).Return(mockReadBytesClient, nil) + + // Define what will be returned by each call to Recv + chunk := "helloworld" + totalLength := len(chunk) + mockResp := map[int]struct { + resp *proto.ReadStateBytes_Response + err error + }{ + 0: { + resp: &proto.ReadStateBytes_Response{ + Bytes: []byte(chunk[:4]), + TotalLength: int64(totalLength), + Range: &proto.StateRange{ + Start: 0, + End: 4, + }, + Diagnostics: []*proto.Diagnostic{}, + }, + err: nil, + }, + 1: { + resp: &proto.ReadStateBytes_Response{ + Bytes: []byte(chunk[4:]), + TotalLength: int64(totalLength), + Range: &proto.StateRange{ + Start: 4, + End: 10, + }, + Diagnostics: []*proto.Diagnostic{}, + }, + err: nil, + }, + 2: { + resp: &proto.ReadStateBytes_Response{}, + err: io.EOF, + }, + } + var count int + mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { + ret := mockResp[count] + count++ + return ret.resp, ret.err + }).Times(3) + + // There will be a call to CloseSend to close the stream + mockReadBytesClient.EXPECT().CloseSend().Return(nil).Times(1) + + // Act + request := providers.ReadStateBytesRequest{ + TypeName: expectedReq.TypeName, + StateId: expectedReq.StateId, + } + resp := p.ReadStateBytes(request) + + // Assert returned values + checkDiags(t, resp.Diagnostics) + expectedWarn := `2 warnings: + +- Unexpected size of chunk received: Unexpected chunk of size 4 was received, expected 5; this is a bug in the provider mock_store - please report it there +- Unexpected size of last chunk received: Last chunk exceeded agreed size, expected 5, given 6; this is a bug in the provider mock_store - please report it there` + if resp.Diagnostics.ErrWithWarnings().Error() != expectedWarn { + t.Fatalf("expected warning diagnostic %q, but got: %q", expectedWarn, resp.Diagnostics.ErrWithWarnings().Error()) + } + if len(resp.Bytes) != 10 { + t.Fatalf("expected 10 bytes to be read despite warnings, but got %d", len(resp.Bytes)) + } + }) +} + +func TestGRPCProvider_WriteStateBytes(t *testing.T) { + chunkSize := 4 << 20 // 4MB + + t.Run("data smaller than the chunk size is sent in one write action", func(t *testing.T) { + // Less than 4MB + data := []byte("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod" + + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud" + + " exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor" + + " in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint" + + " occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") + + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Assert there will be a call to WriteStateBytes + // & make it return the mock client + mockWriteClient := mockWriteStateBytesClient(t) + client.EXPECT().WriteStateBytes( + gomock.Any(), + gomock.Any(), + ).Return(mockWriteClient, nil) + + // Spy on arguments passed to the Send method of the client + // + // We expect 1 call to Send as the total data + // is less than the chunk size + expectedReq := &proto.WriteStateBytes_RequestChunk{ + Meta: &proto.RequestChunkMeta{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + }, + Bytes: data, + TotalLength: int64(len(data)), + Range: &proto.StateRange{ + Start: 0, + End: int64(len(data)), + }, + } + mockWriteClient.EXPECT().Send(gomock.Eq(expectedReq)).Times(1).Return(nil) + mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(&proto.WriteStateBytes_Response{}, nil) + + // Act + request := providers.WriteStateBytesRequest{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + Bytes: data, + } + resp := p.WriteStateBytes(request) + + // Assert returned values + checkDiags(t, resp.Diagnostics) + }) + + t.Run("data larger than the chunk size is sent in multiple write actions", func(t *testing.T) { + // Make a buffer that can contain 10 bytes more than the 4MB chunk size + chunkSize := 4 * 1_000_000 + dataBuff := bytes.NewBuffer(make([]byte, 0, chunkSize+10)) + dataBuffCopy := bytes.NewBuffer(make([]byte, 0, chunkSize+10)) + for i := 0; i < (chunkSize + 10); i++ { + dataBuff.WriteByte(63) // We're making 4MB + 10 bytes of question marks because why not + dataBuffCopy.WriteByte(63) // Used to make assertions + } + data := dataBuff.Bytes() + dataFirstChunk := dataBuffCopy.Next(chunkSize) // First write will have a full chunk + dataSecondChunk := dataBuffCopy.Next(chunkSize) // This will be the extra 10 bytes + + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Assert there will be a call to WriteStateBytes + // & make it return the mock client + mockWriteClient := mockWriteStateBytesClient(t) + client.EXPECT().WriteStateBytes( + gomock.Any(), + gomock.Any(), + ).Return(mockWriteClient, nil) + + // Spy on arguments passed to the Send method because data + // is written via separate chunks and separate calls to Send. + // + // We expect 2 calls to Send as the total data + // is 10 bytes larger than the chunk size + req1 := &proto.WriteStateBytes_RequestChunk{ + Meta: &proto.RequestChunkMeta{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + }, + Bytes: dataFirstChunk, + TotalLength: int64(len(data)), + Range: &proto.StateRange{ + Start: 0, + End: int64(chunkSize), + }, + } + req2 := &proto.WriteStateBytes_RequestChunk{ + Meta: nil, + Bytes: dataSecondChunk, + TotalLength: int64(len(data)), + Range: &proto.StateRange{ + Start: int64(chunkSize), + End: int64(chunkSize + 10), + }, + } + mockWriteClient.EXPECT().Send(gomock.AnyOf(req1, req2)).Times(2).Return(nil) + mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(&proto.WriteStateBytes_Response{}, nil) + + // Act + request := providers.WriteStateBytesRequest{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + Bytes: data, + } + resp := p.WriteStateBytes(request) + + // Assert returned values + checkDiags(t, resp.Diagnostics) + }) + + t.Run("when writing data, grpc errors are surfaced via diagnostics", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Assert there will be a call to WriteStateBytes + // & make it return the mock client + mockWriteClient := mockWriteStateBytesClient(t) + client.EXPECT().WriteStateBytes( + gomock.Any(), + gomock.Any(), + ).Return(mockWriteClient, nil) + + mockError := errors.New("grpc error forced in test") + mockWriteClient.EXPECT().Send(gomock.Any()).Return(mockError) + + // Act + request := providers.WriteStateBytesRequest{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + Bytes: []byte("helloworld"), + } + resp := p.WriteStateBytes(request) + + // Assert returned values + checkDiagsHasError(t, resp.Diagnostics) + wantErr := fmt.Sprintf("Plugin error: The plugin returned an unexpected error from plugin6.(*GRPCProvider).WriteStateBytes: %s", mockError) + if resp.Diagnostics.Err().Error() != wantErr { + t.Fatalf("unexpected error, wanted %q, got: %s", wantErr, resp.Diagnostics.Err()) + } + }) + + t.Run("error diagnostics from the provider when closing the connection are returned", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Assert there will be a call to WriteStateBytes + // & make it return the mock client + mockWriteClient := mockWriteStateBytesClient(t) + client.EXPECT().WriteStateBytes( + gomock.Any(), + gomock.Any(), + ).Return(mockWriteClient, nil) + + data := []byte("helloworld") + mockReq := &proto.WriteStateBytes_RequestChunk{ + Meta: &proto.RequestChunkMeta{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + }, + Bytes: data, + TotalLength: int64(len(data)), + Range: &proto.StateRange{ + Start: 0, + End: int64(len(data)), + }, + } + mockResp := &proto.WriteStateBytes_Response{ + Diagnostics: []*proto.Diagnostic{ + { + Severity: proto.Diagnostic_ERROR, + Summary: "Error from test mock", + Detail: "This error is returned from the test mock", + }, + }, + } + mockWriteClient.EXPECT().Send(gomock.Eq(mockReq)).Times(1).Return(nil) + mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(mockResp, nil) + + // Act + request := providers.WriteStateBytesRequest{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + Bytes: data, + } + resp := p.WriteStateBytes(request) + + // Assert returned values + checkDiagsHasError(t, resp.Diagnostics) + if resp.Diagnostics.Err().Error() != "Error from test mock: This error is returned from the test mock" { + t.Fatal() + } + }) + + t.Run("warning diagnostics from the provider when closing the connection are returned", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + p.SetStateStoreChunkSize("mock_store", chunkSize) + + // Assert there will be a call to WriteStateBytes + // & make it return the mock client + mockWriteClient := mockWriteStateBytesClient(t) + client.EXPECT().WriteStateBytes( + gomock.Any(), + gomock.Any(), + ).Return(mockWriteClient, nil) + + data := []byte("helloworld") + mockReq := &proto.WriteStateBytes_RequestChunk{ + Meta: &proto.RequestChunkMeta{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + }, + Bytes: data, + TotalLength: int64(len(data)), + Range: &proto.StateRange{ + Start: 0, + End: int64(len(data)), + }, + } + mockResp := &proto.WriteStateBytes_Response{ + Diagnostics: []*proto.Diagnostic{ + { + Severity: proto.Diagnostic_WARNING, + Summary: "Warning from test mock", + Detail: "This warning is returned from the test mock", + }, + }, + } + mockWriteClient.EXPECT().Send(gomock.Eq(mockReq)).Times(1).Return(nil) + mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(mockResp, nil) + + // Act + request := providers.WriteStateBytesRequest{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + Bytes: data, + } + resp := p.WriteStateBytes(request) + + // Assert returned values + checkDiags(t, resp.Diagnostics) + if resp.Diagnostics.ErrWithWarnings().Error() != "Warning from test mock: This warning is returned from the test mock" { + t.Fatal() + } + }) +} diff --git a/internal/plugin6/mock_proto/generate.go b/internal/plugin6/mock_proto/generate.go index 36cc550081ce..4d7f823b94ae 100644 --- a/internal/plugin6/mock_proto/generate.go +++ b/internal/plugin6/mock_proto/generate.go @@ -1,6 +1,6 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 -//go:generate go tool go.uber.org/mock/mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient +//go:generate go tool go.uber.org/mock/mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient,Provider_ReadStateBytesClient,Provider_WriteStateBytesClient package mock_tfplugin6 diff --git a/internal/plugin6/mock_proto/mock.go b/internal/plugin6/mock_proto/mock.go index 9e922a0fce74..8853386f341c 100644 --- a/internal/plugin6/mock_proto/mock.go +++ b/internal/plugin6/mock_proto/mock.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/hashicorp/terraform/internal/tfplugin6 (interfaces: ProviderClient,Provider_InvokeActionClient) +// Source: github.com/hashicorp/terraform/internal/tfplugin6 (interfaces: ProviderClient,Provider_InvokeActionClient,Provider_ReadStateBytesClient,Provider_WriteStateBytesClient) // // Generated by this command: // -// mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient +// mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient,Provider_ReadStateBytesClient,Provider_WriteStateBytesClient // // Package mock_tfplugin6 is a generated GoMock package. @@ -463,6 +463,26 @@ func (mr *MockProviderClientMockRecorder) ReadResource(ctx, in any, opts ...any) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadResource", reflect.TypeOf((*MockProviderClient)(nil).ReadResource), varargs...) } +// ReadStateBytes mocks base method. +func (m *MockProviderClient) ReadStateBytes(ctx context.Context, in *tfplugin6.ReadStateBytes_Request, opts ...grpc.CallOption) (tfplugin6.Provider_ReadStateBytesClient, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ReadStateBytes", varargs...) + ret0, _ := ret[0].(tfplugin6.Provider_ReadStateBytesClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ReadStateBytes indicates an expected call of ReadStateBytes. +func (mr *MockProviderClientMockRecorder) ReadStateBytes(ctx, in any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadStateBytes", reflect.TypeOf((*MockProviderClient)(nil).ReadStateBytes), varargs...) +} + // RenewEphemeralResource mocks base method. func (m *MockProviderClient) RenewEphemeralResource(ctx context.Context, in *tfplugin6.RenewEphemeralResource_Request, opts ...grpc.CallOption) (*tfplugin6.RenewEphemeralResource_Response, error) { m.ctrl.T.Helper() @@ -683,6 +703,26 @@ func (mr *MockProviderClientMockRecorder) ValidateStateStoreConfig(ctx, in any, return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateStateStoreConfig", reflect.TypeOf((*MockProviderClient)(nil).ValidateStateStoreConfig), varargs...) } +// WriteStateBytes mocks base method. +func (m *MockProviderClient) WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (tfplugin6.Provider_WriteStateBytesClient, error) { + m.ctrl.T.Helper() + varargs := []any{ctx} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WriteStateBytes", varargs...) + ret0, _ := ret[0].(tfplugin6.Provider_WriteStateBytesClient) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// WriteStateBytes indicates an expected call of WriteStateBytes. +func (mr *MockProviderClientMockRecorder) WriteStateBytes(ctx any, opts ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteStateBytes", reflect.TypeOf((*MockProviderClient)(nil).WriteStateBytes), varargs...) +} + // MockProvider_InvokeActionClient is a mock of Provider_InvokeActionClient interface. type MockProvider_InvokeActionClient struct { ctrl *gomock.Controller @@ -806,3 +846,265 @@ func (mr *MockProvider_InvokeActionClientMockRecorder) Trailer() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockProvider_InvokeActionClient)(nil).Trailer)) } + +// MockProvider_ReadStateBytesClient is a mock of Provider_ReadStateBytesClient interface. +type MockProvider_ReadStateBytesClient struct { + ctrl *gomock.Controller + recorder *MockProvider_ReadStateBytesClientMockRecorder + isgomock struct{} +} + +// MockProvider_ReadStateBytesClientMockRecorder is the mock recorder for MockProvider_ReadStateBytesClient. +type MockProvider_ReadStateBytesClientMockRecorder struct { + mock *MockProvider_ReadStateBytesClient +} + +// NewMockProvider_ReadStateBytesClient creates a new mock instance. +func NewMockProvider_ReadStateBytesClient(ctrl *gomock.Controller) *MockProvider_ReadStateBytesClient { + mock := &MockProvider_ReadStateBytesClient{ctrl: ctrl} + mock.recorder = &MockProvider_ReadStateBytesClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockProvider_ReadStateBytesClient) EXPECT() *MockProvider_ReadStateBytesClientMockRecorder { + return m.recorder +} + +// CloseSend mocks base method. +func (m *MockProvider_ReadStateBytesClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockProvider_ReadStateBytesClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockProvider_ReadStateBytesClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockProvider_ReadStateBytesClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockProvider_ReadStateBytesClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockProvider_ReadStateBytesClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Header)) +} + +// Recv mocks base method. +func (m *MockProvider_ReadStateBytesClient) Recv() (*tfplugin6.ReadStateBytes_Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Recv") + ret0, _ := ret[0].(*tfplugin6.ReadStateBytes_Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Recv indicates an expected call of Recv. +func (mr *MockProvider_ReadStateBytesClientMockRecorder) Recv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Recv)) +} + +// RecvMsg mocks base method. +func (m_2 *MockProvider_ReadStateBytesClient) RecvMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockProvider_ReadStateBytesClientMockRecorder) RecvMsg(m any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).RecvMsg), m) +} + +// SendMsg mocks base method. +func (m_2 *MockProvider_ReadStateBytesClient) SendMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockProvider_ReadStateBytesClientMockRecorder) SendMsg(m any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockProvider_ReadStateBytesClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockProvider_ReadStateBytesClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Trailer)) +} + +// MockProvider_WriteStateBytesClient is a mock of Provider_WriteStateBytesClient interface. +type MockProvider_WriteStateBytesClient struct { + ctrl *gomock.Controller + recorder *MockProvider_WriteStateBytesClientMockRecorder + isgomock struct{} +} + +// MockProvider_WriteStateBytesClientMockRecorder is the mock recorder for MockProvider_WriteStateBytesClient. +type MockProvider_WriteStateBytesClientMockRecorder struct { + mock *MockProvider_WriteStateBytesClient +} + +// NewMockProvider_WriteStateBytesClient creates a new mock instance. +func NewMockProvider_WriteStateBytesClient(ctrl *gomock.Controller) *MockProvider_WriteStateBytesClient { + mock := &MockProvider_WriteStateBytesClient{ctrl: ctrl} + mock.recorder = &MockProvider_WriteStateBytesClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockProvider_WriteStateBytesClient) EXPECT() *MockProvider_WriteStateBytesClientMockRecorder { + return m.recorder +} + +// CloseAndRecv mocks base method. +func (m *MockProvider_WriteStateBytesClient) CloseAndRecv() (*tfplugin6.WriteStateBytes_Response, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseAndRecv") + ret0, _ := ret[0].(*tfplugin6.WriteStateBytes_Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CloseAndRecv indicates an expected call of CloseAndRecv. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) CloseAndRecv() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseAndRecv", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).CloseAndRecv)) +} + +// CloseSend mocks base method. +func (m *MockProvider_WriteStateBytesClient) CloseSend() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CloseSend") + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseSend indicates an expected call of CloseSend. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) CloseSend() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).CloseSend)) +} + +// Context mocks base method. +func (m *MockProvider_WriteStateBytesClient) Context() context.Context { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Context") + ret0, _ := ret[0].(context.Context) + return ret0 +} + +// Context indicates an expected call of Context. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) Context() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Context)) +} + +// Header mocks base method. +func (m *MockProvider_WriteStateBytesClient) Header() (metadata.MD, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Header") + ret0, _ := ret[0].(metadata.MD) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Header indicates an expected call of Header. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) Header() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Header)) +} + +// RecvMsg mocks base method. +func (m_2 *MockProvider_WriteStateBytesClient) RecvMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "RecvMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// RecvMsg indicates an expected call of RecvMsg. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) RecvMsg(m any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).RecvMsg), m) +} + +// Send mocks base method. +func (m *MockProvider_WriteStateBytesClient) Send(arg0 *tfplugin6.WriteStateBytes_RequestChunk) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Send indicates an expected call of Send. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) Send(arg0 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Send), arg0) +} + +// SendMsg mocks base method. +func (m_2 *MockProvider_WriteStateBytesClient) SendMsg(m any) error { + m_2.ctrl.T.Helper() + ret := m_2.ctrl.Call(m_2, "SendMsg", m) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendMsg indicates an expected call of SendMsg. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) SendMsg(m any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).SendMsg), m) +} + +// Trailer mocks base method. +func (m *MockProvider_WriteStateBytesClient) Trailer() metadata.MD { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Trailer") + ret0, _ := ret[0].(metadata.MD) + return ret0 +} + +// Trailer indicates an expected call of Trailer. +func (mr *MockProvider_WriteStateBytesClientMockRecorder) Trailer() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Trailer)) +} diff --git a/internal/provider-simple-v6/provider.go b/internal/provider-simple-v6/provider.go index dae2e4a728b4..73085cba1930 100644 --- a/internal/provider-simple-v6/provider.go +++ b/internal/provider-simple-v6/provider.go @@ -317,6 +317,14 @@ func (s simple) ConfigureStateStore(req providers.ConfigureStateStoreRequest) pr panic("not implemented") } +func (s simple) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + panic("not implemented") +} + +func (s simple) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + panic("not implemented") +} + func (s simple) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { panic("not implemented") } diff --git a/internal/provider-simple/provider.go b/internal/provider-simple/provider.go index 314ca9fcd5b3..55093510b55a 100644 --- a/internal/provider-simple/provider.go +++ b/internal/provider-simple/provider.go @@ -277,6 +277,14 @@ func (s simple) ConfigureStateStore(req providers.ConfigureStateStoreRequest) pr panic("not implemented") } +func (s simple) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + panic("not implemented") +} + +func (s simple) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + panic("not implemented") +} + func (s simple) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { // provider-simple uses protocol version 5, which does not include the RPC that maps to this method panic("not implemented") diff --git a/internal/providers/mock.go b/internal/providers/mock.go index a5e4005b6c12..1cee9de06f00 100644 --- a/internal/providers/mock.go +++ b/internal/providers/mock.go @@ -436,6 +436,14 @@ func (m *Mock) ConfigureStateStore(req ConfigureStateStoreRequest) ConfigureStat return m.Provider.ConfigureStateStore(req) } +func (m *Mock) ReadStateBytes(req ReadStateBytesRequest) ReadStateBytesResponse { + return m.Provider.ReadStateBytes(req) +} + +func (m *Mock) WriteStateBytes(req WriteStateBytesRequest) WriteStateBytesResponse { + return m.Provider.WriteStateBytes(req) +} + func (m *Mock) GetStates(req GetStatesRequest) GetStatesResponse { return m.Provider.GetStates(req) } diff --git a/internal/providers/provider.go b/internal/providers/provider.go index 579626c3699f..83036bfd3b07 100644 --- a/internal/providers/provider.go +++ b/internal/providers/provider.go @@ -123,6 +123,11 @@ type Interface interface { // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider ConfigureStateStore(ConfigureStateStoreRequest) ConfigureStateStoreResponse + // ReadStateBytes streams byte chunks of a given state file from a state store + ReadStateBytes(ReadStateBytesRequest) ReadStateBytesResponse + // WriteStateBytes streams byte chunks of a given state file into a state store + WriteStateBytes(WriteStateBytesRequest) WriteStateBytesResponse + // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store GetStates(GetStatesRequest) GetStatesResponse // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) @@ -141,6 +146,10 @@ type Interface interface { Close() error } +type StateStoreChunkSizeSetter interface { + SetStateStoreChunkSize(typeName string, size int) +} + // GetProviderSchemaResponse is the return type for GetProviderSchema, and // should only be used when handling a value for that method. The handling of // of schemas in any other context should always use ProviderSchema, so that @@ -847,11 +856,51 @@ type ConfigureStateStoreRequest struct { // Config is the configuration value to configure the store with. Config cty.Value + + Capabilities StateStoreClientCapabilities +} + +type StateStoreClientCapabilities struct { + ChunkSize int64 } type ConfigureStateStoreResponse struct { // Diagnostics contains any warnings or errors from the method call. Diagnostics tfdiags.Diagnostics + + Capabilities StateStoreServerCapabilities +} + +type StateStoreServerCapabilities struct { + ChunkSize int64 +} + +type ReadStateBytesRequest struct { + // TypeName is the name of the state store to read state from + TypeName string + // StateId is the ID of a state file to read + StateId string +} + +type ReadStateBytesResponse struct { + // Bytes represents all received bytes of the given state file + Bytes []byte + // Diagnostics contains any warnings or errors from the method call. + Diagnostics tfdiags.Diagnostics +} + +type WriteStateBytesRequest struct { + // TypeName is the name of the state store to write state to + TypeName string + // Bytes represents all bytes of the given state file to write + Bytes []byte + // StateId is the ID of a state file to write + StateId string +} + +type WriteStateBytesResponse struct { + // Diagnostics contains any warnings or errors from the method call. + Diagnostics tfdiags.Diagnostics } type GetStatesRequest struct { diff --git a/internal/providers/testing/provider_mock.go b/internal/providers/testing/provider_mock.go index 82e4dd5db08e..9b38da2ba83b 100644 --- a/internal/providers/testing/provider_mock.go +++ b/internal/providers/testing/provider_mock.go @@ -146,6 +146,16 @@ type MockProvider struct { ConfigureStateStoreRequest providers.ConfigureStateStoreRequest ConfigureStateStoreFn func(providers.ConfigureStateStoreRequest) providers.ConfigureStateStoreResponse + ReadStateBytesCalled bool + ReadStateBytesRequest providers.ReadStateBytesRequest + ReadStateBytesFn func(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse + ReadStateBytesResponse providers.ReadStateBytesResponse + + WriteStateBytesCalled bool + WriteStateBytesRequest providers.WriteStateBytesRequest + WriteStateBytesFn func(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse + WriteStateBytesResponse providers.WriteStateBytesResponse + GetStatesCalled bool GetStatesResponse *providers.GetStatesResponse GetStatesRequest providers.GetStatesRequest @@ -304,6 +314,32 @@ func (p *MockProvider) ValidateDataResourceConfig(r providers.ValidateDataResour return resp } +func (p *MockProvider) ReadStateBytes(r providers.ReadStateBytesRequest) (resp providers.ReadStateBytesResponse) { + p.Lock() + defer p.Unlock() + p.ReadStateBytesCalled = true + p.ReadStateBytesRequest = r + + if p.ReadStateBytesFn != nil { + return p.ReadStateBytesFn(r) + } + + return p.ReadStateBytesResponse +} + +func (p *MockProvider) WriteStateBytes(r providers.WriteStateBytesRequest) (resp providers.WriteStateBytesResponse) { + p.Lock() + defer p.Unlock() + p.WriteStateBytesCalled = true + p.WriteStateBytesRequest = r + + if p.WriteStateBytesFn != nil { + return p.WriteStateBytesFn(r) + } + + return p.WriteStateBytesResponse +} + func (p *MockProvider) ValidateEphemeralResourceConfig(r providers.ValidateEphemeralResourceConfigRequest) (resp providers.ValidateEphemeralResourceConfigResponse) { defer p.beginWrite()() diff --git a/internal/refactoring/mock_provider.go b/internal/refactoring/mock_provider.go index 15f332b0e8e3..67babcf1904f 100644 --- a/internal/refactoring/mock_provider.go +++ b/internal/refactoring/mock_provider.go @@ -134,6 +134,14 @@ func (provider *mockProvider) ConfigureStateStore(req providers.ConfigureStateSt panic("not implemented in mock") } +func (provider *mockProvider) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + panic("not implemented in mock") +} + +func (provider *mockProvider) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + panic("not implemented in mock") +} + func (provider *mockProvider) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { panic("not implemented in mock") } diff --git a/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go b/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go index e351b421cad0..0184bedcd64a 100644 --- a/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go +++ b/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go @@ -276,6 +276,34 @@ func (p *erroredProvider) ConfigureStateStore(providers.ConfigureStateStoreReque } } +// ReadStateBytes implements providers.Interface. +func (p *erroredProvider) ReadStateBytes(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + var diags tfdiags.Diagnostics + diags = diags.Append(tfdiags.AttributeValue( + tfdiags.Error, + "Provider configuration is invalid", + "Cannot read state managed by this state store because its associated provider configuration is invalid.", + nil, // nil attribute path means the overall configuration block + )) + return providers.ReadStateBytesResponse{ + Diagnostics: diags, + } +} + +// WriteStateBytes implements providers.Interface. +func (p *erroredProvider) WriteStateBytes(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + var diags tfdiags.Diagnostics + diags = diags.Append(tfdiags.AttributeValue( + tfdiags.Error, + "Provider configuration is invalid", + "Cannot write state managed by this state store because its associated provider configuration is invalid.", + nil, // nil attribute path means the overall configuration block + )) + return providers.WriteStateBytesResponse{ + Diagnostics: diags, + } +} + // GetStates implements providers.Interface. func (p *erroredProvider) GetStates(providers.GetStatesRequest) providers.GetStatesResponse { var diags tfdiags.Diagnostics diff --git a/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go b/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go index d4dd73c4e05e..4235f1743d71 100644 --- a/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go +++ b/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go @@ -293,6 +293,34 @@ func (o *offlineProvider) ConfigureStateStore(providers.ConfigureStateStoreReque } } +// ReadStateBytes implements providers.Interface. +func (o *offlineProvider) ReadStateBytes(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + var diags tfdiags.Diagnostics + diags = diags.Append(tfdiags.AttributeValue( + tfdiags.Error, + "Called ReadStateBytes on an unconfigured provider", + "Cannot read from state store because this provider is not configured. This is a bug in Terraform - please report it.", + nil, // nil attribute path means the overall configuration block + )) + return providers.ReadStateBytesResponse{ + Diagnostics: diags, + } +} + +// WriteStateBytes implements providers.Interface. +func (o *offlineProvider) WriteStateBytes(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + var diags tfdiags.Diagnostics + diags = diags.Append(tfdiags.AttributeValue( + tfdiags.Error, + "Called WriteStateBytes on an unconfigured provider", + "Cannot write to state store because this provider is not configured. This is a bug in Terraform - please report it.", + nil, // nil attribute path means the overall configuration block + )) + return providers.WriteStateBytesResponse{ + Diagnostics: diags, + } +} + // GetStates implements providers.Interface. func (o *offlineProvider) GetStates(providers.GetStatesRequest) providers.GetStatesResponse { var diags tfdiags.Diagnostics diff --git a/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go b/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go index 34f6c763b81e..42995611836a 100644 --- a/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go +++ b/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go @@ -341,6 +341,34 @@ func (u *unknownProvider) ConfigureStateStore(providers.ConfigureStateStoreReque } } +// ReadStateBytes implements providers.Interface. +func (u *unknownProvider) ReadStateBytes(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + var diags tfdiags.Diagnostics + diags = diags.Append(tfdiags.AttributeValue( + tfdiags.Error, + "Provider configuration is unknown", + "Cannot read from this state store because its associated provider configuration is unknown.", + nil, // nil attribute path means the overall configuration block + )) + return providers.ReadStateBytesResponse{ + Diagnostics: diags, + } +} + +// WriteStateBytes implements providers.Interface. +func (u *unknownProvider) WriteStateBytes(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + var diags tfdiags.Diagnostics + diags = diags.Append(tfdiags.AttributeValue( + tfdiags.Error, + "Provider configuration is unknown", + "Cannot write to this state store because its associated provider configuration is unknown.", + nil, // nil attribute path means the overall configuration block + )) + return providers.WriteStateBytesResponse{ + Diagnostics: diags, + } +} + // GetStates implements providers.Interface. func (u *unknownProvider) GetStates(providers.GetStatesRequest) providers.GetStatesResponse { var diags tfdiags.Diagnostics diff --git a/internal/tfplugin6/tfplugin6.pb.go b/internal/tfplugin6/tfplugin6.pb.go index c40bb14b33be..7351d20d959e 100644 --- a/internal/tfplugin6/tfplugin6.pb.go +++ b/internal/tfplugin6/tfplugin6.pb.go @@ -2074,6 +2074,270 @@ func (*ConfigureStateStore) Descriptor() ([]byte, []int) { return file_tfplugin6_proto_rawDescGZIP(), []int{39} } +type StateStoreClientCapabilities struct { + state protoimpl.MessageState `protogen:"open.v1"` + ChunkSize int64 `protobuf:"varint,1,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` // suggested chunk size by Core + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StateStoreClientCapabilities) Reset() { + *x = StateStoreClientCapabilities{} + mi := &file_tfplugin6_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StateStoreClientCapabilities) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateStoreClientCapabilities) ProtoMessage() {} + +func (x *StateStoreClientCapabilities) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StateStoreClientCapabilities.ProtoReflect.Descriptor instead. +func (*StateStoreClientCapabilities) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{40} +} + +func (x *StateStoreClientCapabilities) GetChunkSize() int64 { + if x != nil { + return x.ChunkSize + } + return 0 +} + +type StateStoreServerCapabilities struct { + state protoimpl.MessageState `protogen:"open.v1"` + ChunkSize int64 `protobuf:"varint,1,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` // chosen chunk size by plugin + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StateStoreServerCapabilities) Reset() { + *x = StateStoreServerCapabilities{} + mi := &file_tfplugin6_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StateStoreServerCapabilities) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateStoreServerCapabilities) ProtoMessage() {} + +func (x *StateStoreServerCapabilities) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StateStoreServerCapabilities.ProtoReflect.Descriptor instead. +func (*StateStoreServerCapabilities) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{41} +} + +func (x *StateStoreServerCapabilities) GetChunkSize() int64 { + if x != nil { + return x.ChunkSize + } + return 0 +} + +type ReadStateBytes struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReadStateBytes) Reset() { + *x = ReadStateBytes{} + mi := &file_tfplugin6_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReadStateBytes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadStateBytes) ProtoMessage() {} + +func (x *ReadStateBytes) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadStateBytes.ProtoReflect.Descriptor instead. +func (*ReadStateBytes) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{42} +} + +type WriteStateBytes struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WriteStateBytes) Reset() { + *x = WriteStateBytes{} + mi := &file_tfplugin6_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WriteStateBytes) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WriteStateBytes) ProtoMessage() {} + +func (x *WriteStateBytes) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WriteStateBytes.ProtoReflect.Descriptor instead. +func (*WriteStateBytes) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{43} +} + +type RequestChunkMeta struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + StateId string `protobuf:"bytes,2,opt,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RequestChunkMeta) Reset() { + *x = RequestChunkMeta{} + mi := &file_tfplugin6_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RequestChunkMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestChunkMeta) ProtoMessage() {} + +func (x *RequestChunkMeta) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestChunkMeta.ProtoReflect.Descriptor instead. +func (*RequestChunkMeta) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{44} +} + +func (x *RequestChunkMeta) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *RequestChunkMeta) GetStateId() string { + if x != nil { + return x.StateId + } + return "" +} + +type StateRange struct { + state protoimpl.MessageState `protogen:"open.v1"` + Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StateRange) Reset() { + *x = StateRange{} + mi := &file_tfplugin6_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StateRange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateRange) ProtoMessage() {} + +func (x *StateRange) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StateRange.ProtoReflect.Descriptor instead. +func (*StateRange) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{45} +} + +func (x *StateRange) GetStart() int64 { + if x != nil { + return x.Start + } + return 0 +} + +func (x *StateRange) GetEnd() int64 { + if x != nil { + return x.End + } + return 0 +} + type GetStates struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -2082,7 +2346,7 @@ type GetStates struct { func (x *GetStates) Reset() { *x = GetStates{} - mi := &file_tfplugin6_proto_msgTypes[40] + mi := &file_tfplugin6_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2094,7 +2358,7 @@ func (x *GetStates) String() string { func (*GetStates) ProtoMessage() {} func (x *GetStates) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[40] + mi := &file_tfplugin6_proto_msgTypes[46] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2107,7 +2371,7 @@ func (x *GetStates) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStates.ProtoReflect.Descriptor instead. func (*GetStates) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{40} + return file_tfplugin6_proto_rawDescGZIP(), []int{46} } type DeleteState struct { @@ -2118,7 +2382,7 @@ type DeleteState struct { func (x *DeleteState) Reset() { *x = DeleteState{} - mi := &file_tfplugin6_proto_msgTypes[41] + mi := &file_tfplugin6_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2130,7 +2394,7 @@ func (x *DeleteState) String() string { func (*DeleteState) ProtoMessage() {} func (x *DeleteState) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[41] + mi := &file_tfplugin6_proto_msgTypes[47] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2143,7 +2407,7 @@ func (x *DeleteState) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteState.ProtoReflect.Descriptor instead. func (*DeleteState) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{41} + return file_tfplugin6_proto_rawDescGZIP(), []int{47} } type PlanAction struct { @@ -2154,7 +2418,7 @@ type PlanAction struct { func (x *PlanAction) Reset() { *x = PlanAction{} - mi := &file_tfplugin6_proto_msgTypes[42] + mi := &file_tfplugin6_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2166,7 +2430,7 @@ func (x *PlanAction) String() string { func (*PlanAction) ProtoMessage() {} func (x *PlanAction) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[42] + mi := &file_tfplugin6_proto_msgTypes[48] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2179,7 +2443,7 @@ func (x *PlanAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PlanAction.ProtoReflect.Descriptor instead. func (*PlanAction) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{42} + return file_tfplugin6_proto_rawDescGZIP(), []int{48} } type InvokeAction struct { @@ -2190,7 +2454,7 @@ type InvokeAction struct { func (x *InvokeAction) Reset() { *x = InvokeAction{} - mi := &file_tfplugin6_proto_msgTypes[43] + mi := &file_tfplugin6_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2202,7 +2466,7 @@ func (x *InvokeAction) String() string { func (*InvokeAction) ProtoMessage() {} func (x *InvokeAction) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[43] + mi := &file_tfplugin6_proto_msgTypes[49] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2215,7 +2479,7 @@ func (x *InvokeAction) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction.ProtoReflect.Descriptor instead. func (*InvokeAction) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43} + return file_tfplugin6_proto_rawDescGZIP(), []int{49} } type ValidateActionConfig struct { @@ -2226,7 +2490,7 @@ type ValidateActionConfig struct { func (x *ValidateActionConfig) Reset() { *x = ValidateActionConfig{} - mi := &file_tfplugin6_proto_msgTypes[44] + mi := &file_tfplugin6_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2238,7 +2502,7 @@ func (x *ValidateActionConfig) String() string { func (*ValidateActionConfig) ProtoMessage() {} func (x *ValidateActionConfig) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[44] + mi := &file_tfplugin6_proto_msgTypes[50] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2251,7 +2515,7 @@ func (x *ValidateActionConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateActionConfig.ProtoReflect.Descriptor instead. func (*ValidateActionConfig) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{44} + return file_tfplugin6_proto_rawDescGZIP(), []int{50} } type AttributePath_Step struct { @@ -2268,7 +2532,7 @@ type AttributePath_Step struct { func (x *AttributePath_Step) Reset() { *x = AttributePath_Step{} - mi := &file_tfplugin6_proto_msgTypes[45] + mi := &file_tfplugin6_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2280,7 +2544,7 @@ func (x *AttributePath_Step) String() string { func (*AttributePath_Step) ProtoMessage() {} func (x *AttributePath_Step) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[45] + mi := &file_tfplugin6_proto_msgTypes[51] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2364,7 +2628,7 @@ type StopProvider_Request struct { func (x *StopProvider_Request) Reset() { *x = StopProvider_Request{} - mi := &file_tfplugin6_proto_msgTypes[46] + mi := &file_tfplugin6_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2376,7 +2640,7 @@ func (x *StopProvider_Request) String() string { func (*StopProvider_Request) ProtoMessage() {} func (x *StopProvider_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[46] + mi := &file_tfplugin6_proto_msgTypes[52] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2401,7 +2665,7 @@ type StopProvider_Response struct { func (x *StopProvider_Response) Reset() { *x = StopProvider_Response{} - mi := &file_tfplugin6_proto_msgTypes[47] + mi := &file_tfplugin6_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2413,7 +2677,7 @@ func (x *StopProvider_Response) String() string { func (*StopProvider_Response) ProtoMessage() {} func (x *StopProvider_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[47] + mi := &file_tfplugin6_proto_msgTypes[53] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2459,7 +2723,7 @@ type ResourceIdentitySchema_IdentityAttribute struct { func (x *ResourceIdentitySchema_IdentityAttribute) Reset() { *x = ResourceIdentitySchema_IdentityAttribute{} - mi := &file_tfplugin6_proto_msgTypes[49] + mi := &file_tfplugin6_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2471,7 +2735,7 @@ func (x *ResourceIdentitySchema_IdentityAttribute) String() string { func (*ResourceIdentitySchema_IdentityAttribute) ProtoMessage() {} func (x *ResourceIdentitySchema_IdentityAttribute) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[49] + mi := &file_tfplugin6_proto_msgTypes[55] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2536,7 +2800,7 @@ type Schema_Block struct { func (x *Schema_Block) Reset() { *x = Schema_Block{} - mi := &file_tfplugin6_proto_msgTypes[50] + mi := &file_tfplugin6_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2548,7 +2812,7 @@ func (x *Schema_Block) String() string { func (*Schema_Block) ProtoMessage() {} func (x *Schema_Block) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[50] + mi := &file_tfplugin6_proto_msgTypes[56] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2625,7 +2889,7 @@ type Schema_Attribute struct { func (x *Schema_Attribute) Reset() { *x = Schema_Attribute{} - mi := &file_tfplugin6_proto_msgTypes[51] + mi := &file_tfplugin6_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2637,7 +2901,7 @@ func (x *Schema_Attribute) String() string { func (*Schema_Attribute) ProtoMessage() {} func (x *Schema_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[51] + mi := &file_tfplugin6_proto_msgTypes[57] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2743,7 +3007,7 @@ type Schema_NestedBlock struct { func (x *Schema_NestedBlock) Reset() { *x = Schema_NestedBlock{} - mi := &file_tfplugin6_proto_msgTypes[52] + mi := &file_tfplugin6_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2755,7 +3019,7 @@ func (x *Schema_NestedBlock) String() string { func (*Schema_NestedBlock) ProtoMessage() {} func (x *Schema_NestedBlock) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[52] + mi := &file_tfplugin6_proto_msgTypes[58] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2823,7 +3087,7 @@ type Schema_Object struct { func (x *Schema_Object) Reset() { *x = Schema_Object{} - mi := &file_tfplugin6_proto_msgTypes[53] + mi := &file_tfplugin6_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2835,7 +3099,7 @@ func (x *Schema_Object) String() string { func (*Schema_Object) ProtoMessage() {} func (x *Schema_Object) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[53] + mi := &file_tfplugin6_proto_msgTypes[59] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2906,7 +3170,7 @@ type Function_Parameter struct { func (x *Function_Parameter) Reset() { *x = Function_Parameter{} - mi := &file_tfplugin6_proto_msgTypes[54] + mi := &file_tfplugin6_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2918,7 +3182,7 @@ func (x *Function_Parameter) String() string { func (*Function_Parameter) ProtoMessage() {} func (x *Function_Parameter) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[54] + mi := &file_tfplugin6_proto_msgTypes[60] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2986,7 +3250,7 @@ type Function_Return struct { func (x *Function_Return) Reset() { *x = Function_Return{} - mi := &file_tfplugin6_proto_msgTypes[55] + mi := &file_tfplugin6_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2998,7 +3262,7 @@ func (x *Function_Return) String() string { func (*Function_Return) ProtoMessage() {} func (x *Function_Return) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[55] + mi := &file_tfplugin6_proto_msgTypes[61] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3029,7 +3293,7 @@ type GetMetadata_Request struct { func (x *GetMetadata_Request) Reset() { *x = GetMetadata_Request{} - mi := &file_tfplugin6_proto_msgTypes[56] + mi := &file_tfplugin6_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3041,7 +3305,7 @@ func (x *GetMetadata_Request) String() string { func (*GetMetadata_Request) ProtoMessage() {} func (x *GetMetadata_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[56] + mi := &file_tfplugin6_proto_msgTypes[62] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3075,7 +3339,7 @@ type GetMetadata_Response struct { func (x *GetMetadata_Response) Reset() { *x = GetMetadata_Response{} - mi := &file_tfplugin6_proto_msgTypes[57] + mi := &file_tfplugin6_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3087,7 +3351,7 @@ func (x *GetMetadata_Response) String() string { func (*GetMetadata_Response) ProtoMessage() {} func (x *GetMetadata_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[57] + mi := &file_tfplugin6_proto_msgTypes[63] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3175,7 +3439,7 @@ type GetMetadata_EphemeralMetadata struct { func (x *GetMetadata_EphemeralMetadata) Reset() { *x = GetMetadata_EphemeralMetadata{} - mi := &file_tfplugin6_proto_msgTypes[58] + mi := &file_tfplugin6_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3187,7 +3451,7 @@ func (x *GetMetadata_EphemeralMetadata) String() string { func (*GetMetadata_EphemeralMetadata) ProtoMessage() {} func (x *GetMetadata_EphemeralMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[58] + mi := &file_tfplugin6_proto_msgTypes[64] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3220,7 +3484,7 @@ type GetMetadata_FunctionMetadata struct { func (x *GetMetadata_FunctionMetadata) Reset() { *x = GetMetadata_FunctionMetadata{} - mi := &file_tfplugin6_proto_msgTypes[59] + mi := &file_tfplugin6_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3232,7 +3496,7 @@ func (x *GetMetadata_FunctionMetadata) String() string { func (*GetMetadata_FunctionMetadata) ProtoMessage() {} func (x *GetMetadata_FunctionMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[59] + mi := &file_tfplugin6_proto_msgTypes[65] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3264,7 +3528,7 @@ type GetMetadata_DataSourceMetadata struct { func (x *GetMetadata_DataSourceMetadata) Reset() { *x = GetMetadata_DataSourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[60] + mi := &file_tfplugin6_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3276,7 +3540,7 @@ func (x *GetMetadata_DataSourceMetadata) String() string { func (*GetMetadata_DataSourceMetadata) ProtoMessage() {} func (x *GetMetadata_DataSourceMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[60] + mi := &file_tfplugin6_proto_msgTypes[66] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3308,7 +3572,7 @@ type GetMetadata_ResourceMetadata struct { func (x *GetMetadata_ResourceMetadata) Reset() { *x = GetMetadata_ResourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[61] + mi := &file_tfplugin6_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3320,7 +3584,7 @@ func (x *GetMetadata_ResourceMetadata) String() string { func (*GetMetadata_ResourceMetadata) ProtoMessage() {} func (x *GetMetadata_ResourceMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[61] + mi := &file_tfplugin6_proto_msgTypes[67] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3352,7 +3616,7 @@ type GetMetadata_ListResourceMetadata struct { func (x *GetMetadata_ListResourceMetadata) Reset() { *x = GetMetadata_ListResourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[62] + mi := &file_tfplugin6_proto_msgTypes[68] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3364,7 +3628,7 @@ func (x *GetMetadata_ListResourceMetadata) String() string { func (*GetMetadata_ListResourceMetadata) ProtoMessage() {} func (x *GetMetadata_ListResourceMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[62] + mi := &file_tfplugin6_proto_msgTypes[68] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3396,7 +3660,7 @@ type GetMetadata_StateStoreMetadata struct { func (x *GetMetadata_StateStoreMetadata) Reset() { *x = GetMetadata_StateStoreMetadata{} - mi := &file_tfplugin6_proto_msgTypes[63] + mi := &file_tfplugin6_proto_msgTypes[69] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3408,7 +3672,7 @@ func (x *GetMetadata_StateStoreMetadata) String() string { func (*GetMetadata_StateStoreMetadata) ProtoMessage() {} func (x *GetMetadata_StateStoreMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[63] + mi := &file_tfplugin6_proto_msgTypes[69] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3440,7 +3704,7 @@ type GetMetadata_ActionMetadata struct { func (x *GetMetadata_ActionMetadata) Reset() { *x = GetMetadata_ActionMetadata{} - mi := &file_tfplugin6_proto_msgTypes[64] + mi := &file_tfplugin6_proto_msgTypes[70] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3452,7 +3716,7 @@ func (x *GetMetadata_ActionMetadata) String() string { func (*GetMetadata_ActionMetadata) ProtoMessage() {} func (x *GetMetadata_ActionMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[64] + mi := &file_tfplugin6_proto_msgTypes[70] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3483,7 +3747,7 @@ type GetProviderSchema_Request struct { func (x *GetProviderSchema_Request) Reset() { *x = GetProviderSchema_Request{} - mi := &file_tfplugin6_proto_msgTypes[65] + mi := &file_tfplugin6_proto_msgTypes[71] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3495,7 +3759,7 @@ func (x *GetProviderSchema_Request) String() string { func (*GetProviderSchema_Request) ProtoMessage() {} func (x *GetProviderSchema_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[65] + mi := &file_tfplugin6_proto_msgTypes[71] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3530,7 +3794,7 @@ type GetProviderSchema_Response struct { func (x *GetProviderSchema_Response) Reset() { *x = GetProviderSchema_Response{} - mi := &file_tfplugin6_proto_msgTypes[66] + mi := &file_tfplugin6_proto_msgTypes[72] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3542,7 +3806,7 @@ func (x *GetProviderSchema_Response) String() string { func (*GetProviderSchema_Response) ProtoMessage() {} func (x *GetProviderSchema_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[66] + mi := &file_tfplugin6_proto_msgTypes[72] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3644,7 +3908,7 @@ type ValidateProviderConfig_Request struct { func (x *ValidateProviderConfig_Request) Reset() { *x = ValidateProviderConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[74] + mi := &file_tfplugin6_proto_msgTypes[80] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3656,7 +3920,7 @@ func (x *ValidateProviderConfig_Request) String() string { func (*ValidateProviderConfig_Request) ProtoMessage() {} func (x *ValidateProviderConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[74] + mi := &file_tfplugin6_proto_msgTypes[80] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3688,7 +3952,7 @@ type ValidateProviderConfig_Response struct { func (x *ValidateProviderConfig_Response) Reset() { *x = ValidateProviderConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[75] + mi := &file_tfplugin6_proto_msgTypes[81] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3700,7 +3964,7 @@ func (x *ValidateProviderConfig_Response) String() string { func (*ValidateProviderConfig_Response) ProtoMessage() {} func (x *ValidateProviderConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[75] + mi := &file_tfplugin6_proto_msgTypes[81] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3749,7 +4013,7 @@ type UpgradeResourceState_Request struct { func (x *UpgradeResourceState_Request) Reset() { *x = UpgradeResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[76] + mi := &file_tfplugin6_proto_msgTypes[82] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3761,7 +4025,7 @@ func (x *UpgradeResourceState_Request) String() string { func (*UpgradeResourceState_Request) ProtoMessage() {} func (x *UpgradeResourceState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[76] + mi := &file_tfplugin6_proto_msgTypes[82] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3814,7 +4078,7 @@ type UpgradeResourceState_Response struct { func (x *UpgradeResourceState_Response) Reset() { *x = UpgradeResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[77] + mi := &file_tfplugin6_proto_msgTypes[83] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3826,7 +4090,7 @@ func (x *UpgradeResourceState_Response) String() string { func (*UpgradeResourceState_Response) ProtoMessage() {} func (x *UpgradeResourceState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[77] + mi := &file_tfplugin6_proto_msgTypes[83] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3864,7 +4128,7 @@ type GetResourceIdentitySchemas_Request struct { func (x *GetResourceIdentitySchemas_Request) Reset() { *x = GetResourceIdentitySchemas_Request{} - mi := &file_tfplugin6_proto_msgTypes[78] + mi := &file_tfplugin6_proto_msgTypes[84] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3876,7 +4140,7 @@ func (x *GetResourceIdentitySchemas_Request) String() string { func (*GetResourceIdentitySchemas_Request) ProtoMessage() {} func (x *GetResourceIdentitySchemas_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[78] + mi := &file_tfplugin6_proto_msgTypes[84] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3904,7 +4168,7 @@ type GetResourceIdentitySchemas_Response struct { func (x *GetResourceIdentitySchemas_Response) Reset() { *x = GetResourceIdentitySchemas_Response{} - mi := &file_tfplugin6_proto_msgTypes[79] + mi := &file_tfplugin6_proto_msgTypes[85] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3916,7 +4180,7 @@ func (x *GetResourceIdentitySchemas_Response) String() string { func (*GetResourceIdentitySchemas_Response) ProtoMessage() {} func (x *GetResourceIdentitySchemas_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[79] + mi := &file_tfplugin6_proto_msgTypes[85] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3963,7 +4227,7 @@ type UpgradeResourceIdentity_Request struct { func (x *UpgradeResourceIdentity_Request) Reset() { *x = UpgradeResourceIdentity_Request{} - mi := &file_tfplugin6_proto_msgTypes[81] + mi := &file_tfplugin6_proto_msgTypes[87] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3975,7 +4239,7 @@ func (x *UpgradeResourceIdentity_Request) String() string { func (*UpgradeResourceIdentity_Request) ProtoMessage() {} func (x *UpgradeResourceIdentity_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[81] + mi := &file_tfplugin6_proto_msgTypes[87] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4024,7 +4288,7 @@ type UpgradeResourceIdentity_Response struct { func (x *UpgradeResourceIdentity_Response) Reset() { *x = UpgradeResourceIdentity_Response{} - mi := &file_tfplugin6_proto_msgTypes[82] + mi := &file_tfplugin6_proto_msgTypes[88] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4036,7 +4300,7 @@ func (x *UpgradeResourceIdentity_Response) String() string { func (*UpgradeResourceIdentity_Response) ProtoMessage() {} func (x *UpgradeResourceIdentity_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[82] + mi := &file_tfplugin6_proto_msgTypes[88] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4077,7 +4341,7 @@ type ValidateResourceConfig_Request struct { func (x *ValidateResourceConfig_Request) Reset() { *x = ValidateResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[83] + mi := &file_tfplugin6_proto_msgTypes[89] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4089,7 +4353,7 @@ func (x *ValidateResourceConfig_Request) String() string { func (*ValidateResourceConfig_Request) ProtoMessage() {} func (x *ValidateResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[83] + mi := &file_tfplugin6_proto_msgTypes[89] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4135,7 +4399,7 @@ type ValidateResourceConfig_Response struct { func (x *ValidateResourceConfig_Response) Reset() { *x = ValidateResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[84] + mi := &file_tfplugin6_proto_msgTypes[90] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4147,7 +4411,7 @@ func (x *ValidateResourceConfig_Response) String() string { func (*ValidateResourceConfig_Response) ProtoMessage() {} func (x *ValidateResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[84] + mi := &file_tfplugin6_proto_msgTypes[90] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4180,7 +4444,7 @@ type ValidateDataResourceConfig_Request struct { func (x *ValidateDataResourceConfig_Request) Reset() { *x = ValidateDataResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[85] + mi := &file_tfplugin6_proto_msgTypes[91] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4192,7 +4456,7 @@ func (x *ValidateDataResourceConfig_Request) String() string { func (*ValidateDataResourceConfig_Request) ProtoMessage() {} func (x *ValidateDataResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[85] + mi := &file_tfplugin6_proto_msgTypes[91] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4231,7 +4495,7 @@ type ValidateDataResourceConfig_Response struct { func (x *ValidateDataResourceConfig_Response) Reset() { *x = ValidateDataResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[86] + mi := &file_tfplugin6_proto_msgTypes[92] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4243,7 +4507,7 @@ func (x *ValidateDataResourceConfig_Response) String() string { func (*ValidateDataResourceConfig_Response) ProtoMessage() {} func (x *ValidateDataResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[86] + mi := &file_tfplugin6_proto_msgTypes[92] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4276,7 +4540,7 @@ type ValidateEphemeralResourceConfig_Request struct { func (x *ValidateEphemeralResourceConfig_Request) Reset() { *x = ValidateEphemeralResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[87] + mi := &file_tfplugin6_proto_msgTypes[93] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4288,7 +4552,7 @@ func (x *ValidateEphemeralResourceConfig_Request) String() string { func (*ValidateEphemeralResourceConfig_Request) ProtoMessage() {} func (x *ValidateEphemeralResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[87] + mi := &file_tfplugin6_proto_msgTypes[93] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4327,7 +4591,7 @@ type ValidateEphemeralResourceConfig_Response struct { func (x *ValidateEphemeralResourceConfig_Response) Reset() { *x = ValidateEphemeralResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[88] + mi := &file_tfplugin6_proto_msgTypes[94] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4339,7 +4603,7 @@ func (x *ValidateEphemeralResourceConfig_Response) String() string { func (*ValidateEphemeralResourceConfig_Response) ProtoMessage() {} func (x *ValidateEphemeralResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[88] + mi := &file_tfplugin6_proto_msgTypes[94] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4373,7 +4637,7 @@ type ConfigureProvider_Request struct { func (x *ConfigureProvider_Request) Reset() { *x = ConfigureProvider_Request{} - mi := &file_tfplugin6_proto_msgTypes[89] + mi := &file_tfplugin6_proto_msgTypes[95] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4385,7 +4649,7 @@ func (x *ConfigureProvider_Request) String() string { func (*ConfigureProvider_Request) ProtoMessage() {} func (x *ConfigureProvider_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[89] + mi := &file_tfplugin6_proto_msgTypes[95] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4431,7 +4695,7 @@ type ConfigureProvider_Response struct { func (x *ConfigureProvider_Response) Reset() { *x = ConfigureProvider_Response{} - mi := &file_tfplugin6_proto_msgTypes[90] + mi := &file_tfplugin6_proto_msgTypes[96] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4443,7 +4707,7 @@ func (x *ConfigureProvider_Response) String() string { func (*ConfigureProvider_Response) ProtoMessage() {} func (x *ConfigureProvider_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[90] + mi := &file_tfplugin6_proto_msgTypes[96] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4488,7 +4752,7 @@ type ReadResource_Request struct { func (x *ReadResource_Request) Reset() { *x = ReadResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[91] + mi := &file_tfplugin6_proto_msgTypes[97] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4500,7 +4764,7 @@ func (x *ReadResource_Request) String() string { func (*ReadResource_Request) ProtoMessage() {} func (x *ReadResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[91] + mi := &file_tfplugin6_proto_msgTypes[97] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4573,7 +4837,7 @@ type ReadResource_Response struct { func (x *ReadResource_Response) Reset() { *x = ReadResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[92] + mi := &file_tfplugin6_proto_msgTypes[98] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4585,7 +4849,7 @@ func (x *ReadResource_Response) String() string { func (*ReadResource_Response) ProtoMessage() {} func (x *ReadResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[92] + mi := &file_tfplugin6_proto_msgTypes[98] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4652,7 +4916,7 @@ type PlanResourceChange_Request struct { func (x *PlanResourceChange_Request) Reset() { *x = PlanResourceChange_Request{} - mi := &file_tfplugin6_proto_msgTypes[93] + mi := &file_tfplugin6_proto_msgTypes[99] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4664,7 +4928,7 @@ func (x *PlanResourceChange_Request) String() string { func (*PlanResourceChange_Request) ProtoMessage() {} func (x *PlanResourceChange_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[93] + mi := &file_tfplugin6_proto_msgTypes[99] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4764,7 +5028,7 @@ type PlanResourceChange_Response struct { func (x *PlanResourceChange_Response) Reset() { *x = PlanResourceChange_Response{} - mi := &file_tfplugin6_proto_msgTypes[94] + mi := &file_tfplugin6_proto_msgTypes[100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4776,7 +5040,7 @@ func (x *PlanResourceChange_Response) String() string { func (*PlanResourceChange_Response) ProtoMessage() {} func (x *PlanResourceChange_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[94] + mi := &file_tfplugin6_proto_msgTypes[100] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4856,7 +5120,7 @@ type ApplyResourceChange_Request struct { func (x *ApplyResourceChange_Request) Reset() { *x = ApplyResourceChange_Request{} - mi := &file_tfplugin6_proto_msgTypes[95] + mi := &file_tfplugin6_proto_msgTypes[101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4868,7 +5132,7 @@ func (x *ApplyResourceChange_Request) String() string { func (*ApplyResourceChange_Request) ProtoMessage() {} func (x *ApplyResourceChange_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[95] + mi := &file_tfplugin6_proto_msgTypes[101] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4957,7 +5221,7 @@ type ApplyResourceChange_Response struct { func (x *ApplyResourceChange_Response) Reset() { *x = ApplyResourceChange_Response{} - mi := &file_tfplugin6_proto_msgTypes[96] + mi := &file_tfplugin6_proto_msgTypes[102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4969,7 +5233,7 @@ func (x *ApplyResourceChange_Response) String() string { func (*ApplyResourceChange_Response) ProtoMessage() {} func (x *ApplyResourceChange_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[96] + mi := &file_tfplugin6_proto_msgTypes[102] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5032,7 +5296,7 @@ type ImportResourceState_Request struct { func (x *ImportResourceState_Request) Reset() { *x = ImportResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[97] + mi := &file_tfplugin6_proto_msgTypes[103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5044,7 +5308,7 @@ func (x *ImportResourceState_Request) String() string { func (*ImportResourceState_Request) ProtoMessage() {} func (x *ImportResourceState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[97] + mi := &file_tfplugin6_proto_msgTypes[103] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5100,7 +5364,7 @@ type ImportResourceState_ImportedResource struct { func (x *ImportResourceState_ImportedResource) Reset() { *x = ImportResourceState_ImportedResource{} - mi := &file_tfplugin6_proto_msgTypes[98] + mi := &file_tfplugin6_proto_msgTypes[104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5112,7 +5376,7 @@ func (x *ImportResourceState_ImportedResource) String() string { func (*ImportResourceState_ImportedResource) ProtoMessage() {} func (x *ImportResourceState_ImportedResource) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[98] + mi := &file_tfplugin6_proto_msgTypes[104] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5169,7 +5433,7 @@ type ImportResourceState_Response struct { func (x *ImportResourceState_Response) Reset() { *x = ImportResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[99] + mi := &file_tfplugin6_proto_msgTypes[105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5181,7 +5445,7 @@ func (x *ImportResourceState_Response) String() string { func (*ImportResourceState_Response) ProtoMessage() {} func (x *ImportResourceState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[99] + mi := &file_tfplugin6_proto_msgTypes[105] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5228,7 +5492,7 @@ type GenerateResourceConfig_Request struct { func (x *GenerateResourceConfig_Request) Reset() { *x = GenerateResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[100] + mi := &file_tfplugin6_proto_msgTypes[106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5240,7 +5504,7 @@ func (x *GenerateResourceConfig_Request) String() string { func (*GenerateResourceConfig_Request) ProtoMessage() {} func (x *GenerateResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[100] + mi := &file_tfplugin6_proto_msgTypes[106] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5281,7 +5545,7 @@ type GenerateResourceConfig_Response struct { func (x *GenerateResourceConfig_Response) Reset() { *x = GenerateResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[101] + mi := &file_tfplugin6_proto_msgTypes[107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5293,7 +5557,7 @@ func (x *GenerateResourceConfig_Response) String() string { func (*GenerateResourceConfig_Response) ProtoMessage() {} func (x *GenerateResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[101] + mi := &file_tfplugin6_proto_msgTypes[107] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5353,7 +5617,7 @@ type MoveResourceState_Request struct { func (x *MoveResourceState_Request) Reset() { *x = MoveResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[102] + mi := &file_tfplugin6_proto_msgTypes[108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5365,7 +5629,7 @@ func (x *MoveResourceState_Request) String() string { func (*MoveResourceState_Request) ProtoMessage() {} func (x *MoveResourceState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[102] + mi := &file_tfplugin6_proto_msgTypes[108] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5452,7 +5716,7 @@ type MoveResourceState_Response struct { func (x *MoveResourceState_Response) Reset() { *x = MoveResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[103] + mi := &file_tfplugin6_proto_msgTypes[109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5464,7 +5728,7 @@ func (x *MoveResourceState_Response) String() string { func (*MoveResourceState_Response) ProtoMessage() {} func (x *MoveResourceState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[103] + mi := &file_tfplugin6_proto_msgTypes[109] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5520,7 +5784,7 @@ type ReadDataSource_Request struct { func (x *ReadDataSource_Request) Reset() { *x = ReadDataSource_Request{} - mi := &file_tfplugin6_proto_msgTypes[104] + mi := &file_tfplugin6_proto_msgTypes[110] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5532,7 +5796,7 @@ func (x *ReadDataSource_Request) String() string { func (*ReadDataSource_Request) ProtoMessage() {} func (x *ReadDataSource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[104] + mi := &file_tfplugin6_proto_msgTypes[110] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5589,7 +5853,7 @@ type ReadDataSource_Response struct { func (x *ReadDataSource_Response) Reset() { *x = ReadDataSource_Response{} - mi := &file_tfplugin6_proto_msgTypes[105] + mi := &file_tfplugin6_proto_msgTypes[111] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5601,7 +5865,7 @@ func (x *ReadDataSource_Response) String() string { func (*ReadDataSource_Response) ProtoMessage() {} func (x *ReadDataSource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[105] + mi := &file_tfplugin6_proto_msgTypes[111] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5649,7 +5913,7 @@ type OpenEphemeralResource_Request struct { func (x *OpenEphemeralResource_Request) Reset() { *x = OpenEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[106] + mi := &file_tfplugin6_proto_msgTypes[112] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5661,7 +5925,7 @@ func (x *OpenEphemeralResource_Request) String() string { func (*OpenEphemeralResource_Request) ProtoMessage() {} func (x *OpenEphemeralResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[106] + mi := &file_tfplugin6_proto_msgTypes[112] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5711,7 +5975,7 @@ type OpenEphemeralResource_Response struct { func (x *OpenEphemeralResource_Response) Reset() { *x = OpenEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[107] + mi := &file_tfplugin6_proto_msgTypes[113] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5723,7 +5987,7 @@ func (x *OpenEphemeralResource_Response) String() string { func (*OpenEphemeralResource_Response) ProtoMessage() {} func (x *OpenEphemeralResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[107] + mi := &file_tfplugin6_proto_msgTypes[113] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5784,7 +6048,7 @@ type RenewEphemeralResource_Request struct { func (x *RenewEphemeralResource_Request) Reset() { *x = RenewEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[108] + mi := &file_tfplugin6_proto_msgTypes[114] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5796,7 +6060,7 @@ func (x *RenewEphemeralResource_Request) String() string { func (*RenewEphemeralResource_Request) ProtoMessage() {} func (x *RenewEphemeralResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[108] + mi := &file_tfplugin6_proto_msgTypes[114] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5837,7 +6101,7 @@ type RenewEphemeralResource_Response struct { func (x *RenewEphemeralResource_Response) Reset() { *x = RenewEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[109] + mi := &file_tfplugin6_proto_msgTypes[115] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5849,7 +6113,7 @@ func (x *RenewEphemeralResource_Response) String() string { func (*RenewEphemeralResource_Response) ProtoMessage() {} func (x *RenewEphemeralResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[109] + mi := &file_tfplugin6_proto_msgTypes[115] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5896,7 +6160,7 @@ type CloseEphemeralResource_Request struct { func (x *CloseEphemeralResource_Request) Reset() { *x = CloseEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[110] + mi := &file_tfplugin6_proto_msgTypes[116] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5908,7 +6172,7 @@ func (x *CloseEphemeralResource_Request) String() string { func (*CloseEphemeralResource_Request) ProtoMessage() {} func (x *CloseEphemeralResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[110] + mi := &file_tfplugin6_proto_msgTypes[116] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5947,7 +6211,7 @@ type CloseEphemeralResource_Response struct { func (x *CloseEphemeralResource_Response) Reset() { *x = CloseEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[111] + mi := &file_tfplugin6_proto_msgTypes[117] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5959,7 +6223,7 @@ func (x *CloseEphemeralResource_Response) String() string { func (*CloseEphemeralResource_Response) ProtoMessage() {} func (x *CloseEphemeralResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[111] + mi := &file_tfplugin6_proto_msgTypes[117] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5990,7 +6254,7 @@ type GetFunctions_Request struct { func (x *GetFunctions_Request) Reset() { *x = GetFunctions_Request{} - mi := &file_tfplugin6_proto_msgTypes[112] + mi := &file_tfplugin6_proto_msgTypes[118] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6002,7 +6266,7 @@ func (x *GetFunctions_Request) String() string { func (*GetFunctions_Request) ProtoMessage() {} func (x *GetFunctions_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[112] + mi := &file_tfplugin6_proto_msgTypes[118] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6030,7 +6294,7 @@ type GetFunctions_Response struct { func (x *GetFunctions_Response) Reset() { *x = GetFunctions_Response{} - mi := &file_tfplugin6_proto_msgTypes[113] + mi := &file_tfplugin6_proto_msgTypes[119] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6042,7 +6306,7 @@ func (x *GetFunctions_Response) String() string { func (*GetFunctions_Response) ProtoMessage() {} func (x *GetFunctions_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[113] + mi := &file_tfplugin6_proto_msgTypes[119] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6082,7 +6346,7 @@ type CallFunction_Request struct { func (x *CallFunction_Request) Reset() { *x = CallFunction_Request{} - mi := &file_tfplugin6_proto_msgTypes[115] + mi := &file_tfplugin6_proto_msgTypes[121] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6094,7 +6358,7 @@ func (x *CallFunction_Request) String() string { func (*CallFunction_Request) ProtoMessage() {} func (x *CallFunction_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[115] + mi := &file_tfplugin6_proto_msgTypes[121] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6134,7 +6398,7 @@ type CallFunction_Response struct { func (x *CallFunction_Response) Reset() { *x = CallFunction_Response{} - mi := &file_tfplugin6_proto_msgTypes[116] + mi := &file_tfplugin6_proto_msgTypes[122] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6146,7 +6410,7 @@ func (x *CallFunction_Response) String() string { func (*CallFunction_Response) ProtoMessage() {} func (x *CallFunction_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[116] + mi := &file_tfplugin6_proto_msgTypes[122] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6194,7 +6458,7 @@ type ListResource_Request struct { func (x *ListResource_Request) Reset() { *x = ListResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[117] + mi := &file_tfplugin6_proto_msgTypes[123] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6206,7 +6470,7 @@ func (x *ListResource_Request) String() string { func (*ListResource_Request) ProtoMessage() {} func (x *ListResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[117] + mi := &file_tfplugin6_proto_msgTypes[123] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6266,7 +6530,7 @@ type ListResource_Event struct { func (x *ListResource_Event) Reset() { *x = ListResource_Event{} - mi := &file_tfplugin6_proto_msgTypes[118] + mi := &file_tfplugin6_proto_msgTypes[124] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6278,7 +6542,7 @@ func (x *ListResource_Event) String() string { func (*ListResource_Event) ProtoMessage() {} func (x *ListResource_Event) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[118] + mi := &file_tfplugin6_proto_msgTypes[124] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6334,7 +6598,7 @@ type ValidateListResourceConfig_Request struct { func (x *ValidateListResourceConfig_Request) Reset() { *x = ValidateListResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[119] + mi := &file_tfplugin6_proto_msgTypes[125] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6346,7 +6610,7 @@ func (x *ValidateListResourceConfig_Request) String() string { func (*ValidateListResourceConfig_Request) ProtoMessage() {} func (x *ValidateListResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[119] + mi := &file_tfplugin6_proto_msgTypes[125] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6390,28 +6654,229 @@ func (x *ValidateListResourceConfig_Request) GetLimit() *DynamicValue { return nil } -type ValidateListResourceConfig_Response struct { - state protoimpl.MessageState `protogen:"open.v1"` - Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` +type ValidateListResourceConfig_Response struct { + state protoimpl.MessageState `protogen:"open.v1"` + Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValidateListResourceConfig_Response) Reset() { + *x = ValidateListResourceConfig_Response{} + mi := &file_tfplugin6_proto_msgTypes[126] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValidateListResourceConfig_Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateListResourceConfig_Response) ProtoMessage() {} + +func (x *ValidateListResourceConfig_Response) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[126] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidateListResourceConfig_Response.ProtoReflect.Descriptor instead. +func (*ValidateListResourceConfig_Response) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{37, 1} +} + +func (x *ValidateListResourceConfig_Response) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +type ValidateStateStore_Request struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + Config *DynamicValue `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValidateStateStore_Request) Reset() { + *x = ValidateStateStore_Request{} + mi := &file_tfplugin6_proto_msgTypes[127] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValidateStateStore_Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateStateStore_Request) ProtoMessage() {} + +func (x *ValidateStateStore_Request) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[127] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidateStateStore_Request.ProtoReflect.Descriptor instead. +func (*ValidateStateStore_Request) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{38, 0} +} + +func (x *ValidateStateStore_Request) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *ValidateStateStore_Request) GetConfig() *DynamicValue { + if x != nil { + return x.Config + } + return nil +} + +type ValidateStateStore_Response struct { + state protoimpl.MessageState `protogen:"open.v1"` + Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValidateStateStore_Response) Reset() { + *x = ValidateStateStore_Response{} + mi := &file_tfplugin6_proto_msgTypes[128] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValidateStateStore_Response) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValidateStateStore_Response) ProtoMessage() {} + +func (x *ValidateStateStore_Response) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[128] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValidateStateStore_Response.ProtoReflect.Descriptor instead. +func (*ValidateStateStore_Response) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{38, 1} +} + +func (x *ValidateStateStore_Response) GetDiagnostics() []*Diagnostic { + if x != nil { + return x.Diagnostics + } + return nil +} + +type ConfigureStateStore_Request struct { + state protoimpl.MessageState `protogen:"open.v1"` + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + Config *DynamicValue `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + Capabilities *StateStoreClientCapabilities `protobuf:"bytes,3,opt,name=capabilities,proto3" json:"capabilities,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConfigureStateStore_Request) Reset() { + *x = ConfigureStateStore_Request{} + mi := &file_tfplugin6_proto_msgTypes[129] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConfigureStateStore_Request) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConfigureStateStore_Request) ProtoMessage() {} + +func (x *ConfigureStateStore_Request) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[129] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConfigureStateStore_Request.ProtoReflect.Descriptor instead. +func (*ConfigureStateStore_Request) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{39, 0} +} + +func (x *ConfigureStateStore_Request) GetTypeName() string { + if x != nil { + return x.TypeName + } + return "" +} + +func (x *ConfigureStateStore_Request) GetConfig() *DynamicValue { + if x != nil { + return x.Config + } + return nil +} + +func (x *ConfigureStateStore_Request) GetCapabilities() *StateStoreClientCapabilities { + if x != nil { + return x.Capabilities + } + return nil +} + +type ConfigureStateStore_Response struct { + state protoimpl.MessageState `protogen:"open.v1"` + Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + Capabilities *StateStoreServerCapabilities `protobuf:"bytes,2,opt,name=capabilities,proto3" json:"capabilities,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ValidateListResourceConfig_Response) Reset() { - *x = ValidateListResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[120] +func (x *ConfigureStateStore_Response) Reset() { + *x = ConfigureStateStore_Response{} + mi := &file_tfplugin6_proto_msgTypes[130] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ValidateListResourceConfig_Response) String() string { +func (x *ConfigureStateStore_Response) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ValidateListResourceConfig_Response) ProtoMessage() {} +func (*ConfigureStateStore_Response) ProtoMessage() {} -func (x *ValidateListResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[120] +func (x *ConfigureStateStore_Response) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[130] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6422,41 +6887,48 @@ func (x *ValidateListResourceConfig_Response) ProtoReflect() protoreflect.Messag return mi.MessageOf(x) } -// Deprecated: Use ValidateListResourceConfig_Response.ProtoReflect.Descriptor instead. -func (*ValidateListResourceConfig_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{37, 1} +// Deprecated: Use ConfigureStateStore_Response.ProtoReflect.Descriptor instead. +func (*ConfigureStateStore_Response) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{39, 1} } -func (x *ValidateListResourceConfig_Response) GetDiagnostics() []*Diagnostic { +func (x *ConfigureStateStore_Response) GetDiagnostics() []*Diagnostic { if x != nil { return x.Diagnostics } return nil } -type ValidateStateStore_Request struct { +func (x *ConfigureStateStore_Response) GetCapabilities() *StateStoreServerCapabilities { + if x != nil { + return x.Capabilities + } + return nil +} + +type ReadStateBytes_Request struct { state protoimpl.MessageState `protogen:"open.v1"` TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - Config *DynamicValue `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + StateId string `protobuf:"bytes,2,opt,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ValidateStateStore_Request) Reset() { - *x = ValidateStateStore_Request{} - mi := &file_tfplugin6_proto_msgTypes[121] +func (x *ReadStateBytes_Request) Reset() { + *x = ReadStateBytes_Request{} + mi := &file_tfplugin6_proto_msgTypes[131] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ValidateStateStore_Request) String() string { +func (x *ReadStateBytes_Request) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ValidateStateStore_Request) ProtoMessage() {} +func (*ReadStateBytes_Request) ProtoMessage() {} -func (x *ValidateStateStore_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[121] +func (x *ReadStateBytes_Request) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[131] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6467,47 +6939,50 @@ func (x *ValidateStateStore_Request) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ValidateStateStore_Request.ProtoReflect.Descriptor instead. -func (*ValidateStateStore_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{38, 0} +// Deprecated: Use ReadStateBytes_Request.ProtoReflect.Descriptor instead. +func (*ReadStateBytes_Request) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{42, 0} } -func (x *ValidateStateStore_Request) GetTypeName() string { +func (x *ReadStateBytes_Request) GetTypeName() string { if x != nil { return x.TypeName } return "" } -func (x *ValidateStateStore_Request) GetConfig() *DynamicValue { +func (x *ReadStateBytes_Request) GetStateId() string { if x != nil { - return x.Config + return x.StateId } - return nil + return "" } -type ValidateStateStore_Response struct { +type ReadStateBytes_Response struct { state protoimpl.MessageState `protogen:"open.v1"` - Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` + TotalLength int64 `protobuf:"varint,2,opt,name=total_length,json=totalLength,proto3" json:"total_length,omitempty"` + Range *StateRange `protobuf:"bytes,3,opt,name=range,proto3" json:"range,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,4,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ValidateStateStore_Response) Reset() { - *x = ValidateStateStore_Response{} - mi := &file_tfplugin6_proto_msgTypes[122] +func (x *ReadStateBytes_Response) Reset() { + *x = ReadStateBytes_Response{} + mi := &file_tfplugin6_proto_msgTypes[132] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ValidateStateStore_Response) String() string { +func (x *ReadStateBytes_Response) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ValidateStateStore_Response) ProtoMessage() {} +func (*ReadStateBytes_Response) ProtoMessage() {} -func (x *ValidateStateStore_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[122] +func (x *ReadStateBytes_Response) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[132] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6518,41 +6993,65 @@ func (x *ValidateStateStore_Response) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ValidateStateStore_Response.ProtoReflect.Descriptor instead. -func (*ValidateStateStore_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{38, 1} +// Deprecated: Use ReadStateBytes_Response.ProtoReflect.Descriptor instead. +func (*ReadStateBytes_Response) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{42, 1} } -func (x *ValidateStateStore_Response) GetDiagnostics() []*Diagnostic { +func (x *ReadStateBytes_Response) GetBytes() []byte { + if x != nil { + return x.Bytes + } + return nil +} + +func (x *ReadStateBytes_Response) GetTotalLength() int64 { + if x != nil { + return x.TotalLength + } + return 0 +} + +func (x *ReadStateBytes_Response) GetRange() *StateRange { + if x != nil { + return x.Range + } + return nil +} + +func (x *ReadStateBytes_Response) GetDiagnostics() []*Diagnostic { if x != nil { return x.Diagnostics } return nil } -type ConfigureStateStore_Request struct { - state protoimpl.MessageState `protogen:"open.v1"` - TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - Config *DynamicValue `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` +type WriteStateBytes_RequestChunk struct { + state protoimpl.MessageState `protogen:"open.v1"` + // meta is sent with the first chunk only + Meta *RequestChunkMeta `protobuf:"bytes,1,opt,name=meta,proto3,oneof" json:"meta,omitempty"` + Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` + TotalLength int64 `protobuf:"varint,3,opt,name=total_length,json=totalLength,proto3" json:"total_length,omitempty"` + Range *StateRange `protobuf:"bytes,4,opt,name=range,proto3" json:"range,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ConfigureStateStore_Request) Reset() { - *x = ConfigureStateStore_Request{} - mi := &file_tfplugin6_proto_msgTypes[123] +func (x *WriteStateBytes_RequestChunk) Reset() { + *x = WriteStateBytes_RequestChunk{} + mi := &file_tfplugin6_proto_msgTypes[133] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ConfigureStateStore_Request) String() string { +func (x *WriteStateBytes_RequestChunk) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ConfigureStateStore_Request) ProtoMessage() {} +func (*WriteStateBytes_RequestChunk) ProtoMessage() {} -func (x *ConfigureStateStore_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[123] +func (x *WriteStateBytes_RequestChunk) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[133] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6563,47 +7062,61 @@ func (x *ConfigureStateStore_Request) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ConfigureStateStore_Request.ProtoReflect.Descriptor instead. -func (*ConfigureStateStore_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{39, 0} +// Deprecated: Use WriteStateBytes_RequestChunk.ProtoReflect.Descriptor instead. +func (*WriteStateBytes_RequestChunk) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{43, 0} } -func (x *ConfigureStateStore_Request) GetTypeName() string { +func (x *WriteStateBytes_RequestChunk) GetMeta() *RequestChunkMeta { if x != nil { - return x.TypeName + return x.Meta } - return "" + return nil } -func (x *ConfigureStateStore_Request) GetConfig() *DynamicValue { +func (x *WriteStateBytes_RequestChunk) GetBytes() []byte { if x != nil { - return x.Config + return x.Bytes } return nil } -type ConfigureStateStore_Response struct { +func (x *WriteStateBytes_RequestChunk) GetTotalLength() int64 { + if x != nil { + return x.TotalLength + } + return 0 +} + +func (x *WriteStateBytes_RequestChunk) GetRange() *StateRange { + if x != nil { + return x.Range + } + return nil +} + +type WriteStateBytes_Response struct { state protoimpl.MessageState `protogen:"open.v1"` Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ConfigureStateStore_Response) Reset() { - *x = ConfigureStateStore_Response{} - mi := &file_tfplugin6_proto_msgTypes[124] +func (x *WriteStateBytes_Response) Reset() { + *x = WriteStateBytes_Response{} + mi := &file_tfplugin6_proto_msgTypes[134] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ConfigureStateStore_Response) String() string { +func (x *WriteStateBytes_Response) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ConfigureStateStore_Response) ProtoMessage() {} +func (*WriteStateBytes_Response) ProtoMessage() {} -func (x *ConfigureStateStore_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[124] +func (x *WriteStateBytes_Response) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[134] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6614,12 +7127,12 @@ func (x *ConfigureStateStore_Response) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ConfigureStateStore_Response.ProtoReflect.Descriptor instead. -func (*ConfigureStateStore_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{39, 1} +// Deprecated: Use WriteStateBytes_Response.ProtoReflect.Descriptor instead. +func (*WriteStateBytes_Response) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1} } -func (x *ConfigureStateStore_Response) GetDiagnostics() []*Diagnostic { +func (x *WriteStateBytes_Response) GetDiagnostics() []*Diagnostic { if x != nil { return x.Diagnostics } @@ -6635,7 +7148,7 @@ type GetStates_Request struct { func (x *GetStates_Request) Reset() { *x = GetStates_Request{} - mi := &file_tfplugin6_proto_msgTypes[125] + mi := &file_tfplugin6_proto_msgTypes[135] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6647,7 +7160,7 @@ func (x *GetStates_Request) String() string { func (*GetStates_Request) ProtoMessage() {} func (x *GetStates_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[125] + mi := &file_tfplugin6_proto_msgTypes[135] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6660,7 +7173,7 @@ func (x *GetStates_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStates_Request.ProtoReflect.Descriptor instead. func (*GetStates_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{40, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{46, 0} } func (x *GetStates_Request) GetTypeName() string { @@ -6680,7 +7193,7 @@ type GetStates_Response struct { func (x *GetStates_Response) Reset() { *x = GetStates_Response{} - mi := &file_tfplugin6_proto_msgTypes[126] + mi := &file_tfplugin6_proto_msgTypes[136] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6692,7 +7205,7 @@ func (x *GetStates_Response) String() string { func (*GetStates_Response) ProtoMessage() {} func (x *GetStates_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[126] + mi := &file_tfplugin6_proto_msgTypes[136] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6705,7 +7218,7 @@ func (x *GetStates_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStates_Response.ProtoReflect.Descriptor instead. func (*GetStates_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{40, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{46, 1} } func (x *GetStates_Response) GetStateId() []string { @@ -6732,7 +7245,7 @@ type DeleteState_Request struct { func (x *DeleteState_Request) Reset() { *x = DeleteState_Request{} - mi := &file_tfplugin6_proto_msgTypes[127] + mi := &file_tfplugin6_proto_msgTypes[137] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6744,7 +7257,7 @@ func (x *DeleteState_Request) String() string { func (*DeleteState_Request) ProtoMessage() {} func (x *DeleteState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[127] + mi := &file_tfplugin6_proto_msgTypes[137] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6757,7 +7270,7 @@ func (x *DeleteState_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteState_Request.ProtoReflect.Descriptor instead. func (*DeleteState_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{41, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{47, 0} } func (x *DeleteState_Request) GetTypeName() string { @@ -6783,7 +7296,7 @@ type DeleteState_Response struct { func (x *DeleteState_Response) Reset() { *x = DeleteState_Response{} - mi := &file_tfplugin6_proto_msgTypes[128] + mi := &file_tfplugin6_proto_msgTypes[138] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6795,7 +7308,7 @@ func (x *DeleteState_Response) String() string { func (*DeleteState_Response) ProtoMessage() {} func (x *DeleteState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[128] + mi := &file_tfplugin6_proto_msgTypes[138] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6808,7 +7321,7 @@ func (x *DeleteState_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteState_Response.ProtoReflect.Descriptor instead. func (*DeleteState_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{41, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{47, 1} } func (x *DeleteState_Response) GetDiagnostics() []*Diagnostic { @@ -6831,7 +7344,7 @@ type PlanAction_Request struct { func (x *PlanAction_Request) Reset() { *x = PlanAction_Request{} - mi := &file_tfplugin6_proto_msgTypes[129] + mi := &file_tfplugin6_proto_msgTypes[139] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6843,7 +7356,7 @@ func (x *PlanAction_Request) String() string { func (*PlanAction_Request) ProtoMessage() {} func (x *PlanAction_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[129] + mi := &file_tfplugin6_proto_msgTypes[139] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6856,7 +7369,7 @@ func (x *PlanAction_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use PlanAction_Request.ProtoReflect.Descriptor instead. func (*PlanAction_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{42, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{48, 0} } func (x *PlanAction_Request) GetActionType() string { @@ -6891,7 +7404,7 @@ type PlanAction_Response struct { func (x *PlanAction_Response) Reset() { *x = PlanAction_Response{} - mi := &file_tfplugin6_proto_msgTypes[130] + mi := &file_tfplugin6_proto_msgTypes[140] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6903,7 +7416,7 @@ func (x *PlanAction_Response) String() string { func (*PlanAction_Response) ProtoMessage() {} func (x *PlanAction_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[130] + mi := &file_tfplugin6_proto_msgTypes[140] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6916,7 +7429,7 @@ func (x *PlanAction_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use PlanAction_Response.ProtoReflect.Descriptor instead. func (*PlanAction_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{42, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{48, 1} } func (x *PlanAction_Response) GetDiagnostics() []*Diagnostic { @@ -6946,7 +7459,7 @@ type InvokeAction_Request struct { func (x *InvokeAction_Request) Reset() { *x = InvokeAction_Request{} - mi := &file_tfplugin6_proto_msgTypes[131] + mi := &file_tfplugin6_proto_msgTypes[141] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6958,7 +7471,7 @@ func (x *InvokeAction_Request) String() string { func (*InvokeAction_Request) ProtoMessage() {} func (x *InvokeAction_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[131] + mi := &file_tfplugin6_proto_msgTypes[141] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6971,7 +7484,7 @@ func (x *InvokeAction_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Request.ProtoReflect.Descriptor instead. func (*InvokeAction_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{49, 0} } func (x *InvokeAction_Request) GetActionType() string { @@ -7008,7 +7521,7 @@ type InvokeAction_Event struct { func (x *InvokeAction_Event) Reset() { *x = InvokeAction_Event{} - mi := &file_tfplugin6_proto_msgTypes[132] + mi := &file_tfplugin6_proto_msgTypes[142] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7020,7 +7533,7 @@ func (x *InvokeAction_Event) String() string { func (*InvokeAction_Event) ProtoMessage() {} func (x *InvokeAction_Event) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[132] + mi := &file_tfplugin6_proto_msgTypes[142] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7033,7 +7546,7 @@ func (x *InvokeAction_Event) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Event.ProtoReflect.Descriptor instead. func (*InvokeAction_Event) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{49, 1} } func (x *InvokeAction_Event) GetType() isInvokeAction_Event_Type { @@ -7087,7 +7600,7 @@ type InvokeAction_Event_Progress struct { func (x *InvokeAction_Event_Progress) Reset() { *x = InvokeAction_Event_Progress{} - mi := &file_tfplugin6_proto_msgTypes[133] + mi := &file_tfplugin6_proto_msgTypes[143] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7099,7 +7612,7 @@ func (x *InvokeAction_Event_Progress) String() string { func (*InvokeAction_Event_Progress) ProtoMessage() {} func (x *InvokeAction_Event_Progress) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[133] + mi := &file_tfplugin6_proto_msgTypes[143] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7112,7 +7625,7 @@ func (x *InvokeAction_Event_Progress) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Event_Progress.ProtoReflect.Descriptor instead. func (*InvokeAction_Event_Progress) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{49, 1, 0} } func (x *InvokeAction_Event_Progress) GetMessage() string { @@ -7131,7 +7644,7 @@ type InvokeAction_Event_Completed struct { func (x *InvokeAction_Event_Completed) Reset() { *x = InvokeAction_Event_Completed{} - mi := &file_tfplugin6_proto_msgTypes[134] + mi := &file_tfplugin6_proto_msgTypes[144] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7143,7 +7656,7 @@ func (x *InvokeAction_Event_Completed) String() string { func (*InvokeAction_Event_Completed) ProtoMessage() {} func (x *InvokeAction_Event_Completed) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[134] + mi := &file_tfplugin6_proto_msgTypes[144] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7156,7 +7669,7 @@ func (x *InvokeAction_Event_Completed) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Event_Completed.ProtoReflect.Descriptor instead. func (*InvokeAction_Event_Completed) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{49, 1, 1} } func (x *InvokeAction_Event_Completed) GetDiagnostics() []*Diagnostic { @@ -7176,7 +7689,7 @@ type ValidateActionConfig_Request struct { func (x *ValidateActionConfig_Request) Reset() { *x = ValidateActionConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[135] + mi := &file_tfplugin6_proto_msgTypes[145] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7188,7 +7701,7 @@ func (x *ValidateActionConfig_Request) String() string { func (*ValidateActionConfig_Request) ProtoMessage() {} func (x *ValidateActionConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[135] + mi := &file_tfplugin6_proto_msgTypes[145] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7201,7 +7714,7 @@ func (x *ValidateActionConfig_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateActionConfig_Request.ProtoReflect.Descriptor instead. func (*ValidateActionConfig_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{44, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{50, 0} } func (x *ValidateActionConfig_Request) GetTypeName() string { @@ -7227,7 +7740,7 @@ type ValidateActionConfig_Response struct { func (x *ValidateActionConfig_Response) Reset() { *x = ValidateActionConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[136] + mi := &file_tfplugin6_proto_msgTypes[146] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7239,7 +7752,7 @@ func (x *ValidateActionConfig_Response) String() string { func (*ValidateActionConfig_Response) ProtoMessage() {} func (x *ValidateActionConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[136] + mi := &file_tfplugin6_proto_msgTypes[146] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7252,7 +7765,7 @@ func (x *ValidateActionConfig_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateActionConfig_Response.ProtoReflect.Descriptor instead. func (*ValidateActionConfig_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{44, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{50, 1} } func (x *ValidateActionConfig_Response) GetDiagnostics() []*Diagnostic { @@ -7700,13 +8213,46 @@ const file_tfplugin6_proto_rawDesc = "" + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12/\n" + "\x06config\x18\x02 \x01(\v2\x17.tfplugin6.DynamicValueR\x06config\x1aC\n" + "\bResponse\x127\n" + - "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\xb3\x01\n" + - "\x13ConfigureStateStore\x1aW\n" + + "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\xcf\x02\n" + + "\x13ConfigureStateStore\x1a\xa4\x01\n" + "\aRequest\x12\x1b\n" + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12/\n" + - "\x06config\x18\x02 \x01(\v2\x17.tfplugin6.DynamicValueR\x06config\x1aC\n" + + "\x06config\x18\x02 \x01(\v2\x17.tfplugin6.DynamicValueR\x06config\x12K\n" + + "\fcapabilities\x18\x03 \x01(\v2'.tfplugin6.StateStoreClientCapabilitiesR\fcapabilities\x1a\x90\x01\n" + + "\bResponse\x127\n" + + "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\x12K\n" + + "\fcapabilities\x18\x02 \x01(\v2'.tfplugin6.StateStoreServerCapabilitiesR\fcapabilities\"=\n" + + "\x1cStateStoreClientCapabilities\x12\x1d\n" + + "\n" + + "chunk_size\x18\x01 \x01(\x03R\tchunkSize\"=\n" + + "\x1cStateStoreServerCapabilities\x12\x1d\n" + + "\n" + + "chunk_size\x18\x01 \x01(\x03R\tchunkSize\"\xff\x01\n" + + "\x0eReadStateBytes\x1aA\n" + + "\aRequest\x12\x1b\n" + + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12\x19\n" + + "\bstate_id\x18\x02 \x01(\tR\astateId\x1a\xa9\x01\n" + + "\bResponse\x12\x14\n" + + "\x05bytes\x18\x01 \x01(\fR\x05bytes\x12!\n" + + "\ftotal_length\x18\x02 \x01(\x03R\vtotalLength\x12+\n" + + "\x05range\x18\x03 \x01(\v2\x15.tfplugin6.StateRangeR\x05range\x127\n" + + "\vdiagnostics\x18\x04 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\x8c\x02\n" + + "\x0fWriteStateBytes\x1a\xb3\x01\n" + + "\fRequestChunk\x124\n" + + "\x04meta\x18\x01 \x01(\v2\x1b.tfplugin6.RequestChunkMetaH\x00R\x04meta\x88\x01\x01\x12\x14\n" + + "\x05bytes\x18\x02 \x01(\fR\x05bytes\x12!\n" + + "\ftotal_length\x18\x03 \x01(\x03R\vtotalLength\x12+\n" + + "\x05range\x18\x04 \x01(\v2\x15.tfplugin6.StateRangeR\x05rangeB\a\n" + + "\x05_meta\x1aC\n" + "\bResponse\x127\n" + - "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\x93\x01\n" + + "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"J\n" + + "\x10RequestChunkMeta\x12\x1b\n" + + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12\x19\n" + + "\bstate_id\x18\x02 \x01(\tR\astateId\"4\n" + + "\n" + + "StateRange\x12\x14\n" + + "\x05start\x18\x01 \x01(\x03R\x05start\x12\x10\n" + + "\x03end\x18\x02 \x01(\x03R\x03end\"\x93\x01\n" + "\tGetStates\x1a&\n" + "\aRequest\x12\x1b\n" + "\ttype_name\x18\x01 \x01(\tR\btypeName\x1a^\n" + @@ -7752,7 +8298,7 @@ const file_tfplugin6_proto_rawDesc = "" + "\n" + "StringKind\x12\t\n" + "\x05PLAIN\x10\x00\x12\f\n" + - "\bMARKDOWN\x10\x012\xa9\x19\n" + + "\bMARKDOWN\x10\x012\xe7\x1a\n" + "\bProvider\x12N\n" + "\vGetMetadata\x12\x1e.tfplugin6.GetMetadata.Request\x1a\x1f.tfplugin6.GetMetadata.Response\x12`\n" + "\x11GetProviderSchema\x12$.tfplugin6.GetProviderSchema.Request\x1a%.tfplugin6.GetProviderSchema.Response\x12o\n" + @@ -7779,7 +8325,9 @@ const file_tfplugin6_proto_rawDesc = "" + "\fGetFunctions\x12\x1f.tfplugin6.GetFunctions.Request\x1a .tfplugin6.GetFunctions.Response\x12Q\n" + "\fCallFunction\x12\x1f.tfplugin6.CallFunction.Request\x1a .tfplugin6.CallFunction.Response\x12i\n" + "\x18ValidateStateStoreConfig\x12%.tfplugin6.ValidateStateStore.Request\x1a&.tfplugin6.ValidateStateStore.Response\x12f\n" + - "\x13ConfigureStateStore\x12&.tfplugin6.ConfigureStateStore.Request\x1a'.tfplugin6.ConfigureStateStore.Response\x12H\n" + + "\x13ConfigureStateStore\x12&.tfplugin6.ConfigureStateStore.Request\x1a'.tfplugin6.ConfigureStateStore.Response\x12Y\n" + + "\x0eReadStateBytes\x12!.tfplugin6.ReadStateBytes.Request\x1a\".tfplugin6.ReadStateBytes.Response0\x01\x12a\n" + + "\x0fWriteStateBytes\x12'.tfplugin6.WriteStateBytes.RequestChunk\x1a#.tfplugin6.WriteStateBytes.Response(\x01\x12H\n" + "\tGetStates\x12\x1c.tfplugin6.GetStates.Request\x1a\x1d.tfplugin6.GetStates.Response\x12N\n" + "\vDeleteState\x12\x1e.tfplugin6.DeleteState.Request\x1a\x1f.tfplugin6.DeleteState.Response\x12K\n" + "\n" + @@ -7801,7 +8349,7 @@ func file_tfplugin6_proto_rawDescGZIP() []byte { } var file_tfplugin6_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_tfplugin6_proto_msgTypes = make([]protoimpl.MessageInfo, 137) +var file_tfplugin6_proto_msgTypes = make([]protoimpl.MessageInfo, 147) var file_tfplugin6_proto_goTypes = []any{ (StringKind)(0), // 0: tfplugin6.StringKind (Diagnostic_Severity)(0), // 1: tfplugin6.Diagnostic.Severity @@ -7848,146 +8396,156 @@ var file_tfplugin6_proto_goTypes = []any{ (*ValidateListResourceConfig)(nil), // 42: tfplugin6.ValidateListResourceConfig (*ValidateStateStore)(nil), // 43: tfplugin6.ValidateStateStore (*ConfigureStateStore)(nil), // 44: tfplugin6.ConfigureStateStore - (*GetStates)(nil), // 45: tfplugin6.GetStates - (*DeleteState)(nil), // 46: tfplugin6.DeleteState - (*PlanAction)(nil), // 47: tfplugin6.PlanAction - (*InvokeAction)(nil), // 48: tfplugin6.InvokeAction - (*ValidateActionConfig)(nil), // 49: tfplugin6.ValidateActionConfig - (*AttributePath_Step)(nil), // 50: tfplugin6.AttributePath.Step - (*StopProvider_Request)(nil), // 51: tfplugin6.StopProvider.Request - (*StopProvider_Response)(nil), // 52: tfplugin6.StopProvider.Response - nil, // 53: tfplugin6.RawState.FlatmapEntry - (*ResourceIdentitySchema_IdentityAttribute)(nil), // 54: tfplugin6.ResourceIdentitySchema.IdentityAttribute - (*Schema_Block)(nil), // 55: tfplugin6.Schema.Block - (*Schema_Attribute)(nil), // 56: tfplugin6.Schema.Attribute - (*Schema_NestedBlock)(nil), // 57: tfplugin6.Schema.NestedBlock - (*Schema_Object)(nil), // 58: tfplugin6.Schema.Object - (*Function_Parameter)(nil), // 59: tfplugin6.Function.Parameter - (*Function_Return)(nil), // 60: tfplugin6.Function.Return - (*GetMetadata_Request)(nil), // 61: tfplugin6.GetMetadata.Request - (*GetMetadata_Response)(nil), // 62: tfplugin6.GetMetadata.Response - (*GetMetadata_EphemeralMetadata)(nil), // 63: tfplugin6.GetMetadata.EphemeralMetadata - (*GetMetadata_FunctionMetadata)(nil), // 64: tfplugin6.GetMetadata.FunctionMetadata - (*GetMetadata_DataSourceMetadata)(nil), // 65: tfplugin6.GetMetadata.DataSourceMetadata - (*GetMetadata_ResourceMetadata)(nil), // 66: tfplugin6.GetMetadata.ResourceMetadata - (*GetMetadata_ListResourceMetadata)(nil), // 67: tfplugin6.GetMetadata.ListResourceMetadata - (*GetMetadata_StateStoreMetadata)(nil), // 68: tfplugin6.GetMetadata.StateStoreMetadata - (*GetMetadata_ActionMetadata)(nil), // 69: tfplugin6.GetMetadata.ActionMetadata - (*GetProviderSchema_Request)(nil), // 70: tfplugin6.GetProviderSchema.Request - (*GetProviderSchema_Response)(nil), // 71: tfplugin6.GetProviderSchema.Response - nil, // 72: tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry - nil, // 73: tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry - nil, // 74: tfplugin6.GetProviderSchema.Response.FunctionsEntry - nil, // 75: tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry - nil, // 76: tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry - nil, // 77: tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry - nil, // 78: tfplugin6.GetProviderSchema.Response.ActionSchemasEntry - (*ValidateProviderConfig_Request)(nil), // 79: tfplugin6.ValidateProviderConfig.Request - (*ValidateProviderConfig_Response)(nil), // 80: tfplugin6.ValidateProviderConfig.Response - (*UpgradeResourceState_Request)(nil), // 81: tfplugin6.UpgradeResourceState.Request - (*UpgradeResourceState_Response)(nil), // 82: tfplugin6.UpgradeResourceState.Response - (*GetResourceIdentitySchemas_Request)(nil), // 83: tfplugin6.GetResourceIdentitySchemas.Request - (*GetResourceIdentitySchemas_Response)(nil), // 84: tfplugin6.GetResourceIdentitySchemas.Response - nil, // 85: tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry - (*UpgradeResourceIdentity_Request)(nil), // 86: tfplugin6.UpgradeResourceIdentity.Request - (*UpgradeResourceIdentity_Response)(nil), // 87: tfplugin6.UpgradeResourceIdentity.Response - (*ValidateResourceConfig_Request)(nil), // 88: tfplugin6.ValidateResourceConfig.Request - (*ValidateResourceConfig_Response)(nil), // 89: tfplugin6.ValidateResourceConfig.Response - (*ValidateDataResourceConfig_Request)(nil), // 90: tfplugin6.ValidateDataResourceConfig.Request - (*ValidateDataResourceConfig_Response)(nil), // 91: tfplugin6.ValidateDataResourceConfig.Response - (*ValidateEphemeralResourceConfig_Request)(nil), // 92: tfplugin6.ValidateEphemeralResourceConfig.Request - (*ValidateEphemeralResourceConfig_Response)(nil), // 93: tfplugin6.ValidateEphemeralResourceConfig.Response - (*ConfigureProvider_Request)(nil), // 94: tfplugin6.ConfigureProvider.Request - (*ConfigureProvider_Response)(nil), // 95: tfplugin6.ConfigureProvider.Response - (*ReadResource_Request)(nil), // 96: tfplugin6.ReadResource.Request - (*ReadResource_Response)(nil), // 97: tfplugin6.ReadResource.Response - (*PlanResourceChange_Request)(nil), // 98: tfplugin6.PlanResourceChange.Request - (*PlanResourceChange_Response)(nil), // 99: tfplugin6.PlanResourceChange.Response - (*ApplyResourceChange_Request)(nil), // 100: tfplugin6.ApplyResourceChange.Request - (*ApplyResourceChange_Response)(nil), // 101: tfplugin6.ApplyResourceChange.Response - (*ImportResourceState_Request)(nil), // 102: tfplugin6.ImportResourceState.Request - (*ImportResourceState_ImportedResource)(nil), // 103: tfplugin6.ImportResourceState.ImportedResource - (*ImportResourceState_Response)(nil), // 104: tfplugin6.ImportResourceState.Response - (*GenerateResourceConfig_Request)(nil), // 105: tfplugin6.GenerateResourceConfig.Request - (*GenerateResourceConfig_Response)(nil), // 106: tfplugin6.GenerateResourceConfig.Response - (*MoveResourceState_Request)(nil), // 107: tfplugin6.MoveResourceState.Request - (*MoveResourceState_Response)(nil), // 108: tfplugin6.MoveResourceState.Response - (*ReadDataSource_Request)(nil), // 109: tfplugin6.ReadDataSource.Request - (*ReadDataSource_Response)(nil), // 110: tfplugin6.ReadDataSource.Response - (*OpenEphemeralResource_Request)(nil), // 111: tfplugin6.OpenEphemeralResource.Request - (*OpenEphemeralResource_Response)(nil), // 112: tfplugin6.OpenEphemeralResource.Response - (*RenewEphemeralResource_Request)(nil), // 113: tfplugin6.RenewEphemeralResource.Request - (*RenewEphemeralResource_Response)(nil), // 114: tfplugin6.RenewEphemeralResource.Response - (*CloseEphemeralResource_Request)(nil), // 115: tfplugin6.CloseEphemeralResource.Request - (*CloseEphemeralResource_Response)(nil), // 116: tfplugin6.CloseEphemeralResource.Response - (*GetFunctions_Request)(nil), // 117: tfplugin6.GetFunctions.Request - (*GetFunctions_Response)(nil), // 118: tfplugin6.GetFunctions.Response - nil, // 119: tfplugin6.GetFunctions.Response.FunctionsEntry - (*CallFunction_Request)(nil), // 120: tfplugin6.CallFunction.Request - (*CallFunction_Response)(nil), // 121: tfplugin6.CallFunction.Response - (*ListResource_Request)(nil), // 122: tfplugin6.ListResource.Request - (*ListResource_Event)(nil), // 123: tfplugin6.ListResource.Event - (*ValidateListResourceConfig_Request)(nil), // 124: tfplugin6.ValidateListResourceConfig.Request - (*ValidateListResourceConfig_Response)(nil), // 125: tfplugin6.ValidateListResourceConfig.Response - (*ValidateStateStore_Request)(nil), // 126: tfplugin6.ValidateStateStore.Request - (*ValidateStateStore_Response)(nil), // 127: tfplugin6.ValidateStateStore.Response - (*ConfigureStateStore_Request)(nil), // 128: tfplugin6.ConfigureStateStore.Request - (*ConfigureStateStore_Response)(nil), // 129: tfplugin6.ConfigureStateStore.Response - (*GetStates_Request)(nil), // 130: tfplugin6.GetStates.Request - (*GetStates_Response)(nil), // 131: tfplugin6.GetStates.Response - (*DeleteState_Request)(nil), // 132: tfplugin6.DeleteState.Request - (*DeleteState_Response)(nil), // 133: tfplugin6.DeleteState.Response - (*PlanAction_Request)(nil), // 134: tfplugin6.PlanAction.Request - (*PlanAction_Response)(nil), // 135: tfplugin6.PlanAction.Response - (*InvokeAction_Request)(nil), // 136: tfplugin6.InvokeAction.Request - (*InvokeAction_Event)(nil), // 137: tfplugin6.InvokeAction.Event - (*InvokeAction_Event_Progress)(nil), // 138: tfplugin6.InvokeAction.Event.Progress - (*InvokeAction_Event_Completed)(nil), // 139: tfplugin6.InvokeAction.Event.Completed - (*ValidateActionConfig_Request)(nil), // 140: tfplugin6.ValidateActionConfig.Request - (*ValidateActionConfig_Response)(nil), // 141: tfplugin6.ValidateActionConfig.Response - (*timestamppb.Timestamp)(nil), // 142: google.protobuf.Timestamp + (*StateStoreClientCapabilities)(nil), // 45: tfplugin6.StateStoreClientCapabilities + (*StateStoreServerCapabilities)(nil), // 46: tfplugin6.StateStoreServerCapabilities + (*ReadStateBytes)(nil), // 47: tfplugin6.ReadStateBytes + (*WriteStateBytes)(nil), // 48: tfplugin6.WriteStateBytes + (*RequestChunkMeta)(nil), // 49: tfplugin6.RequestChunkMeta + (*StateRange)(nil), // 50: tfplugin6.StateRange + (*GetStates)(nil), // 51: tfplugin6.GetStates + (*DeleteState)(nil), // 52: tfplugin6.DeleteState + (*PlanAction)(nil), // 53: tfplugin6.PlanAction + (*InvokeAction)(nil), // 54: tfplugin6.InvokeAction + (*ValidateActionConfig)(nil), // 55: tfplugin6.ValidateActionConfig + (*AttributePath_Step)(nil), // 56: tfplugin6.AttributePath.Step + (*StopProvider_Request)(nil), // 57: tfplugin6.StopProvider.Request + (*StopProvider_Response)(nil), // 58: tfplugin6.StopProvider.Response + nil, // 59: tfplugin6.RawState.FlatmapEntry + (*ResourceIdentitySchema_IdentityAttribute)(nil), // 60: tfplugin6.ResourceIdentitySchema.IdentityAttribute + (*Schema_Block)(nil), // 61: tfplugin6.Schema.Block + (*Schema_Attribute)(nil), // 62: tfplugin6.Schema.Attribute + (*Schema_NestedBlock)(nil), // 63: tfplugin6.Schema.NestedBlock + (*Schema_Object)(nil), // 64: tfplugin6.Schema.Object + (*Function_Parameter)(nil), // 65: tfplugin6.Function.Parameter + (*Function_Return)(nil), // 66: tfplugin6.Function.Return + (*GetMetadata_Request)(nil), // 67: tfplugin6.GetMetadata.Request + (*GetMetadata_Response)(nil), // 68: tfplugin6.GetMetadata.Response + (*GetMetadata_EphemeralMetadata)(nil), // 69: tfplugin6.GetMetadata.EphemeralMetadata + (*GetMetadata_FunctionMetadata)(nil), // 70: tfplugin6.GetMetadata.FunctionMetadata + (*GetMetadata_DataSourceMetadata)(nil), // 71: tfplugin6.GetMetadata.DataSourceMetadata + (*GetMetadata_ResourceMetadata)(nil), // 72: tfplugin6.GetMetadata.ResourceMetadata + (*GetMetadata_ListResourceMetadata)(nil), // 73: tfplugin6.GetMetadata.ListResourceMetadata + (*GetMetadata_StateStoreMetadata)(nil), // 74: tfplugin6.GetMetadata.StateStoreMetadata + (*GetMetadata_ActionMetadata)(nil), // 75: tfplugin6.GetMetadata.ActionMetadata + (*GetProviderSchema_Request)(nil), // 76: tfplugin6.GetProviderSchema.Request + (*GetProviderSchema_Response)(nil), // 77: tfplugin6.GetProviderSchema.Response + nil, // 78: tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry + nil, // 79: tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry + nil, // 80: tfplugin6.GetProviderSchema.Response.FunctionsEntry + nil, // 81: tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry + nil, // 82: tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry + nil, // 83: tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry + nil, // 84: tfplugin6.GetProviderSchema.Response.ActionSchemasEntry + (*ValidateProviderConfig_Request)(nil), // 85: tfplugin6.ValidateProviderConfig.Request + (*ValidateProviderConfig_Response)(nil), // 86: tfplugin6.ValidateProviderConfig.Response + (*UpgradeResourceState_Request)(nil), // 87: tfplugin6.UpgradeResourceState.Request + (*UpgradeResourceState_Response)(nil), // 88: tfplugin6.UpgradeResourceState.Response + (*GetResourceIdentitySchemas_Request)(nil), // 89: tfplugin6.GetResourceIdentitySchemas.Request + (*GetResourceIdentitySchemas_Response)(nil), // 90: tfplugin6.GetResourceIdentitySchemas.Response + nil, // 91: tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry + (*UpgradeResourceIdentity_Request)(nil), // 92: tfplugin6.UpgradeResourceIdentity.Request + (*UpgradeResourceIdentity_Response)(nil), // 93: tfplugin6.UpgradeResourceIdentity.Response + (*ValidateResourceConfig_Request)(nil), // 94: tfplugin6.ValidateResourceConfig.Request + (*ValidateResourceConfig_Response)(nil), // 95: tfplugin6.ValidateResourceConfig.Response + (*ValidateDataResourceConfig_Request)(nil), // 96: tfplugin6.ValidateDataResourceConfig.Request + (*ValidateDataResourceConfig_Response)(nil), // 97: tfplugin6.ValidateDataResourceConfig.Response + (*ValidateEphemeralResourceConfig_Request)(nil), // 98: tfplugin6.ValidateEphemeralResourceConfig.Request + (*ValidateEphemeralResourceConfig_Response)(nil), // 99: tfplugin6.ValidateEphemeralResourceConfig.Response + (*ConfigureProvider_Request)(nil), // 100: tfplugin6.ConfigureProvider.Request + (*ConfigureProvider_Response)(nil), // 101: tfplugin6.ConfigureProvider.Response + (*ReadResource_Request)(nil), // 102: tfplugin6.ReadResource.Request + (*ReadResource_Response)(nil), // 103: tfplugin6.ReadResource.Response + (*PlanResourceChange_Request)(nil), // 104: tfplugin6.PlanResourceChange.Request + (*PlanResourceChange_Response)(nil), // 105: tfplugin6.PlanResourceChange.Response + (*ApplyResourceChange_Request)(nil), // 106: tfplugin6.ApplyResourceChange.Request + (*ApplyResourceChange_Response)(nil), // 107: tfplugin6.ApplyResourceChange.Response + (*ImportResourceState_Request)(nil), // 108: tfplugin6.ImportResourceState.Request + (*ImportResourceState_ImportedResource)(nil), // 109: tfplugin6.ImportResourceState.ImportedResource + (*ImportResourceState_Response)(nil), // 110: tfplugin6.ImportResourceState.Response + (*GenerateResourceConfig_Request)(nil), // 111: tfplugin6.GenerateResourceConfig.Request + (*GenerateResourceConfig_Response)(nil), // 112: tfplugin6.GenerateResourceConfig.Response + (*MoveResourceState_Request)(nil), // 113: tfplugin6.MoveResourceState.Request + (*MoveResourceState_Response)(nil), // 114: tfplugin6.MoveResourceState.Response + (*ReadDataSource_Request)(nil), // 115: tfplugin6.ReadDataSource.Request + (*ReadDataSource_Response)(nil), // 116: tfplugin6.ReadDataSource.Response + (*OpenEphemeralResource_Request)(nil), // 117: tfplugin6.OpenEphemeralResource.Request + (*OpenEphemeralResource_Response)(nil), // 118: tfplugin6.OpenEphemeralResource.Response + (*RenewEphemeralResource_Request)(nil), // 119: tfplugin6.RenewEphemeralResource.Request + (*RenewEphemeralResource_Response)(nil), // 120: tfplugin6.RenewEphemeralResource.Response + (*CloseEphemeralResource_Request)(nil), // 121: tfplugin6.CloseEphemeralResource.Request + (*CloseEphemeralResource_Response)(nil), // 122: tfplugin6.CloseEphemeralResource.Response + (*GetFunctions_Request)(nil), // 123: tfplugin6.GetFunctions.Request + (*GetFunctions_Response)(nil), // 124: tfplugin6.GetFunctions.Response + nil, // 125: tfplugin6.GetFunctions.Response.FunctionsEntry + (*CallFunction_Request)(nil), // 126: tfplugin6.CallFunction.Request + (*CallFunction_Response)(nil), // 127: tfplugin6.CallFunction.Response + (*ListResource_Request)(nil), // 128: tfplugin6.ListResource.Request + (*ListResource_Event)(nil), // 129: tfplugin6.ListResource.Event + (*ValidateListResourceConfig_Request)(nil), // 130: tfplugin6.ValidateListResourceConfig.Request + (*ValidateListResourceConfig_Response)(nil), // 131: tfplugin6.ValidateListResourceConfig.Response + (*ValidateStateStore_Request)(nil), // 132: tfplugin6.ValidateStateStore.Request + (*ValidateStateStore_Response)(nil), // 133: tfplugin6.ValidateStateStore.Response + (*ConfigureStateStore_Request)(nil), // 134: tfplugin6.ConfigureStateStore.Request + (*ConfigureStateStore_Response)(nil), // 135: tfplugin6.ConfigureStateStore.Response + (*ReadStateBytes_Request)(nil), // 136: tfplugin6.ReadStateBytes.Request + (*ReadStateBytes_Response)(nil), // 137: tfplugin6.ReadStateBytes.Response + (*WriteStateBytes_RequestChunk)(nil), // 138: tfplugin6.WriteStateBytes.RequestChunk + (*WriteStateBytes_Response)(nil), // 139: tfplugin6.WriteStateBytes.Response + (*GetStates_Request)(nil), // 140: tfplugin6.GetStates.Request + (*GetStates_Response)(nil), // 141: tfplugin6.GetStates.Response + (*DeleteState_Request)(nil), // 142: tfplugin6.DeleteState.Request + (*DeleteState_Response)(nil), // 143: tfplugin6.DeleteState.Response + (*PlanAction_Request)(nil), // 144: tfplugin6.PlanAction.Request + (*PlanAction_Response)(nil), // 145: tfplugin6.PlanAction.Response + (*InvokeAction_Request)(nil), // 146: tfplugin6.InvokeAction.Request + (*InvokeAction_Event)(nil), // 147: tfplugin6.InvokeAction.Event + (*InvokeAction_Event_Progress)(nil), // 148: tfplugin6.InvokeAction.Event.Progress + (*InvokeAction_Event_Completed)(nil), // 149: tfplugin6.InvokeAction.Event.Completed + (*ValidateActionConfig_Request)(nil), // 150: tfplugin6.ValidateActionConfig.Request + (*ValidateActionConfig_Response)(nil), // 151: tfplugin6.ValidateActionConfig.Response + (*timestamppb.Timestamp)(nil), // 152: google.protobuf.Timestamp } var file_tfplugin6_proto_depIdxs = []int32{ 1, // 0: tfplugin6.Diagnostic.severity:type_name -> tfplugin6.Diagnostic.Severity 8, // 1: tfplugin6.Diagnostic.attribute:type_name -> tfplugin6.AttributePath - 50, // 2: tfplugin6.AttributePath.steps:type_name -> tfplugin6.AttributePath.Step - 53, // 3: tfplugin6.RawState.flatmap:type_name -> tfplugin6.RawState.FlatmapEntry - 54, // 4: tfplugin6.ResourceIdentitySchema.identity_attributes:type_name -> tfplugin6.ResourceIdentitySchema.IdentityAttribute + 56, // 2: tfplugin6.AttributePath.steps:type_name -> tfplugin6.AttributePath.Step + 59, // 3: tfplugin6.RawState.flatmap:type_name -> tfplugin6.RawState.FlatmapEntry + 60, // 4: tfplugin6.ResourceIdentitySchema.identity_attributes:type_name -> tfplugin6.ResourceIdentitySchema.IdentityAttribute 5, // 5: tfplugin6.ResourceIdentityData.identity_data:type_name -> tfplugin6.DynamicValue 14, // 6: tfplugin6.ActionSchema.schema:type_name -> tfplugin6.Schema - 55, // 7: tfplugin6.Schema.block:type_name -> tfplugin6.Schema.Block - 59, // 8: tfplugin6.Function.parameters:type_name -> tfplugin6.Function.Parameter - 59, // 9: tfplugin6.Function.variadic_parameter:type_name -> tfplugin6.Function.Parameter - 60, // 10: tfplugin6.Function.return:type_name -> tfplugin6.Function.Return + 61, // 7: tfplugin6.Schema.block:type_name -> tfplugin6.Schema.Block + 65, // 8: tfplugin6.Function.parameters:type_name -> tfplugin6.Function.Parameter + 65, // 9: tfplugin6.Function.variadic_parameter:type_name -> tfplugin6.Function.Parameter + 66, // 10: tfplugin6.Function.return:type_name -> tfplugin6.Function.Return 0, // 11: tfplugin6.Function.description_kind:type_name -> tfplugin6.StringKind 4, // 12: tfplugin6.Deferred.reason:type_name -> tfplugin6.Deferred.Reason - 56, // 13: tfplugin6.Schema.Block.attributes:type_name -> tfplugin6.Schema.Attribute - 57, // 14: tfplugin6.Schema.Block.block_types:type_name -> tfplugin6.Schema.NestedBlock + 62, // 13: tfplugin6.Schema.Block.attributes:type_name -> tfplugin6.Schema.Attribute + 63, // 14: tfplugin6.Schema.Block.block_types:type_name -> tfplugin6.Schema.NestedBlock 0, // 15: tfplugin6.Schema.Block.description_kind:type_name -> tfplugin6.StringKind - 58, // 16: tfplugin6.Schema.Attribute.nested_type:type_name -> tfplugin6.Schema.Object + 64, // 16: tfplugin6.Schema.Attribute.nested_type:type_name -> tfplugin6.Schema.Object 0, // 17: tfplugin6.Schema.Attribute.description_kind:type_name -> tfplugin6.StringKind - 55, // 18: tfplugin6.Schema.NestedBlock.block:type_name -> tfplugin6.Schema.Block + 61, // 18: tfplugin6.Schema.NestedBlock.block:type_name -> tfplugin6.Schema.Block 2, // 19: tfplugin6.Schema.NestedBlock.nesting:type_name -> tfplugin6.Schema.NestedBlock.NestingMode - 56, // 20: tfplugin6.Schema.Object.attributes:type_name -> tfplugin6.Schema.Attribute + 62, // 20: tfplugin6.Schema.Object.attributes:type_name -> tfplugin6.Schema.Attribute 3, // 21: tfplugin6.Schema.Object.nesting:type_name -> tfplugin6.Schema.Object.NestingMode 0, // 22: tfplugin6.Function.Parameter.description_kind:type_name -> tfplugin6.StringKind 16, // 23: tfplugin6.GetMetadata.Response.server_capabilities:type_name -> tfplugin6.ServerCapabilities 6, // 24: tfplugin6.GetMetadata.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 65, // 25: tfplugin6.GetMetadata.Response.data_sources:type_name -> tfplugin6.GetMetadata.DataSourceMetadata - 66, // 26: tfplugin6.GetMetadata.Response.resources:type_name -> tfplugin6.GetMetadata.ResourceMetadata - 64, // 27: tfplugin6.GetMetadata.Response.functions:type_name -> tfplugin6.GetMetadata.FunctionMetadata - 63, // 28: tfplugin6.GetMetadata.Response.ephemeral_resources:type_name -> tfplugin6.GetMetadata.EphemeralMetadata - 67, // 29: tfplugin6.GetMetadata.Response.list_resources:type_name -> tfplugin6.GetMetadata.ListResourceMetadata - 68, // 30: tfplugin6.GetMetadata.Response.state_stores:type_name -> tfplugin6.GetMetadata.StateStoreMetadata - 69, // 31: tfplugin6.GetMetadata.Response.actions:type_name -> tfplugin6.GetMetadata.ActionMetadata + 71, // 25: tfplugin6.GetMetadata.Response.data_sources:type_name -> tfplugin6.GetMetadata.DataSourceMetadata + 72, // 26: tfplugin6.GetMetadata.Response.resources:type_name -> tfplugin6.GetMetadata.ResourceMetadata + 70, // 27: tfplugin6.GetMetadata.Response.functions:type_name -> tfplugin6.GetMetadata.FunctionMetadata + 69, // 28: tfplugin6.GetMetadata.Response.ephemeral_resources:type_name -> tfplugin6.GetMetadata.EphemeralMetadata + 73, // 29: tfplugin6.GetMetadata.Response.list_resources:type_name -> tfplugin6.GetMetadata.ListResourceMetadata + 74, // 30: tfplugin6.GetMetadata.Response.state_stores:type_name -> tfplugin6.GetMetadata.StateStoreMetadata + 75, // 31: tfplugin6.GetMetadata.Response.actions:type_name -> tfplugin6.GetMetadata.ActionMetadata 14, // 32: tfplugin6.GetProviderSchema.Response.provider:type_name -> tfplugin6.Schema - 72, // 33: tfplugin6.GetProviderSchema.Response.resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry - 73, // 34: tfplugin6.GetProviderSchema.Response.data_source_schemas:type_name -> tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry - 74, // 35: tfplugin6.GetProviderSchema.Response.functions:type_name -> tfplugin6.GetProviderSchema.Response.FunctionsEntry - 75, // 36: tfplugin6.GetProviderSchema.Response.ephemeral_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry - 76, // 37: tfplugin6.GetProviderSchema.Response.list_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry - 77, // 38: tfplugin6.GetProviderSchema.Response.state_store_schemas:type_name -> tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry - 78, // 39: tfplugin6.GetProviderSchema.Response.action_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ActionSchemasEntry + 78, // 33: tfplugin6.GetProviderSchema.Response.resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry + 79, // 34: tfplugin6.GetProviderSchema.Response.data_source_schemas:type_name -> tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry + 80, // 35: tfplugin6.GetProviderSchema.Response.functions:type_name -> tfplugin6.GetProviderSchema.Response.FunctionsEntry + 81, // 36: tfplugin6.GetProviderSchema.Response.ephemeral_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry + 82, // 37: tfplugin6.GetProviderSchema.Response.list_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry + 83, // 38: tfplugin6.GetProviderSchema.Response.state_store_schemas:type_name -> tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry + 84, // 39: tfplugin6.GetProviderSchema.Response.action_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ActionSchemasEntry 6, // 40: tfplugin6.GetProviderSchema.Response.diagnostics:type_name -> tfplugin6.Diagnostic 14, // 41: tfplugin6.GetProviderSchema.Response.provider_meta:type_name -> tfplugin6.Schema 16, // 42: tfplugin6.GetProviderSchema.Response.server_capabilities:type_name -> tfplugin6.ServerCapabilities @@ -8003,7 +8561,7 @@ var file_tfplugin6_proto_depIdxs = []int32{ 10, // 52: tfplugin6.UpgradeResourceState.Request.raw_state:type_name -> tfplugin6.RawState 5, // 53: tfplugin6.UpgradeResourceState.Response.upgraded_state:type_name -> tfplugin6.DynamicValue 6, // 54: tfplugin6.UpgradeResourceState.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 85, // 55: tfplugin6.GetResourceIdentitySchemas.Response.identity_schemas:type_name -> tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry + 91, // 55: tfplugin6.GetResourceIdentitySchemas.Response.identity_schemas:type_name -> tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry 6, // 56: tfplugin6.GetResourceIdentitySchemas.Response.diagnostics:type_name -> tfplugin6.Diagnostic 11, // 57: tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry.value:type_name -> tfplugin6.ResourceIdentitySchema 10, // 58: tfplugin6.UpgradeResourceIdentity.Request.raw_identity:type_name -> tfplugin6.RawState @@ -8050,7 +8608,7 @@ var file_tfplugin6_proto_depIdxs = []int32{ 12, // 99: tfplugin6.ImportResourceState.Request.identity:type_name -> tfplugin6.ResourceIdentityData 5, // 100: tfplugin6.ImportResourceState.ImportedResource.state:type_name -> tfplugin6.DynamicValue 12, // 101: tfplugin6.ImportResourceState.ImportedResource.identity:type_name -> tfplugin6.ResourceIdentityData - 103, // 102: tfplugin6.ImportResourceState.Response.imported_resources:type_name -> tfplugin6.ImportResourceState.ImportedResource + 109, // 102: tfplugin6.ImportResourceState.Response.imported_resources:type_name -> tfplugin6.ImportResourceState.ImportedResource 6, // 103: tfplugin6.ImportResourceState.Response.diagnostics:type_name -> tfplugin6.Diagnostic 18, // 104: tfplugin6.ImportResourceState.Response.deferred:type_name -> tfplugin6.Deferred 5, // 105: tfplugin6.GenerateResourceConfig.Request.state:type_name -> tfplugin6.DynamicValue @@ -8070,13 +8628,13 @@ var file_tfplugin6_proto_depIdxs = []int32{ 5, // 119: tfplugin6.OpenEphemeralResource.Request.config:type_name -> tfplugin6.DynamicValue 17, // 120: tfplugin6.OpenEphemeralResource.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities 6, // 121: tfplugin6.OpenEphemeralResource.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 142, // 122: tfplugin6.OpenEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp + 152, // 122: tfplugin6.OpenEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp 5, // 123: tfplugin6.OpenEphemeralResource.Response.result:type_name -> tfplugin6.DynamicValue 18, // 124: tfplugin6.OpenEphemeralResource.Response.deferred:type_name -> tfplugin6.Deferred 6, // 125: tfplugin6.RenewEphemeralResource.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 142, // 126: tfplugin6.RenewEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp + 152, // 126: tfplugin6.RenewEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp 6, // 127: tfplugin6.CloseEphemeralResource.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 119, // 128: tfplugin6.GetFunctions.Response.functions:type_name -> tfplugin6.GetFunctions.Response.FunctionsEntry + 125, // 128: tfplugin6.GetFunctions.Response.functions:type_name -> tfplugin6.GetFunctions.Response.FunctionsEntry 6, // 129: tfplugin6.GetFunctions.Response.diagnostics:type_name -> tfplugin6.Diagnostic 15, // 130: tfplugin6.GetFunctions.Response.FunctionsEntry.value:type_name -> tfplugin6.Function 5, // 131: tfplugin6.CallFunction.Request.arguments:type_name -> tfplugin6.DynamicValue @@ -8093,89 +8651,100 @@ var file_tfplugin6_proto_depIdxs = []int32{ 5, // 142: tfplugin6.ValidateStateStore.Request.config:type_name -> tfplugin6.DynamicValue 6, // 143: tfplugin6.ValidateStateStore.Response.diagnostics:type_name -> tfplugin6.Diagnostic 5, // 144: tfplugin6.ConfigureStateStore.Request.config:type_name -> tfplugin6.DynamicValue - 6, // 145: tfplugin6.ConfigureStateStore.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 6, // 146: tfplugin6.GetStates.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 6, // 147: tfplugin6.DeleteState.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 5, // 148: tfplugin6.PlanAction.Request.config:type_name -> tfplugin6.DynamicValue - 17, // 149: tfplugin6.PlanAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities - 6, // 150: tfplugin6.PlanAction.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 18, // 151: tfplugin6.PlanAction.Response.deferred:type_name -> tfplugin6.Deferred - 5, // 152: tfplugin6.InvokeAction.Request.config:type_name -> tfplugin6.DynamicValue - 17, // 153: tfplugin6.InvokeAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities - 138, // 154: tfplugin6.InvokeAction.Event.progress:type_name -> tfplugin6.InvokeAction.Event.Progress - 139, // 155: tfplugin6.InvokeAction.Event.completed:type_name -> tfplugin6.InvokeAction.Event.Completed - 6, // 156: tfplugin6.InvokeAction.Event.Completed.diagnostics:type_name -> tfplugin6.Diagnostic - 5, // 157: tfplugin6.ValidateActionConfig.Request.config:type_name -> tfplugin6.DynamicValue - 6, // 158: tfplugin6.ValidateActionConfig.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 61, // 159: tfplugin6.Provider.GetMetadata:input_type -> tfplugin6.GetMetadata.Request - 70, // 160: tfplugin6.Provider.GetProviderSchema:input_type -> tfplugin6.GetProviderSchema.Request - 79, // 161: tfplugin6.Provider.ValidateProviderConfig:input_type -> tfplugin6.ValidateProviderConfig.Request - 88, // 162: tfplugin6.Provider.ValidateResourceConfig:input_type -> tfplugin6.ValidateResourceConfig.Request - 90, // 163: tfplugin6.Provider.ValidateDataResourceConfig:input_type -> tfplugin6.ValidateDataResourceConfig.Request - 81, // 164: tfplugin6.Provider.UpgradeResourceState:input_type -> tfplugin6.UpgradeResourceState.Request - 83, // 165: tfplugin6.Provider.GetResourceIdentitySchemas:input_type -> tfplugin6.GetResourceIdentitySchemas.Request - 86, // 166: tfplugin6.Provider.UpgradeResourceIdentity:input_type -> tfplugin6.UpgradeResourceIdentity.Request - 94, // 167: tfplugin6.Provider.ConfigureProvider:input_type -> tfplugin6.ConfigureProvider.Request - 96, // 168: tfplugin6.Provider.ReadResource:input_type -> tfplugin6.ReadResource.Request - 98, // 169: tfplugin6.Provider.PlanResourceChange:input_type -> tfplugin6.PlanResourceChange.Request - 100, // 170: tfplugin6.Provider.ApplyResourceChange:input_type -> tfplugin6.ApplyResourceChange.Request - 102, // 171: tfplugin6.Provider.ImportResourceState:input_type -> tfplugin6.ImportResourceState.Request - 107, // 172: tfplugin6.Provider.MoveResourceState:input_type -> tfplugin6.MoveResourceState.Request - 109, // 173: tfplugin6.Provider.ReadDataSource:input_type -> tfplugin6.ReadDataSource.Request - 105, // 174: tfplugin6.Provider.GenerateResourceConfig:input_type -> tfplugin6.GenerateResourceConfig.Request - 92, // 175: tfplugin6.Provider.ValidateEphemeralResourceConfig:input_type -> tfplugin6.ValidateEphemeralResourceConfig.Request - 111, // 176: tfplugin6.Provider.OpenEphemeralResource:input_type -> tfplugin6.OpenEphemeralResource.Request - 113, // 177: tfplugin6.Provider.RenewEphemeralResource:input_type -> tfplugin6.RenewEphemeralResource.Request - 115, // 178: tfplugin6.Provider.CloseEphemeralResource:input_type -> tfplugin6.CloseEphemeralResource.Request - 122, // 179: tfplugin6.Provider.ListResource:input_type -> tfplugin6.ListResource.Request - 124, // 180: tfplugin6.Provider.ValidateListResourceConfig:input_type -> tfplugin6.ValidateListResourceConfig.Request - 117, // 181: tfplugin6.Provider.GetFunctions:input_type -> tfplugin6.GetFunctions.Request - 120, // 182: tfplugin6.Provider.CallFunction:input_type -> tfplugin6.CallFunction.Request - 126, // 183: tfplugin6.Provider.ValidateStateStoreConfig:input_type -> tfplugin6.ValidateStateStore.Request - 128, // 184: tfplugin6.Provider.ConfigureStateStore:input_type -> tfplugin6.ConfigureStateStore.Request - 130, // 185: tfplugin6.Provider.GetStates:input_type -> tfplugin6.GetStates.Request - 132, // 186: tfplugin6.Provider.DeleteState:input_type -> tfplugin6.DeleteState.Request - 134, // 187: tfplugin6.Provider.PlanAction:input_type -> tfplugin6.PlanAction.Request - 136, // 188: tfplugin6.Provider.InvokeAction:input_type -> tfplugin6.InvokeAction.Request - 140, // 189: tfplugin6.Provider.ValidateActionConfig:input_type -> tfplugin6.ValidateActionConfig.Request - 51, // 190: tfplugin6.Provider.StopProvider:input_type -> tfplugin6.StopProvider.Request - 62, // 191: tfplugin6.Provider.GetMetadata:output_type -> tfplugin6.GetMetadata.Response - 71, // 192: tfplugin6.Provider.GetProviderSchema:output_type -> tfplugin6.GetProviderSchema.Response - 80, // 193: tfplugin6.Provider.ValidateProviderConfig:output_type -> tfplugin6.ValidateProviderConfig.Response - 89, // 194: tfplugin6.Provider.ValidateResourceConfig:output_type -> tfplugin6.ValidateResourceConfig.Response - 91, // 195: tfplugin6.Provider.ValidateDataResourceConfig:output_type -> tfplugin6.ValidateDataResourceConfig.Response - 82, // 196: tfplugin6.Provider.UpgradeResourceState:output_type -> tfplugin6.UpgradeResourceState.Response - 84, // 197: tfplugin6.Provider.GetResourceIdentitySchemas:output_type -> tfplugin6.GetResourceIdentitySchemas.Response - 87, // 198: tfplugin6.Provider.UpgradeResourceIdentity:output_type -> tfplugin6.UpgradeResourceIdentity.Response - 95, // 199: tfplugin6.Provider.ConfigureProvider:output_type -> tfplugin6.ConfigureProvider.Response - 97, // 200: tfplugin6.Provider.ReadResource:output_type -> tfplugin6.ReadResource.Response - 99, // 201: tfplugin6.Provider.PlanResourceChange:output_type -> tfplugin6.PlanResourceChange.Response - 101, // 202: tfplugin6.Provider.ApplyResourceChange:output_type -> tfplugin6.ApplyResourceChange.Response - 104, // 203: tfplugin6.Provider.ImportResourceState:output_type -> tfplugin6.ImportResourceState.Response - 108, // 204: tfplugin6.Provider.MoveResourceState:output_type -> tfplugin6.MoveResourceState.Response - 110, // 205: tfplugin6.Provider.ReadDataSource:output_type -> tfplugin6.ReadDataSource.Response - 106, // 206: tfplugin6.Provider.GenerateResourceConfig:output_type -> tfplugin6.GenerateResourceConfig.Response - 93, // 207: tfplugin6.Provider.ValidateEphemeralResourceConfig:output_type -> tfplugin6.ValidateEphemeralResourceConfig.Response - 112, // 208: tfplugin6.Provider.OpenEphemeralResource:output_type -> tfplugin6.OpenEphemeralResource.Response - 114, // 209: tfplugin6.Provider.RenewEphemeralResource:output_type -> tfplugin6.RenewEphemeralResource.Response - 116, // 210: tfplugin6.Provider.CloseEphemeralResource:output_type -> tfplugin6.CloseEphemeralResource.Response - 123, // 211: tfplugin6.Provider.ListResource:output_type -> tfplugin6.ListResource.Event - 125, // 212: tfplugin6.Provider.ValidateListResourceConfig:output_type -> tfplugin6.ValidateListResourceConfig.Response - 118, // 213: tfplugin6.Provider.GetFunctions:output_type -> tfplugin6.GetFunctions.Response - 121, // 214: tfplugin6.Provider.CallFunction:output_type -> tfplugin6.CallFunction.Response - 127, // 215: tfplugin6.Provider.ValidateStateStoreConfig:output_type -> tfplugin6.ValidateStateStore.Response - 129, // 216: tfplugin6.Provider.ConfigureStateStore:output_type -> tfplugin6.ConfigureStateStore.Response - 131, // 217: tfplugin6.Provider.GetStates:output_type -> tfplugin6.GetStates.Response - 133, // 218: tfplugin6.Provider.DeleteState:output_type -> tfplugin6.DeleteState.Response - 135, // 219: tfplugin6.Provider.PlanAction:output_type -> tfplugin6.PlanAction.Response - 137, // 220: tfplugin6.Provider.InvokeAction:output_type -> tfplugin6.InvokeAction.Event - 141, // 221: tfplugin6.Provider.ValidateActionConfig:output_type -> tfplugin6.ValidateActionConfig.Response - 52, // 222: tfplugin6.Provider.StopProvider:output_type -> tfplugin6.StopProvider.Response - 191, // [191:223] is the sub-list for method output_type - 159, // [159:191] is the sub-list for method input_type - 159, // [159:159] is the sub-list for extension type_name - 159, // [159:159] is the sub-list for extension extendee - 0, // [0:159] is the sub-list for field type_name + 45, // 145: tfplugin6.ConfigureStateStore.Request.capabilities:type_name -> tfplugin6.StateStoreClientCapabilities + 6, // 146: tfplugin6.ConfigureStateStore.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 46, // 147: tfplugin6.ConfigureStateStore.Response.capabilities:type_name -> tfplugin6.StateStoreServerCapabilities + 50, // 148: tfplugin6.ReadStateBytes.Response.range:type_name -> tfplugin6.StateRange + 6, // 149: tfplugin6.ReadStateBytes.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 49, // 150: tfplugin6.WriteStateBytes.RequestChunk.meta:type_name -> tfplugin6.RequestChunkMeta + 50, // 151: tfplugin6.WriteStateBytes.RequestChunk.range:type_name -> tfplugin6.StateRange + 6, // 152: tfplugin6.WriteStateBytes.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 6, // 153: tfplugin6.GetStates.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 6, // 154: tfplugin6.DeleteState.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 5, // 155: tfplugin6.PlanAction.Request.config:type_name -> tfplugin6.DynamicValue + 17, // 156: tfplugin6.PlanAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities + 6, // 157: tfplugin6.PlanAction.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 18, // 158: tfplugin6.PlanAction.Response.deferred:type_name -> tfplugin6.Deferred + 5, // 159: tfplugin6.InvokeAction.Request.config:type_name -> tfplugin6.DynamicValue + 17, // 160: tfplugin6.InvokeAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities + 148, // 161: tfplugin6.InvokeAction.Event.progress:type_name -> tfplugin6.InvokeAction.Event.Progress + 149, // 162: tfplugin6.InvokeAction.Event.completed:type_name -> tfplugin6.InvokeAction.Event.Completed + 6, // 163: tfplugin6.InvokeAction.Event.Completed.diagnostics:type_name -> tfplugin6.Diagnostic + 5, // 164: tfplugin6.ValidateActionConfig.Request.config:type_name -> tfplugin6.DynamicValue + 6, // 165: tfplugin6.ValidateActionConfig.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 67, // 166: tfplugin6.Provider.GetMetadata:input_type -> tfplugin6.GetMetadata.Request + 76, // 167: tfplugin6.Provider.GetProviderSchema:input_type -> tfplugin6.GetProviderSchema.Request + 85, // 168: tfplugin6.Provider.ValidateProviderConfig:input_type -> tfplugin6.ValidateProviderConfig.Request + 94, // 169: tfplugin6.Provider.ValidateResourceConfig:input_type -> tfplugin6.ValidateResourceConfig.Request + 96, // 170: tfplugin6.Provider.ValidateDataResourceConfig:input_type -> tfplugin6.ValidateDataResourceConfig.Request + 87, // 171: tfplugin6.Provider.UpgradeResourceState:input_type -> tfplugin6.UpgradeResourceState.Request + 89, // 172: tfplugin6.Provider.GetResourceIdentitySchemas:input_type -> tfplugin6.GetResourceIdentitySchemas.Request + 92, // 173: tfplugin6.Provider.UpgradeResourceIdentity:input_type -> tfplugin6.UpgradeResourceIdentity.Request + 100, // 174: tfplugin6.Provider.ConfigureProvider:input_type -> tfplugin6.ConfigureProvider.Request + 102, // 175: tfplugin6.Provider.ReadResource:input_type -> tfplugin6.ReadResource.Request + 104, // 176: tfplugin6.Provider.PlanResourceChange:input_type -> tfplugin6.PlanResourceChange.Request + 106, // 177: tfplugin6.Provider.ApplyResourceChange:input_type -> tfplugin6.ApplyResourceChange.Request + 108, // 178: tfplugin6.Provider.ImportResourceState:input_type -> tfplugin6.ImportResourceState.Request + 113, // 179: tfplugin6.Provider.MoveResourceState:input_type -> tfplugin6.MoveResourceState.Request + 115, // 180: tfplugin6.Provider.ReadDataSource:input_type -> tfplugin6.ReadDataSource.Request + 111, // 181: tfplugin6.Provider.GenerateResourceConfig:input_type -> tfplugin6.GenerateResourceConfig.Request + 98, // 182: tfplugin6.Provider.ValidateEphemeralResourceConfig:input_type -> tfplugin6.ValidateEphemeralResourceConfig.Request + 117, // 183: tfplugin6.Provider.OpenEphemeralResource:input_type -> tfplugin6.OpenEphemeralResource.Request + 119, // 184: tfplugin6.Provider.RenewEphemeralResource:input_type -> tfplugin6.RenewEphemeralResource.Request + 121, // 185: tfplugin6.Provider.CloseEphemeralResource:input_type -> tfplugin6.CloseEphemeralResource.Request + 128, // 186: tfplugin6.Provider.ListResource:input_type -> tfplugin6.ListResource.Request + 130, // 187: tfplugin6.Provider.ValidateListResourceConfig:input_type -> tfplugin6.ValidateListResourceConfig.Request + 123, // 188: tfplugin6.Provider.GetFunctions:input_type -> tfplugin6.GetFunctions.Request + 126, // 189: tfplugin6.Provider.CallFunction:input_type -> tfplugin6.CallFunction.Request + 132, // 190: tfplugin6.Provider.ValidateStateStoreConfig:input_type -> tfplugin6.ValidateStateStore.Request + 134, // 191: tfplugin6.Provider.ConfigureStateStore:input_type -> tfplugin6.ConfigureStateStore.Request + 136, // 192: tfplugin6.Provider.ReadStateBytes:input_type -> tfplugin6.ReadStateBytes.Request + 138, // 193: tfplugin6.Provider.WriteStateBytes:input_type -> tfplugin6.WriteStateBytes.RequestChunk + 140, // 194: tfplugin6.Provider.GetStates:input_type -> tfplugin6.GetStates.Request + 142, // 195: tfplugin6.Provider.DeleteState:input_type -> tfplugin6.DeleteState.Request + 144, // 196: tfplugin6.Provider.PlanAction:input_type -> tfplugin6.PlanAction.Request + 146, // 197: tfplugin6.Provider.InvokeAction:input_type -> tfplugin6.InvokeAction.Request + 150, // 198: tfplugin6.Provider.ValidateActionConfig:input_type -> tfplugin6.ValidateActionConfig.Request + 57, // 199: tfplugin6.Provider.StopProvider:input_type -> tfplugin6.StopProvider.Request + 68, // 200: tfplugin6.Provider.GetMetadata:output_type -> tfplugin6.GetMetadata.Response + 77, // 201: tfplugin6.Provider.GetProviderSchema:output_type -> tfplugin6.GetProviderSchema.Response + 86, // 202: tfplugin6.Provider.ValidateProviderConfig:output_type -> tfplugin6.ValidateProviderConfig.Response + 95, // 203: tfplugin6.Provider.ValidateResourceConfig:output_type -> tfplugin6.ValidateResourceConfig.Response + 97, // 204: tfplugin6.Provider.ValidateDataResourceConfig:output_type -> tfplugin6.ValidateDataResourceConfig.Response + 88, // 205: tfplugin6.Provider.UpgradeResourceState:output_type -> tfplugin6.UpgradeResourceState.Response + 90, // 206: tfplugin6.Provider.GetResourceIdentitySchemas:output_type -> tfplugin6.GetResourceIdentitySchemas.Response + 93, // 207: tfplugin6.Provider.UpgradeResourceIdentity:output_type -> tfplugin6.UpgradeResourceIdentity.Response + 101, // 208: tfplugin6.Provider.ConfigureProvider:output_type -> tfplugin6.ConfigureProvider.Response + 103, // 209: tfplugin6.Provider.ReadResource:output_type -> tfplugin6.ReadResource.Response + 105, // 210: tfplugin6.Provider.PlanResourceChange:output_type -> tfplugin6.PlanResourceChange.Response + 107, // 211: tfplugin6.Provider.ApplyResourceChange:output_type -> tfplugin6.ApplyResourceChange.Response + 110, // 212: tfplugin6.Provider.ImportResourceState:output_type -> tfplugin6.ImportResourceState.Response + 114, // 213: tfplugin6.Provider.MoveResourceState:output_type -> tfplugin6.MoveResourceState.Response + 116, // 214: tfplugin6.Provider.ReadDataSource:output_type -> tfplugin6.ReadDataSource.Response + 112, // 215: tfplugin6.Provider.GenerateResourceConfig:output_type -> tfplugin6.GenerateResourceConfig.Response + 99, // 216: tfplugin6.Provider.ValidateEphemeralResourceConfig:output_type -> tfplugin6.ValidateEphemeralResourceConfig.Response + 118, // 217: tfplugin6.Provider.OpenEphemeralResource:output_type -> tfplugin6.OpenEphemeralResource.Response + 120, // 218: tfplugin6.Provider.RenewEphemeralResource:output_type -> tfplugin6.RenewEphemeralResource.Response + 122, // 219: tfplugin6.Provider.CloseEphemeralResource:output_type -> tfplugin6.CloseEphemeralResource.Response + 129, // 220: tfplugin6.Provider.ListResource:output_type -> tfplugin6.ListResource.Event + 131, // 221: tfplugin6.Provider.ValidateListResourceConfig:output_type -> tfplugin6.ValidateListResourceConfig.Response + 124, // 222: tfplugin6.Provider.GetFunctions:output_type -> tfplugin6.GetFunctions.Response + 127, // 223: tfplugin6.Provider.CallFunction:output_type -> tfplugin6.CallFunction.Response + 133, // 224: tfplugin6.Provider.ValidateStateStoreConfig:output_type -> tfplugin6.ValidateStateStore.Response + 135, // 225: tfplugin6.Provider.ConfigureStateStore:output_type -> tfplugin6.ConfigureStateStore.Response + 137, // 226: tfplugin6.Provider.ReadStateBytes:output_type -> tfplugin6.ReadStateBytes.Response + 139, // 227: tfplugin6.Provider.WriteStateBytes:output_type -> tfplugin6.WriteStateBytes.Response + 141, // 228: tfplugin6.Provider.GetStates:output_type -> tfplugin6.GetStates.Response + 143, // 229: tfplugin6.Provider.DeleteState:output_type -> tfplugin6.DeleteState.Response + 145, // 230: tfplugin6.Provider.PlanAction:output_type -> tfplugin6.PlanAction.Response + 147, // 231: tfplugin6.Provider.InvokeAction:output_type -> tfplugin6.InvokeAction.Event + 151, // 232: tfplugin6.Provider.ValidateActionConfig:output_type -> tfplugin6.ValidateActionConfig.Response + 58, // 233: tfplugin6.Provider.StopProvider:output_type -> tfplugin6.StopProvider.Response + 200, // [200:234] is the sub-list for method output_type + 166, // [166:200] is the sub-list for method input_type + 166, // [166:166] is the sub-list for extension type_name + 166, // [166:166] is the sub-list for extension extendee + 0, // [0:166] is the sub-list for field type_name } func init() { file_tfplugin6_proto_init() } @@ -8184,17 +8753,18 @@ func file_tfplugin6_proto_init() { return } file_tfplugin6_proto_msgTypes[2].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[45].OneofWrappers = []any{ + file_tfplugin6_proto_msgTypes[51].OneofWrappers = []any{ (*AttributePath_Step_AttributeName)(nil), (*AttributePath_Step_ElementKeyString)(nil), (*AttributePath_Step_ElementKeyInt)(nil), } - file_tfplugin6_proto_msgTypes[107].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[108].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[109].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[110].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[118].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[132].OneofWrappers = []any{ + file_tfplugin6_proto_msgTypes[113].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[114].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[115].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[116].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[124].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[133].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[142].OneofWrappers = []any{ (*InvokeAction_Event_Progress_)(nil), (*InvokeAction_Event_Completed_)(nil), } @@ -8204,7 +8774,7 @@ func file_tfplugin6_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_tfplugin6_proto_rawDesc), len(file_tfplugin6_proto_rawDesc)), NumEnums: 5, - NumMessages: 137, + NumMessages: 147, NumExtensions: 0, NumServices: 1, }, @@ -8275,6 +8845,10 @@ type ProviderClient interface { ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) + // ReadStateBytes streams byte chunks of a given state file from a state store + ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) + // WriteStateBytes streams byte chunks of a given state file into a state store + WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) @@ -8552,6 +9126,72 @@ func (c *providerClient) ConfigureStateStore(ctx context.Context, in *ConfigureS return out, nil } +func (c *providerClient) ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) { + stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[1], "/tfplugin6.Provider/ReadStateBytes", opts...) + if err != nil { + return nil, err + } + x := &providerReadStateBytesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_ReadStateBytesClient interface { + Recv() (*ReadStateBytes_Response, error) + grpc.ClientStream +} + +type providerReadStateBytesClient struct { + grpc.ClientStream +} + +func (x *providerReadStateBytesClient) Recv() (*ReadStateBytes_Response, error) { + m := new(ReadStateBytes_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) { + stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[2], "/tfplugin6.Provider/WriteStateBytes", opts...) + if err != nil { + return nil, err + } + x := &providerWriteStateBytesClient{stream} + return x, nil +} + +type Provider_WriteStateBytesClient interface { + Send(*WriteStateBytes_RequestChunk) error + CloseAndRecv() (*WriteStateBytes_Response, error) + grpc.ClientStream +} + +type providerWriteStateBytesClient struct { + grpc.ClientStream +} + +func (x *providerWriteStateBytesClient) Send(m *WriteStateBytes_RequestChunk) error { + return x.ClientStream.SendMsg(m) +} + +func (x *providerWriteStateBytesClient) CloseAndRecv() (*WriteStateBytes_Response, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(WriteStateBytes_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + func (c *providerClient) GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) { out := new(GetStates_Response) err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetStates", in, out, opts...) @@ -8580,7 +9220,7 @@ func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, } func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[1], "/tfplugin6.Provider/InvokeAction", opts...) + stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[3], "/tfplugin6.Provider/InvokeAction", opts...) if err != nil { return nil, err } @@ -8676,6 +9316,10 @@ type ProviderServer interface { ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) + // ReadStateBytes streams byte chunks of a given state file from a state store + ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error + // WriteStateBytes streams byte chunks of a given state file into a state store + WriteStateBytes(Provider_WriteStateBytesServer) error // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) @@ -8770,6 +9414,12 @@ func (*UnimplementedProviderServer) ValidateStateStoreConfig(context.Context, *V func (*UnimplementedProviderServer) ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) { return nil, status.Errorf(codes.Unimplemented, "method ConfigureStateStore not implemented") } +func (*UnimplementedProviderServer) ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error { + return status.Errorf(codes.Unimplemented, "method ReadStateBytes not implemented") +} +func (*UnimplementedProviderServer) WriteStateBytes(Provider_WriteStateBytesServer) error { + return status.Errorf(codes.Unimplemented, "method WriteStateBytes not implemented") +} func (*UnimplementedProviderServer) GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) { return nil, status.Errorf(codes.Unimplemented, "method GetStates not implemented") } @@ -9264,6 +9914,53 @@ func _Provider_ConfigureStateStore_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } +func _Provider_ReadStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ReadStateBytes_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).ReadStateBytes(m, &providerReadStateBytesServer{stream}) +} + +type Provider_ReadStateBytesServer interface { + Send(*ReadStateBytes_Response) error + grpc.ServerStream +} + +type providerReadStateBytesServer struct { + grpc.ServerStream +} + +func (x *providerReadStateBytesServer) Send(m *ReadStateBytes_Response) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_WriteStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ProviderServer).WriteStateBytes(&providerWriteStateBytesServer{stream}) +} + +type Provider_WriteStateBytesServer interface { + SendAndClose(*WriteStateBytes_Response) error + Recv() (*WriteStateBytes_RequestChunk, error) + grpc.ServerStream +} + +type providerWriteStateBytesServer struct { + grpc.ServerStream +} + +func (x *providerWriteStateBytesServer) SendAndClose(m *WriteStateBytes_Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *providerWriteStateBytesServer) Recv() (*WriteStateBytes_RequestChunk, error) { + m := new(WriteStateBytes_RequestChunk) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + func _Provider_GetStates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetStates_Request) if err := dec(in); err != nil { @@ -9506,6 +10203,16 @@ var _Provider_serviceDesc = grpc.ServiceDesc{ Handler: _Provider_ListResource_Handler, ServerStreams: true, }, + { + StreamName: "ReadStateBytes", + Handler: _Provider_ReadStateBytes_Handler, + ServerStreams: true, + }, + { + StreamName: "WriteStateBytes", + Handler: _Provider_WriteStateBytes_Handler, + ClientStreams: true, + }, { StreamName: "InvokeAction", Handler: _Provider_InvokeAction_Handler, From 8ed2f390879589a3190b5c2efa83ed2caeede88e Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Fri, 26 Sep 2025 12:57:37 -0400 Subject: [PATCH 17/27] actions: don't panic if nil changes - it might be a refresh (#37687) --- internal/terraform/node_action_trigger_instance_plan.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/terraform/node_action_trigger_instance_plan.go b/internal/terraform/node_action_trigger_instance_plan.go index 4d0dd0cb8136..dfb10f267449 100644 --- a/internal/terraform/node_action_trigger_instance_plan.go +++ b/internal/terraform/node_action_trigger_instance_plan.go @@ -7,6 +7,7 @@ import ( "fmt" "github.com/hashicorp/hcl/v2" + "github.com/zclconf/go-cty/cty" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/configs" @@ -17,7 +18,6 @@ import ( "github.com/hashicorp/terraform/internal/plans/deferring" "github.com/hashicorp/terraform/internal/providers" "github.com/hashicorp/terraform/internal/tfdiags" - "github.com/zclconf/go-cty/cty" ) type nodeActionTriggerPlanInstance struct { @@ -89,7 +89,8 @@ func (n *nodeActionTriggerPlanInstance) Execute(ctx EvalContext, operation walkO } if change == nil { - panic("change cannot be nil") + // nothing to do (this may be a refresh ) + return nil } if n.lifecycleActionTrigger == nil { From c0547e784f398669640222e6be3e375509c37b77 Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Fri, 26 Sep 2025 18:08:19 +0100 Subject: [PATCH 18/27] Fixes to protobuf compile script (#37683) * Fix lack of protoc-gen-go-grpc This appears to have been removed in https://github.com/hashicorp/terraform/pull/29492/files#diff-0329966ed7ce7286cfaf91161ac003af419cc566dd6420bb07670f9e4a389c81 accidentally following linting? * Fix Args to include all arguments The docs say "Args holds command line arguments, including the command as Args[0]." * Add TODO for swapping to non-deprecated repo for protoc-gen-go --- tools/protobuf-compile/protobuf-compile.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/protobuf-compile/protobuf-compile.go b/tools/protobuf-compile/protobuf-compile.go index f9bff7acac13..95a1c3cb5f9b 100644 --- a/tools/protobuf-compile/protobuf-compile.go +++ b/tools/protobuf-compile/protobuf-compile.go @@ -33,6 +33,8 @@ const protocVersion = "3.15.6" // in Go modules our version selection for these comes from our top-level // go.mod, as with all other Go dependencies. If you want to switch to a newer // version of either tool then you can upgrade their modules in the usual way. +// +// TODO: Swap to using google.golang.org/protobuf/cmd/protoc-gen-go const protocGenGoPackage = "github.com/golang/protobuf/protoc-gen-go" const protocGenGoGrpcPackage = "google.golang.org/grpc/cmd/protoc-gen-go-grpc" @@ -144,7 +146,7 @@ func main() { if err != nil { log.Fatal(err) } - _, err = buildProtocGenGoGrpc(workDir) + protocGenGoGrpcExec, err := buildProtocGenGoGrpc(workDir) if err != nil { log.Fatal(err) } @@ -157,7 +159,7 @@ func main() { if err != nil { log.Fatal(err) } - protocGenGoGrpcExec, err := filepath.Abs(protocGenGoExec) + protocGenGoGrpcExec, err = filepath.Abs(protocGenGoGrpcExec) if err != nil { log.Fatal(err) } @@ -175,7 +177,7 @@ func main() { cmd := &exec.Cmd{ Path: cmdLine[0], - Args: cmdLine[1:], + Args: cmdLine, Dir: step.WorkDir, Env: os.Environ(), Stdout: os.Stdout, From eae5ac13dd47eafd2d338b21db7311bbfa861b68 Mon Sep 17 00:00:00 2001 From: Nara Kasbergen Kwon <855115+xiehan@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:35:19 +0200 Subject: [PATCH 19/27] build: Produce a Windows arm64 binary (#35461) --- .changes/v1.15/NEW FEATURES-20250926-164134.yaml | 5 +++++ .github/workflows/build.yml | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changes/v1.15/NEW FEATURES-20250926-164134.yaml diff --git a/.changes/v1.15/NEW FEATURES-20250926-164134.yaml b/.changes/v1.15/NEW FEATURES-20250926-164134.yaml new file mode 100644 index 000000000000..b55e44da384c --- /dev/null +++ b/.changes/v1.15/NEW FEATURES-20250926-164134.yaml @@ -0,0 +1,5 @@ +kind: NEW FEATURES +body: We now produce builds for Windows ARM64 +time: 2025-09-26T16:41:34.771437+02:00 +custom: + Issue: "32719" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6dc19041c00c..a877a62353e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,6 +121,7 @@ jobs: - {goos: "solaris", goarch: "amd64", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "windows", goarch: "386", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "windows", goarch: "amd64", runson: "ubuntu-latest", cgo-enabled: "0"} + - {goos: "windows", goarch: "arm64", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "darwin", goarch: "amd64", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "darwin", goarch: "arm64", runson: "ubuntu-latest", cgo-enabled: "0"} fail-fast: false From 0217dd2b2aebdc1ed88e27ed44b9385d8452dca1 Mon Sep 17 00:00:00 2001 From: Samsondeen <40821565+dsa0x@users.noreply.github.com> Date: Mon, 29 Sep 2025 14:58:13 +0200 Subject: [PATCH 20/27] Revert "temporarily require manager approval for go.mod changes" (#37694) --- CODEOWNERS | 3 --- 1 file changed, 3 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 3942a70431e1..d0ca00eb8506 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -32,6 +32,3 @@ builtin/provisioners/file @hashicorp/terraform-core builtin/provisioners/local-exec @hashicorp/terraform-core builtin/provisioners/remote-exec @hashicorp/terraform-core - -# temporary go.mod protection during freeze -/go.mod @tommyokeefe \ No newline at end of file From ffbb62b369fc8ea5ab21f49681a5767b6c26b429 Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Tue, 30 Sep 2025 11:52:24 +0100 Subject: [PATCH 21/27] Swap to using `google.golang.org/protobuf/cmd/protoc-gen-go` instead of `github.com/golang/protobuf/protoc-gen-go` (#37685) * Reformat Args in steps definitions * Swap to using the new version of protoc-gen-go that doesn't include grpc support (instead it relies on protoc-gen-go-grpc). Update command flags to reflect this change in tooling. See this comment for explanation: https://github.com/golang/protobuf/issues/1070#issuecomment-607293496 * Run `make protobuf` with problem generate steps commented out. * Use `require_unimplemented_servers=false` to minimise changes at the time of upgrading tooling In future we can navigate the consequences of this in its own PR. * WIP * Fix out/opt typo, add remaining flags once terraform1.proto was being found ok * Run `make protobuf` * `go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0` && `go mod tidy` This version includes a feature that allows the copyright comment in the .proto file to be pulled across to generated _grpc.pb.go files. * Run `make protobuf` with new version of protoc-gen-go-grpc that allows copyright comment to be copied to generated output files * Potential fix for `internal/rpcapi/dynrpcserver/generator` --- go.mod | 2 +- go.sum | 5 +- .../cloudplugin/cloudproto1/cloudproto1.pb.go | 113 -- .../cloudproto1/cloudproto1_grpc.pb.go | 139 ++ .../rpcapi/dynrpcserver/generator/main.go | 10 + .../dependencies/dependencies.pb.go | 602 ------- .../dependencies/dependencies_grpc.pb.go | 639 +++++++ .../rpcapi/terraform1/packages/packages.pb.go | 228 --- .../terraform1/packages/packages_grpc.pb.go | 258 +++ internal/rpcapi/terraform1/setup/setup.pb.go | 134 -- .../rpcapi/terraform1/setup/setup_grpc.pb.go | 161 ++ .../rpcapi/terraform1/stacks/stacks.pb.go | 832 --------- .../terraform1/stacks/stacks_grpc.pb.go | 873 ++++++++++ .../stacksproto1/stacksproto1.pb.go | 113 -- .../stacksproto1/stacksproto1_grpc.pb.go | 139 ++ internal/tfplugin5/tfplugin5.pb.go | 1357 --------------- internal/tfplugin5/tfplugin5_grpc.pb.go | 1447 ++++++++++++++++ internal/tfplugin6/tfplugin6.pb.go | 1438 ---------------- internal/tfplugin6/tfplugin6_grpc.pb.go | 1515 +++++++++++++++++ tools/protobuf-compile/protobuf-compile.go | 105 +- 20 files changed, 5274 insertions(+), 4836 deletions(-) create mode 100644 internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go create mode 100644 internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go create mode 100644 internal/rpcapi/terraform1/packages/packages_grpc.pb.go create mode 100644 internal/rpcapi/terraform1/setup/setup_grpc.pb.go create mode 100644 internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go create mode 100644 internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go create mode 100644 internal/tfplugin5/tfplugin5_grpc.pb.go create mode 100644 internal/tfplugin6/tfplugin6_grpc.pb.go diff --git a/go.mod b/go.mod index 804b778c2e98..c2f701719d34 100644 --- a/go.mod +++ b/go.mod @@ -82,7 +82,7 @@ require ( golang.org/x/tools v0.36.0 golang.org/x/tools/cmd/cover v0.1.0-deprecated google.golang.org/grpc v1.69.4 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/protobuf v1.36.6 honnef.co/go/tools v0.6.0 ) diff --git a/go.sum b/go.sum index 608a0bee9b65..2ffcb84fe6e8 100644 --- a/go.sum +++ b/go.sum @@ -1278,8 +1278,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 h1:TLkBREm4nIsEcexnCjgQd5GQWaHcqMzwQV0TX9pq8S0= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1292,7 +1292,6 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/internal/cloudplugin/cloudproto1/cloudproto1.pb.go b/internal/cloudplugin/cloudproto1/cloudproto1.pb.go index b2f2f048e43e..9cda01b22b87 100644 --- a/internal/cloudplugin/cloudproto1/cloudproto1.pb.go +++ b/internal/cloudplugin/cloudproto1/cloudproto1.pb.go @@ -10,10 +10,6 @@ package cloudproto1 import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -244,112 +240,3 @@ func file_cloudproto1_proto_init() { file_cloudproto1_proto_goTypes = nil file_cloudproto1_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// CommandServiceClient is the client API for CommandService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CommandServiceClient interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) -} - -type commandServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { - return &commandServiceClient{cc} -} - -func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { - stream, err := c.cc.NewStream(ctx, &_CommandService_serviceDesc.Streams[0], "/cloudproto1.CommandService/Execute", opts...) - if err != nil { - return nil, err - } - x := &commandServiceExecuteClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type CommandService_ExecuteClient interface { - Recv() (*CommandResponse, error) - grpc.ClientStream -} - -type commandServiceExecuteClient struct { - grpc.ClientStream -} - -func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { - m := new(CommandResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// CommandServiceServer is the server API for CommandService service. -type CommandServiceServer interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(*CommandRequest, CommandService_ExecuteServer) error -} - -// UnimplementedCommandServiceServer can be embedded to have forward compatible implementations. -type UnimplementedCommandServiceServer struct { -} - -func (*UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { - return status.Errorf(codes.Unimplemented, "method Execute not implemented") -} - -func RegisterCommandServiceServer(s *grpc.Server, srv CommandServiceServer) { - s.RegisterService(&_CommandService_serviceDesc, srv) -} - -func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(CommandRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) -} - -type CommandService_ExecuteServer interface { - Send(*CommandResponse) error - grpc.ServerStream -} - -type commandServiceExecuteServer struct { - grpc.ServerStream -} - -func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _CommandService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cloudproto1.CommandService", - HandlerType: (*CommandServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Execute", - Handler: _CommandService_Execute_Handler, - ServerStreams: true, - }, - }, - Metadata: "cloudproto1.proto", -} diff --git a/internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go b/internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go new file mode 100644 index 000000000000..b43167c8e990 --- /dev/null +++ b/internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go @@ -0,0 +1,139 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: cloudproto1.proto + +package cloudproto1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + CommandService_Execute_FullMethodName = "/cloudproto1.CommandService/Execute" +) + +// CommandServiceClient is the client API for CommandService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CommandServiceClient interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) +} + +type commandServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { + return &commandServiceClient{cc} +} + +func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { + stream, err := c.cc.NewStream(ctx, &CommandService_ServiceDesc.Streams[0], CommandService_Execute_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &commandServiceExecuteClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type CommandService_ExecuteClient interface { + Recv() (*CommandResponse, error) + grpc.ClientStream +} + +type commandServiceExecuteClient struct { + grpc.ClientStream +} + +func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { + m := new(CommandResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// CommandServiceServer is the server API for CommandService service. +// All implementations should embed UnimplementedCommandServiceServer +// for forward compatibility +type CommandServiceServer interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(*CommandRequest, CommandService_ExecuteServer) error +} + +// UnimplementedCommandServiceServer should be embedded to have forward compatible implementations. +type UnimplementedCommandServiceServer struct { +} + +func (UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { + return status.Errorf(codes.Unimplemented, "method Execute not implemented") +} + +// UnsafeCommandServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CommandServiceServer will +// result in compilation errors. +type UnsafeCommandServiceServer interface { + mustEmbedUnimplementedCommandServiceServer() +} + +func RegisterCommandServiceServer(s grpc.ServiceRegistrar, srv CommandServiceServer) { + s.RegisterService(&CommandService_ServiceDesc, srv) +} + +func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(CommandRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) +} + +type CommandService_ExecuteServer interface { + Send(*CommandResponse) error + grpc.ServerStream +} + +type commandServiceExecuteServer struct { + grpc.ServerStream +} + +func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { + return x.ServerStream.SendMsg(m) +} + +// CommandService_ServiceDesc is the grpc.ServiceDesc for CommandService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CommandService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "cloudproto1.CommandService", + HandlerType: (*CommandServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Execute", + Handler: _CommandService_Execute_Handler, + ServerStreams: true, + }, + }, + Metadata: "cloudproto1.proto", +} diff --git a/internal/rpcapi/dynrpcserver/generator/main.go b/internal/rpcapi/dynrpcserver/generator/main.go index 9f1631a52e6b..cd010016295c 100644 --- a/internal/rpcapi/dynrpcserver/generator/main.go +++ b/internal/rpcapi/dynrpcserver/generator/main.go @@ -94,6 +94,16 @@ func main() { filename := toFilenameCase(baseName) + ".go" absFilename := filepath.Join(outDir, filename) + if regexp.MustCompile("^Unsafe").MatchString(ifaceName) { + // This isn't a gRPC server interface, so skip it. + // + // This is an interface that's intended to be embedded to help users to meet requirements for Unimplemented servers. + // See: + // > Docs: https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc#readme-future-proofing-services + // > PR for Unsafe interfaces: https://github.com/grpc/grpc-go/pull/3911 + continue Types + } + var buf bytes.Buffer fmt.Fprintf(&buf, `// Copyright (c) HashiCorp, Inc. diff --git a/internal/rpcapi/terraform1/dependencies/dependencies.pb.go b/internal/rpcapi/terraform1/dependencies/dependencies.pb.go index 8a7ee854d47f..4c4a987e445a 100644 --- a/internal/rpcapi/terraform1/dependencies/dependencies.pb.go +++ b/internal/rpcapi/terraform1/dependencies/dependencies.pb.go @@ -10,11 +10,7 @@ package dependencies import ( - context "context" terraform1 "github.com/hashicorp/terraform/internal/rpcapi/terraform1" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -3233,601 +3229,3 @@ func file_dependencies_proto_init() { file_dependencies_proto_goTypes = nil file_dependencies_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// DependenciesClient is the client API for Dependencies service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type DependenciesClient interface { - // Opens a source bundle that was already extracted into the filesystem - // somewhere, returning an opaque source bundle handle that can be used for - // subsequent operations. - OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) - // Closes a previously-opened source bundle, invalidating the given handle - // and therefore making it safe to delete or modify the bundle directory - // on disk. - CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) - // Reads and parses an existing dependency lock file from the filesystem, - // returning a dependency locks handle. - // - // This function parses a user-provided source file, and so invalid content - // in that file is treated as diagnostics in a successful response rather - // than as an RPC error. Callers must check whether the dependency locks - // handle in the response is set (non-zero) before using it, and treat - // an unset handle as indicating a user error which is described in the - // accompanying diagnostics. Diagnostics can also be returned along with - // a valid handle, e.g. if there are non-blocking warning diagnostics. - OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) - // Creates an in-memory-only dependency locks handle with a fixed set of - // dependency selections provided as arguments. - CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) - CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) - // Returns information about the provider version selections in a - // dependency locks object. - GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) - // Populates a new provider plugin cache directory in the local filesystem - // based on the provider version selections in a given dependency locks - // object. - // - // This particular RPC can only install already-selected provider packages - // recorded in a dependency locks object; it does not support "upgrading" - // provider selections to newer versions as a CLI user would do with - // "terraform init -upgrade", because there would be no way to then - // commit the updated locks to disk as a lock file. - BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) - // Opens an existing local filesystem directory as a provider plugin cache - // directory, returning a plugin cache handle that can be used with other - // RPC operations. - OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) - CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) - // Returns information about the specific provider packages that are - // available in the given provider plugin cache. - GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) - // Returns information about the built-in providers that are compiled in - // to this Terraform Core server. - GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) - // Returns a description of the schema for a particular provider in a - // given provider plugin cache, or of a particular built-in provider - // known to this version of Terraform Core. - // - // WARNING: This operation requires executing the selected provider plugin, - // which therefore allows it to run arbitrary code as a child process of - // this Terraform Core server, with access to all of the same resources. - // This should typically be used only with providers explicitly selected - // in a dependency lock file, so users can control what external code - // has the potential to run in a context that probably has access to - // private source code and other sensitive information. - GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) -} - -type dependenciesClient struct { - cc grpc.ClientConnInterface -} - -func NewDependenciesClient(cc grpc.ClientConnInterface) DependenciesClient { - return &dependenciesClient{cc} -} - -func (c *dependenciesClient) OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) { - out := new(OpenSourceBundle_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/OpenSourceBundle", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) { - out := new(CloseSourceBundle_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CloseSourceBundle", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) { - out := new(OpenDependencyLockFile_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/OpenDependencyLockFile", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) { - out := new(CreateDependencyLocks_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CreateDependencyLocks", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) { - out := new(CloseDependencyLocks_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CloseDependencyLocks", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) { - out := new(GetLockedProviderDependencies_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetLockedProviderDependencies", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) { - stream, err := c.cc.NewStream(ctx, &_Dependencies_serviceDesc.Streams[0], "/terraform1.dependencies.Dependencies/BuildProviderPluginCache", opts...) - if err != nil { - return nil, err - } - x := &dependenciesBuildProviderPluginCacheClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Dependencies_BuildProviderPluginCacheClient interface { - Recv() (*BuildProviderPluginCache_Event, error) - grpc.ClientStream -} - -type dependenciesBuildProviderPluginCacheClient struct { - grpc.ClientStream -} - -func (x *dependenciesBuildProviderPluginCacheClient) Recv() (*BuildProviderPluginCache_Event, error) { - m := new(BuildProviderPluginCache_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *dependenciesClient) OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) { - out := new(OpenProviderPluginCache_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/OpenProviderPluginCache", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) { - out := new(CloseProviderPluginCache_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CloseProviderPluginCache", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) { - out := new(GetCachedProviders_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetCachedProviders", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) { - out := new(GetBuiltInProviders_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetBuiltInProviders", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { - out := new(GetProviderSchema_Response) - err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetProviderSchema", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// DependenciesServer is the server API for Dependencies service. -type DependenciesServer interface { - // Opens a source bundle that was already extracted into the filesystem - // somewhere, returning an opaque source bundle handle that can be used for - // subsequent operations. - OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) - // Closes a previously-opened source bundle, invalidating the given handle - // and therefore making it safe to delete or modify the bundle directory - // on disk. - CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) - // Reads and parses an existing dependency lock file from the filesystem, - // returning a dependency locks handle. - // - // This function parses a user-provided source file, and so invalid content - // in that file is treated as diagnostics in a successful response rather - // than as an RPC error. Callers must check whether the dependency locks - // handle in the response is set (non-zero) before using it, and treat - // an unset handle as indicating a user error which is described in the - // accompanying diagnostics. Diagnostics can also be returned along with - // a valid handle, e.g. if there are non-blocking warning diagnostics. - OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) - // Creates an in-memory-only dependency locks handle with a fixed set of - // dependency selections provided as arguments. - CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) - CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) - // Returns information about the provider version selections in a - // dependency locks object. - GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) - // Populates a new provider plugin cache directory in the local filesystem - // based on the provider version selections in a given dependency locks - // object. - // - // This particular RPC can only install already-selected provider packages - // recorded in a dependency locks object; it does not support "upgrading" - // provider selections to newer versions as a CLI user would do with - // "terraform init -upgrade", because there would be no way to then - // commit the updated locks to disk as a lock file. - BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error - // Opens an existing local filesystem directory as a provider plugin cache - // directory, returning a plugin cache handle that can be used with other - // RPC operations. - OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) - CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) - // Returns information about the specific provider packages that are - // available in the given provider plugin cache. - GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) - // Returns information about the built-in providers that are compiled in - // to this Terraform Core server. - GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) - // Returns a description of the schema for a particular provider in a - // given provider plugin cache, or of a particular built-in provider - // known to this version of Terraform Core. - // - // WARNING: This operation requires executing the selected provider plugin, - // which therefore allows it to run arbitrary code as a child process of - // this Terraform Core server, with access to all of the same resources. - // This should typically be used only with providers explicitly selected - // in a dependency lock file, so users can control what external code - // has the potential to run in a context that probably has access to - // private source code and other sensitive information. - GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) -} - -// UnimplementedDependenciesServer can be embedded to have forward compatible implementations. -type UnimplementedDependenciesServer struct { -} - -func (*UnimplementedDependenciesServer) OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenSourceBundle not implemented") -} -func (*UnimplementedDependenciesServer) CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseSourceBundle not implemented") -} -func (*UnimplementedDependenciesServer) OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenDependencyLockFile not implemented") -} -func (*UnimplementedDependenciesServer) CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateDependencyLocks not implemented") -} -func (*UnimplementedDependenciesServer) CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseDependencyLocks not implemented") -} -func (*UnimplementedDependenciesServer) GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetLockedProviderDependencies not implemented") -} -func (*UnimplementedDependenciesServer) BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error { - return status.Errorf(codes.Unimplemented, "method BuildProviderPluginCache not implemented") -} -func (*UnimplementedDependenciesServer) OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenProviderPluginCache not implemented") -} -func (*UnimplementedDependenciesServer) CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseProviderPluginCache not implemented") -} -func (*UnimplementedDependenciesServer) GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCachedProviders not implemented") -} -func (*UnimplementedDependenciesServer) GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBuiltInProviders not implemented") -} -func (*UnimplementedDependenciesServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") -} - -func RegisterDependenciesServer(s *grpc.Server, srv DependenciesServer) { - s.RegisterService(&_Dependencies_serviceDesc, srv) -} - -func _Dependencies_OpenSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenSourceBundle_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).OpenSourceBundle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/OpenSourceBundle", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).OpenSourceBundle(ctx, req.(*OpenSourceBundle_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CloseSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseSourceBundle_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CloseSourceBundle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/CloseSourceBundle", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CloseSourceBundle(ctx, req.(*CloseSourceBundle_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_OpenDependencyLockFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenDependencyLockFile_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).OpenDependencyLockFile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/OpenDependencyLockFile", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).OpenDependencyLockFile(ctx, req.(*OpenDependencyLockFile_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CreateDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateDependencyLocks_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CreateDependencyLocks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/CreateDependencyLocks", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CreateDependencyLocks(ctx, req.(*CreateDependencyLocks_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CloseDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseDependencyLocks_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CloseDependencyLocks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/CloseDependencyLocks", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CloseDependencyLocks(ctx, req.(*CloseDependencyLocks_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetLockedProviderDependencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetLockedProviderDependencies_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/GetLockedProviderDependencies", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, req.(*GetLockedProviderDependencies_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_BuildProviderPluginCache_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(BuildProviderPluginCache_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DependenciesServer).BuildProviderPluginCache(m, &dependenciesBuildProviderPluginCacheServer{stream}) -} - -type Dependencies_BuildProviderPluginCacheServer interface { - Send(*BuildProviderPluginCache_Event) error - grpc.ServerStream -} - -type dependenciesBuildProviderPluginCacheServer struct { - grpc.ServerStream -} - -func (x *dependenciesBuildProviderPluginCacheServer) Send(m *BuildProviderPluginCache_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Dependencies_OpenProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenProviderPluginCache_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).OpenProviderPluginCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/OpenProviderPluginCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).OpenProviderPluginCache(ctx, req.(*OpenProviderPluginCache_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CloseProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseProviderPluginCache_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CloseProviderPluginCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/CloseProviderPluginCache", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CloseProviderPluginCache(ctx, req.(*CloseProviderPluginCache_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetCachedProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCachedProviders_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetCachedProviders(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/GetCachedProviders", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetCachedProviders(ctx, req.(*GetCachedProviders_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetBuiltInProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBuiltInProviders_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetBuiltInProviders(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/GetBuiltInProviders", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetBuiltInProviders(ctx, req.(*GetBuiltInProviders_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetProviderSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.dependencies.Dependencies/GetProviderSchema", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Dependencies_serviceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.dependencies.Dependencies", - HandlerType: (*DependenciesServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "OpenSourceBundle", - Handler: _Dependencies_OpenSourceBundle_Handler, - }, - { - MethodName: "CloseSourceBundle", - Handler: _Dependencies_CloseSourceBundle_Handler, - }, - { - MethodName: "OpenDependencyLockFile", - Handler: _Dependencies_OpenDependencyLockFile_Handler, - }, - { - MethodName: "CreateDependencyLocks", - Handler: _Dependencies_CreateDependencyLocks_Handler, - }, - { - MethodName: "CloseDependencyLocks", - Handler: _Dependencies_CloseDependencyLocks_Handler, - }, - { - MethodName: "GetLockedProviderDependencies", - Handler: _Dependencies_GetLockedProviderDependencies_Handler, - }, - { - MethodName: "OpenProviderPluginCache", - Handler: _Dependencies_OpenProviderPluginCache_Handler, - }, - { - MethodName: "CloseProviderPluginCache", - Handler: _Dependencies_CloseProviderPluginCache_Handler, - }, - { - MethodName: "GetCachedProviders", - Handler: _Dependencies_GetCachedProviders_Handler, - }, - { - MethodName: "GetBuiltInProviders", - Handler: _Dependencies_GetBuiltInProviders_Handler, - }, - { - MethodName: "GetProviderSchema", - Handler: _Dependencies_GetProviderSchema_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "BuildProviderPluginCache", - Handler: _Dependencies_BuildProviderPluginCache_Handler, - ServerStreams: true, - }, - }, - Metadata: "dependencies.proto", -} diff --git a/internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go b/internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go new file mode 100644 index 000000000000..66969f990301 --- /dev/null +++ b/internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go @@ -0,0 +1,639 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: dependencies.proto + +package dependencies + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Dependencies_OpenSourceBundle_FullMethodName = "/terraform1.dependencies.Dependencies/OpenSourceBundle" + Dependencies_CloseSourceBundle_FullMethodName = "/terraform1.dependencies.Dependencies/CloseSourceBundle" + Dependencies_OpenDependencyLockFile_FullMethodName = "/terraform1.dependencies.Dependencies/OpenDependencyLockFile" + Dependencies_CreateDependencyLocks_FullMethodName = "/terraform1.dependencies.Dependencies/CreateDependencyLocks" + Dependencies_CloseDependencyLocks_FullMethodName = "/terraform1.dependencies.Dependencies/CloseDependencyLocks" + Dependencies_GetLockedProviderDependencies_FullMethodName = "/terraform1.dependencies.Dependencies/GetLockedProviderDependencies" + Dependencies_BuildProviderPluginCache_FullMethodName = "/terraform1.dependencies.Dependencies/BuildProviderPluginCache" + Dependencies_OpenProviderPluginCache_FullMethodName = "/terraform1.dependencies.Dependencies/OpenProviderPluginCache" + Dependencies_CloseProviderPluginCache_FullMethodName = "/terraform1.dependencies.Dependencies/CloseProviderPluginCache" + Dependencies_GetCachedProviders_FullMethodName = "/terraform1.dependencies.Dependencies/GetCachedProviders" + Dependencies_GetBuiltInProviders_FullMethodName = "/terraform1.dependencies.Dependencies/GetBuiltInProviders" + Dependencies_GetProviderSchema_FullMethodName = "/terraform1.dependencies.Dependencies/GetProviderSchema" +) + +// DependenciesClient is the client API for Dependencies service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type DependenciesClient interface { + // Opens a source bundle that was already extracted into the filesystem + // somewhere, returning an opaque source bundle handle that can be used for + // subsequent operations. + OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) + // Closes a previously-opened source bundle, invalidating the given handle + // and therefore making it safe to delete or modify the bundle directory + // on disk. + CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) + // Reads and parses an existing dependency lock file from the filesystem, + // returning a dependency locks handle. + // + // This function parses a user-provided source file, and so invalid content + // in that file is treated as diagnostics in a successful response rather + // than as an RPC error. Callers must check whether the dependency locks + // handle in the response is set (non-zero) before using it, and treat + // an unset handle as indicating a user error which is described in the + // accompanying diagnostics. Diagnostics can also be returned along with + // a valid handle, e.g. if there are non-blocking warning diagnostics. + OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) + // Creates an in-memory-only dependency locks handle with a fixed set of + // dependency selections provided as arguments. + CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) + CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) + // Returns information about the provider version selections in a + // dependency locks object. + GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) + // Populates a new provider plugin cache directory in the local filesystem + // based on the provider version selections in a given dependency locks + // object. + // + // This particular RPC can only install already-selected provider packages + // recorded in a dependency locks object; it does not support "upgrading" + // provider selections to newer versions as a CLI user would do with + // "terraform init -upgrade", because there would be no way to then + // commit the updated locks to disk as a lock file. + BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) + // Opens an existing local filesystem directory as a provider plugin cache + // directory, returning a plugin cache handle that can be used with other + // RPC operations. + OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) + CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) + // Returns information about the specific provider packages that are + // available in the given provider plugin cache. + GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) + // Returns information about the built-in providers that are compiled in + // to this Terraform Core server. + GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) + // Returns a description of the schema for a particular provider in a + // given provider plugin cache, or of a particular built-in provider + // known to this version of Terraform Core. + // + // WARNING: This operation requires executing the selected provider plugin, + // which therefore allows it to run arbitrary code as a child process of + // this Terraform Core server, with access to all of the same resources. + // This should typically be used only with providers explicitly selected + // in a dependency lock file, so users can control what external code + // has the potential to run in a context that probably has access to + // private source code and other sensitive information. + GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) +} + +type dependenciesClient struct { + cc grpc.ClientConnInterface +} + +func NewDependenciesClient(cc grpc.ClientConnInterface) DependenciesClient { + return &dependenciesClient{cc} +} + +func (c *dependenciesClient) OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) { + out := new(OpenSourceBundle_Response) + err := c.cc.Invoke(ctx, Dependencies_OpenSourceBundle_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) { + out := new(CloseSourceBundle_Response) + err := c.cc.Invoke(ctx, Dependencies_CloseSourceBundle_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) { + out := new(OpenDependencyLockFile_Response) + err := c.cc.Invoke(ctx, Dependencies_OpenDependencyLockFile_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) { + out := new(CreateDependencyLocks_Response) + err := c.cc.Invoke(ctx, Dependencies_CreateDependencyLocks_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) { + out := new(CloseDependencyLocks_Response) + err := c.cc.Invoke(ctx, Dependencies_CloseDependencyLocks_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) { + out := new(GetLockedProviderDependencies_Response) + err := c.cc.Invoke(ctx, Dependencies_GetLockedProviderDependencies_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) { + stream, err := c.cc.NewStream(ctx, &Dependencies_ServiceDesc.Streams[0], Dependencies_BuildProviderPluginCache_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &dependenciesBuildProviderPluginCacheClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Dependencies_BuildProviderPluginCacheClient interface { + Recv() (*BuildProviderPluginCache_Event, error) + grpc.ClientStream +} + +type dependenciesBuildProviderPluginCacheClient struct { + grpc.ClientStream +} + +func (x *dependenciesBuildProviderPluginCacheClient) Recv() (*BuildProviderPluginCache_Event, error) { + m := new(BuildProviderPluginCache_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *dependenciesClient) OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) { + out := new(OpenProviderPluginCache_Response) + err := c.cc.Invoke(ctx, Dependencies_OpenProviderPluginCache_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) { + out := new(CloseProviderPluginCache_Response) + err := c.cc.Invoke(ctx, Dependencies_CloseProviderPluginCache_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) { + out := new(GetCachedProviders_Response) + err := c.cc.Invoke(ctx, Dependencies_GetCachedProviders_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) { + out := new(GetBuiltInProviders_Response) + err := c.cc.Invoke(ctx, Dependencies_GetBuiltInProviders_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { + out := new(GetProviderSchema_Response) + err := c.cc.Invoke(ctx, Dependencies_GetProviderSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DependenciesServer is the server API for Dependencies service. +// All implementations should embed UnimplementedDependenciesServer +// for forward compatibility +type DependenciesServer interface { + // Opens a source bundle that was already extracted into the filesystem + // somewhere, returning an opaque source bundle handle that can be used for + // subsequent operations. + OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) + // Closes a previously-opened source bundle, invalidating the given handle + // and therefore making it safe to delete or modify the bundle directory + // on disk. + CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) + // Reads and parses an existing dependency lock file from the filesystem, + // returning a dependency locks handle. + // + // This function parses a user-provided source file, and so invalid content + // in that file is treated as diagnostics in a successful response rather + // than as an RPC error. Callers must check whether the dependency locks + // handle in the response is set (non-zero) before using it, and treat + // an unset handle as indicating a user error which is described in the + // accompanying diagnostics. Diagnostics can also be returned along with + // a valid handle, e.g. if there are non-blocking warning diagnostics. + OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) + // Creates an in-memory-only dependency locks handle with a fixed set of + // dependency selections provided as arguments. + CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) + CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) + // Returns information about the provider version selections in a + // dependency locks object. + GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) + // Populates a new provider plugin cache directory in the local filesystem + // based on the provider version selections in a given dependency locks + // object. + // + // This particular RPC can only install already-selected provider packages + // recorded in a dependency locks object; it does not support "upgrading" + // provider selections to newer versions as a CLI user would do with + // "terraform init -upgrade", because there would be no way to then + // commit the updated locks to disk as a lock file. + BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error + // Opens an existing local filesystem directory as a provider plugin cache + // directory, returning a plugin cache handle that can be used with other + // RPC operations. + OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) + CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) + // Returns information about the specific provider packages that are + // available in the given provider plugin cache. + GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) + // Returns information about the built-in providers that are compiled in + // to this Terraform Core server. + GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) + // Returns a description of the schema for a particular provider in a + // given provider plugin cache, or of a particular built-in provider + // known to this version of Terraform Core. + // + // WARNING: This operation requires executing the selected provider plugin, + // which therefore allows it to run arbitrary code as a child process of + // this Terraform Core server, with access to all of the same resources. + // This should typically be used only with providers explicitly selected + // in a dependency lock file, so users can control what external code + // has the potential to run in a context that probably has access to + // private source code and other sensitive information. + GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) +} + +// UnimplementedDependenciesServer should be embedded to have forward compatible implementations. +type UnimplementedDependenciesServer struct { +} + +func (UnimplementedDependenciesServer) OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenSourceBundle not implemented") +} +func (UnimplementedDependenciesServer) CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseSourceBundle not implemented") +} +func (UnimplementedDependenciesServer) OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenDependencyLockFile not implemented") +} +func (UnimplementedDependenciesServer) CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDependencyLocks not implemented") +} +func (UnimplementedDependenciesServer) CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseDependencyLocks not implemented") +} +func (UnimplementedDependenciesServer) GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLockedProviderDependencies not implemented") +} +func (UnimplementedDependenciesServer) BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error { + return status.Errorf(codes.Unimplemented, "method BuildProviderPluginCache not implemented") +} +func (UnimplementedDependenciesServer) OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenProviderPluginCache not implemented") +} +func (UnimplementedDependenciesServer) CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseProviderPluginCache not implemented") +} +func (UnimplementedDependenciesServer) GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCachedProviders not implemented") +} +func (UnimplementedDependenciesServer) GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBuiltInProviders not implemented") +} +func (UnimplementedDependenciesServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") +} + +// UnsafeDependenciesServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DependenciesServer will +// result in compilation errors. +type UnsafeDependenciesServer interface { + mustEmbedUnimplementedDependenciesServer() +} + +func RegisterDependenciesServer(s grpc.ServiceRegistrar, srv DependenciesServer) { + s.RegisterService(&Dependencies_ServiceDesc, srv) +} + +func _Dependencies_OpenSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenSourceBundle_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).OpenSourceBundle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_OpenSourceBundle_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).OpenSourceBundle(ctx, req.(*OpenSourceBundle_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CloseSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseSourceBundle_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CloseSourceBundle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_CloseSourceBundle_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CloseSourceBundle(ctx, req.(*CloseSourceBundle_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_OpenDependencyLockFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenDependencyLockFile_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).OpenDependencyLockFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_OpenDependencyLockFile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).OpenDependencyLockFile(ctx, req.(*OpenDependencyLockFile_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CreateDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateDependencyLocks_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CreateDependencyLocks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_CreateDependencyLocks_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CreateDependencyLocks(ctx, req.(*CreateDependencyLocks_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CloseDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseDependencyLocks_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CloseDependencyLocks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_CloseDependencyLocks_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CloseDependencyLocks(ctx, req.(*CloseDependencyLocks_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetLockedProviderDependencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLockedProviderDependencies_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_GetLockedProviderDependencies_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, req.(*GetLockedProviderDependencies_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_BuildProviderPluginCache_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(BuildProviderPluginCache_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DependenciesServer).BuildProviderPluginCache(m, &dependenciesBuildProviderPluginCacheServer{stream}) +} + +type Dependencies_BuildProviderPluginCacheServer interface { + Send(*BuildProviderPluginCache_Event) error + grpc.ServerStream +} + +type dependenciesBuildProviderPluginCacheServer struct { + grpc.ServerStream +} + +func (x *dependenciesBuildProviderPluginCacheServer) Send(m *BuildProviderPluginCache_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Dependencies_OpenProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenProviderPluginCache_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).OpenProviderPluginCache(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_OpenProviderPluginCache_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).OpenProviderPluginCache(ctx, req.(*OpenProviderPluginCache_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CloseProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseProviderPluginCache_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CloseProviderPluginCache(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_CloseProviderPluginCache_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CloseProviderPluginCache(ctx, req.(*CloseProviderPluginCache_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetCachedProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCachedProviders_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetCachedProviders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_GetCachedProviders_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetCachedProviders(ctx, req.(*GetCachedProviders_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetBuiltInProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBuiltInProviders_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetBuiltInProviders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_GetBuiltInProviders_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetBuiltInProviders(ctx, req.(*GetBuiltInProviders_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetProviderSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Dependencies_GetProviderSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +// Dependencies_ServiceDesc is the grpc.ServiceDesc for Dependencies service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Dependencies_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.dependencies.Dependencies", + HandlerType: (*DependenciesServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "OpenSourceBundle", + Handler: _Dependencies_OpenSourceBundle_Handler, + }, + { + MethodName: "CloseSourceBundle", + Handler: _Dependencies_CloseSourceBundle_Handler, + }, + { + MethodName: "OpenDependencyLockFile", + Handler: _Dependencies_OpenDependencyLockFile_Handler, + }, + { + MethodName: "CreateDependencyLocks", + Handler: _Dependencies_CreateDependencyLocks_Handler, + }, + { + MethodName: "CloseDependencyLocks", + Handler: _Dependencies_CloseDependencyLocks_Handler, + }, + { + MethodName: "GetLockedProviderDependencies", + Handler: _Dependencies_GetLockedProviderDependencies_Handler, + }, + { + MethodName: "OpenProviderPluginCache", + Handler: _Dependencies_OpenProviderPluginCache_Handler, + }, + { + MethodName: "CloseProviderPluginCache", + Handler: _Dependencies_CloseProviderPluginCache_Handler, + }, + { + MethodName: "GetCachedProviders", + Handler: _Dependencies_GetCachedProviders_Handler, + }, + { + MethodName: "GetBuiltInProviders", + Handler: _Dependencies_GetBuiltInProviders_Handler, + }, + { + MethodName: "GetProviderSchema", + Handler: _Dependencies_GetProviderSchema_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "BuildProviderPluginCache", + Handler: _Dependencies_BuildProviderPluginCache_Handler, + ServerStreams: true, + }, + }, + Metadata: "dependencies.proto", +} diff --git a/internal/rpcapi/terraform1/packages/packages.pb.go b/internal/rpcapi/terraform1/packages/packages.pb.go index 717afb662e4b..fcd3720550b6 100644 --- a/internal/rpcapi/terraform1/packages/packages.pb.go +++ b/internal/rpcapi/terraform1/packages/packages.pb.go @@ -10,11 +10,7 @@ package packages import ( - context "context" terraform1 "github.com/hashicorp/terraform/internal/rpcapi/terraform1" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -922,227 +918,3 @@ func file_packages_proto_init() { file_packages_proto_goTypes = nil file_packages_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// PackagesClient is the client API for Packages service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type PackagesClient interface { - ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) - FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) - ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) - ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) - FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) -} - -type packagesClient struct { - cc grpc.ClientConnInterface -} - -func NewPackagesClient(cc grpc.ClientConnInterface) PackagesClient { - return &packagesClient{cc} -} - -func (c *packagesClient) ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) { - out := new(ProviderPackageVersions_Response) - err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/ProviderPackageVersions", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) { - out := new(FetchProviderPackage_Response) - err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/FetchProviderPackage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) { - out := new(ModulePackageVersions_Response) - err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/ModulePackageVersions", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) { - out := new(ModulePackageSourceAddr_Response) - err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/ModulePackageSourceAddr", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) { - out := new(FetchModulePackage_Response) - err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/FetchModulePackage", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PackagesServer is the server API for Packages service. -type PackagesServer interface { - ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) - FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) - ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) - ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) - FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) -} - -// UnimplementedPackagesServer can be embedded to have forward compatible implementations. -type UnimplementedPackagesServer struct { -} - -func (*UnimplementedPackagesServer) ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ProviderPackageVersions not implemented") -} -func (*UnimplementedPackagesServer) FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchProviderPackage not implemented") -} -func (*UnimplementedPackagesServer) ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ModulePackageVersions not implemented") -} -func (*UnimplementedPackagesServer) ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ModulePackageSourceAddr not implemented") -} -func (*UnimplementedPackagesServer) FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchModulePackage not implemented") -} - -func RegisterPackagesServer(s *grpc.Server, srv PackagesServer) { - s.RegisterService(&_Packages_serviceDesc, srv) -} - -func _Packages_ProviderPackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ProviderPackageVersions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).ProviderPackageVersions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.packages.Packages/ProviderPackageVersions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).ProviderPackageVersions(ctx, req.(*ProviderPackageVersions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_FetchProviderPackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchProviderPackage_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).FetchProviderPackage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.packages.Packages/FetchProviderPackage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).FetchProviderPackage(ctx, req.(*FetchProviderPackage_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_ModulePackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ModulePackageVersions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).ModulePackageVersions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.packages.Packages/ModulePackageVersions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).ModulePackageVersions(ctx, req.(*ModulePackageVersions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_ModulePackageSourceAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ModulePackageSourceAddr_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).ModulePackageSourceAddr(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.packages.Packages/ModulePackageSourceAddr", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).ModulePackageSourceAddr(ctx, req.(*ModulePackageSourceAddr_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_FetchModulePackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchModulePackage_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).FetchModulePackage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.packages.Packages/FetchModulePackage", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).FetchModulePackage(ctx, req.(*FetchModulePackage_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Packages_serviceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.packages.Packages", - HandlerType: (*PackagesServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ProviderPackageVersions", - Handler: _Packages_ProviderPackageVersions_Handler, - }, - { - MethodName: "FetchProviderPackage", - Handler: _Packages_FetchProviderPackage_Handler, - }, - { - MethodName: "ModulePackageVersions", - Handler: _Packages_ModulePackageVersions_Handler, - }, - { - MethodName: "ModulePackageSourceAddr", - Handler: _Packages_ModulePackageSourceAddr_Handler, - }, - { - MethodName: "FetchModulePackage", - Handler: _Packages_FetchModulePackage_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "packages.proto", -} diff --git a/internal/rpcapi/terraform1/packages/packages_grpc.pb.go b/internal/rpcapi/terraform1/packages/packages_grpc.pb.go new file mode 100644 index 000000000000..0842a384df59 --- /dev/null +++ b/internal/rpcapi/terraform1/packages/packages_grpc.pb.go @@ -0,0 +1,258 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: packages.proto + +package packages + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Packages_ProviderPackageVersions_FullMethodName = "/terraform1.packages.Packages/ProviderPackageVersions" + Packages_FetchProviderPackage_FullMethodName = "/terraform1.packages.Packages/FetchProviderPackage" + Packages_ModulePackageVersions_FullMethodName = "/terraform1.packages.Packages/ModulePackageVersions" + Packages_ModulePackageSourceAddr_FullMethodName = "/terraform1.packages.Packages/ModulePackageSourceAddr" + Packages_FetchModulePackage_FullMethodName = "/terraform1.packages.Packages/FetchModulePackage" +) + +// PackagesClient is the client API for Packages service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PackagesClient interface { + ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) + FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) + ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) + ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) + FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) +} + +type packagesClient struct { + cc grpc.ClientConnInterface +} + +func NewPackagesClient(cc grpc.ClientConnInterface) PackagesClient { + return &packagesClient{cc} +} + +func (c *packagesClient) ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) { + out := new(ProviderPackageVersions_Response) + err := c.cc.Invoke(ctx, Packages_ProviderPackageVersions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) { + out := new(FetchProviderPackage_Response) + err := c.cc.Invoke(ctx, Packages_FetchProviderPackage_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) { + out := new(ModulePackageVersions_Response) + err := c.cc.Invoke(ctx, Packages_ModulePackageVersions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) { + out := new(ModulePackageSourceAddr_Response) + err := c.cc.Invoke(ctx, Packages_ModulePackageSourceAddr_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) { + out := new(FetchModulePackage_Response) + err := c.cc.Invoke(ctx, Packages_FetchModulePackage_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PackagesServer is the server API for Packages service. +// All implementations should embed UnimplementedPackagesServer +// for forward compatibility +type PackagesServer interface { + ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) + FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) + ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) + ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) + FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) +} + +// UnimplementedPackagesServer should be embedded to have forward compatible implementations. +type UnimplementedPackagesServer struct { +} + +func (UnimplementedPackagesServer) ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProviderPackageVersions not implemented") +} +func (UnimplementedPackagesServer) FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchProviderPackage not implemented") +} +func (UnimplementedPackagesServer) ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModulePackageVersions not implemented") +} +func (UnimplementedPackagesServer) ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModulePackageSourceAddr not implemented") +} +func (UnimplementedPackagesServer) FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchModulePackage not implemented") +} + +// UnsafePackagesServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PackagesServer will +// result in compilation errors. +type UnsafePackagesServer interface { + mustEmbedUnimplementedPackagesServer() +} + +func RegisterPackagesServer(s grpc.ServiceRegistrar, srv PackagesServer) { + s.RegisterService(&Packages_ServiceDesc, srv) +} + +func _Packages_ProviderPackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ProviderPackageVersions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).ProviderPackageVersions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Packages_ProviderPackageVersions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).ProviderPackageVersions(ctx, req.(*ProviderPackageVersions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_FetchProviderPackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchProviderPackage_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).FetchProviderPackage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Packages_FetchProviderPackage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).FetchProviderPackage(ctx, req.(*FetchProviderPackage_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_ModulePackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ModulePackageVersions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).ModulePackageVersions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Packages_ModulePackageVersions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).ModulePackageVersions(ctx, req.(*ModulePackageVersions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_ModulePackageSourceAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ModulePackageSourceAddr_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).ModulePackageSourceAddr(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Packages_ModulePackageSourceAddr_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).ModulePackageSourceAddr(ctx, req.(*ModulePackageSourceAddr_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_FetchModulePackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchModulePackage_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).FetchModulePackage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Packages_FetchModulePackage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).FetchModulePackage(ctx, req.(*FetchModulePackage_Request)) + } + return interceptor(ctx, in, info, handler) +} + +// Packages_ServiceDesc is the grpc.ServiceDesc for Packages service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Packages_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.packages.Packages", + HandlerType: (*PackagesServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ProviderPackageVersions", + Handler: _Packages_ProviderPackageVersions_Handler, + }, + { + MethodName: "FetchProviderPackage", + Handler: _Packages_FetchProviderPackage_Handler, + }, + { + MethodName: "ModulePackageVersions", + Handler: _Packages_ModulePackageVersions_Handler, + }, + { + MethodName: "ModulePackageSourceAddr", + Handler: _Packages_ModulePackageSourceAddr_Handler, + }, + { + MethodName: "FetchModulePackage", + Handler: _Packages_FetchModulePackage_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "packages.proto", +} diff --git a/internal/rpcapi/terraform1/setup/setup.pb.go b/internal/rpcapi/terraform1/setup/setup.pb.go index 03a2d115f36f..0500aa9f42e3 100644 --- a/internal/rpcapi/terraform1/setup/setup.pb.go +++ b/internal/rpcapi/terraform1/setup/setup.pb.go @@ -10,10 +10,6 @@ package setup import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -529,133 +525,3 @@ func file_setup_proto_init() { file_setup_proto_goTypes = nil file_setup_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// SetupClient is the client API for Setup service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type SetupClient interface { - // Clients must call Handshake before any other function of any other - // service, to complete the capability negotiation step that may - // then affect the behaviors of subsequent operations. - // - // This function can be called only once per RPC server. - Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) - // At any time after handshaking, clients may call Stop to initiate a - // graceful shutdown of the server. - Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) -} - -type setupClient struct { - cc grpc.ClientConnInterface -} - -func NewSetupClient(cc grpc.ClientConnInterface) SetupClient { - return &setupClient{cc} -} - -func (c *setupClient) Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) { - out := new(Handshake_Response) - err := c.cc.Invoke(ctx, "/terraform1.setup.Setup/Handshake", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *setupClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { - out := new(Stop_Response) - err := c.cc.Invoke(ctx, "/terraform1.setup.Setup/Stop", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SetupServer is the server API for Setup service. -type SetupServer interface { - // Clients must call Handshake before any other function of any other - // service, to complete the capability negotiation step that may - // then affect the behaviors of subsequent operations. - // - // This function can be called only once per RPC server. - Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) - // At any time after handshaking, clients may call Stop to initiate a - // graceful shutdown of the server. - Stop(context.Context, *Stop_Request) (*Stop_Response, error) -} - -// UnimplementedSetupServer can be embedded to have forward compatible implementations. -type UnimplementedSetupServer struct { -} - -func (*UnimplementedSetupServer) Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Handshake not implemented") -} -func (*UnimplementedSetupServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") -} - -func RegisterSetupServer(s *grpc.Server, srv SetupServer) { - s.RegisterService(&_Setup_serviceDesc, srv) -} - -func _Setup_Handshake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Handshake_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SetupServer).Handshake(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.setup.Setup/Handshake", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SetupServer).Handshake(ctx, req.(*Handshake_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Setup_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Stop_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SetupServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.setup.Setup/Stop", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SetupServer).Stop(ctx, req.(*Stop_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Setup_serviceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.setup.Setup", - HandlerType: (*SetupServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Handshake", - Handler: _Setup_Handshake_Handler, - }, - { - MethodName: "Stop", - Handler: _Setup_Stop_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "setup.proto", -} diff --git a/internal/rpcapi/terraform1/setup/setup_grpc.pb.go b/internal/rpcapi/terraform1/setup/setup_grpc.pb.go new file mode 100644 index 000000000000..e290d6056df7 --- /dev/null +++ b/internal/rpcapi/terraform1/setup/setup_grpc.pb.go @@ -0,0 +1,161 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: setup.proto + +package setup + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Setup_Handshake_FullMethodName = "/terraform1.setup.Setup/Handshake" + Setup_Stop_FullMethodName = "/terraform1.setup.Setup/Stop" +) + +// SetupClient is the client API for Setup service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SetupClient interface { + // Clients must call Handshake before any other function of any other + // service, to complete the capability negotiation step that may + // then affect the behaviors of subsequent operations. + // + // This function can be called only once per RPC server. + Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) + // At any time after handshaking, clients may call Stop to initiate a + // graceful shutdown of the server. + Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) +} + +type setupClient struct { + cc grpc.ClientConnInterface +} + +func NewSetupClient(cc grpc.ClientConnInterface) SetupClient { + return &setupClient{cc} +} + +func (c *setupClient) Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) { + out := new(Handshake_Response) + err := c.cc.Invoke(ctx, Setup_Handshake_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *setupClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { + out := new(Stop_Response) + err := c.cc.Invoke(ctx, Setup_Stop_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SetupServer is the server API for Setup service. +// All implementations should embed UnimplementedSetupServer +// for forward compatibility +type SetupServer interface { + // Clients must call Handshake before any other function of any other + // service, to complete the capability negotiation step that may + // then affect the behaviors of subsequent operations. + // + // This function can be called only once per RPC server. + Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) + // At any time after handshaking, clients may call Stop to initiate a + // graceful shutdown of the server. + Stop(context.Context, *Stop_Request) (*Stop_Response, error) +} + +// UnimplementedSetupServer should be embedded to have forward compatible implementations. +type UnimplementedSetupServer struct { +} + +func (UnimplementedSetupServer) Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Handshake not implemented") +} +func (UnimplementedSetupServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + +// UnsafeSetupServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SetupServer will +// result in compilation errors. +type UnsafeSetupServer interface { + mustEmbedUnimplementedSetupServer() +} + +func RegisterSetupServer(s grpc.ServiceRegistrar, srv SetupServer) { + s.RegisterService(&Setup_ServiceDesc, srv) +} + +func _Setup_Handshake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Handshake_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SetupServer).Handshake(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Setup_Handshake_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SetupServer).Handshake(ctx, req.(*Handshake_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Setup_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Stop_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SetupServer).Stop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Setup_Stop_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SetupServer).Stop(ctx, req.(*Stop_Request)) + } + return interceptor(ctx, in, info, handler) +} + +// Setup_ServiceDesc is the grpc.ServiceDesc for Setup service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Setup_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.setup.Setup", + HandlerType: (*SetupServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Handshake", + Handler: _Setup_Handshake_Handler, + }, + { + MethodName: "Stop", + Handler: _Setup_Stop_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "setup.proto", +} diff --git a/internal/rpcapi/terraform1/stacks/stacks.pb.go b/internal/rpcapi/terraform1/stacks/stacks.pb.go index 3293d9def244..8ec49f6ace16 100644 --- a/internal/rpcapi/terraform1/stacks/stacks.pb.go +++ b/internal/rpcapi/terraform1/stacks/stacks.pb.go @@ -10,11 +10,7 @@ package stacks import ( - context "context" terraform1 "github.com/hashicorp/terraform/internal/rpcapi/terraform1" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" @@ -7230,831 +7226,3 @@ func file_stacks_proto_init() { file_stacks_proto_goTypes = nil file_stacks_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// StacksClient is the client API for Stacks service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type StacksClient interface { - // Load and perform initial static validation of a stack configuration - // in a previously-opened source bundle. If successful, returns a - // stack configuration handle that can be used with other operations. - OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) - // Close a previously-opened stack configuration using its handle. - CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) - // Validate an open stack configuration. - ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) - // Analyze a stack configuration to find all of the components it declares. - // This is static analysis only, so it cannot produce dynamic information - // such as the number of instances of each component. - FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) - // Load a stack state by sending a stream of raw state objects that were - // streamed from a previous ApplyStackChanges response. - OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) - // Close a stack state handle, discarding the associated state. - CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) - // Calculate a desired state from the given configuration and compare it - // with the current state to propose a set of changes to converge the - // current state with the desired state, at least in part. - PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) - // Load a previously-created plan by sending a stream of raw change objects - // that were streamed from a previous PlanStackChanges response. - OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) - // Close a saved plan handle, discarding the associated saved plan. - ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) - // Execute the changes proposed by an earlier call to PlanStackChanges. - ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) - // OpenStackInspector creates a stack inspector handle that can be used - // with subsequent calls to the "Inspect"-prefixed functions. - OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) - // InspectExpressionResult evaluates an arbitrary expression in the context - // of a stack inspector handle. - InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) - // Open a previously-saved Terraform state, returning a handle that can be - // used with other operations. This is distinct from OpenState because it - // means core state rather than stack state. - OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) - // Close a previously-opened Terraform state using its handle. - CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) - // MigrateTerraformState migrates a Terraform state into Stacks state using - // a mapping of addresses. - MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) - // ListResourceIdentities lists the identities of all resources in a stack. - ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) -} - -type stacksClient struct { - cc grpc.ClientConnInterface -} - -func NewStacksClient(cc grpc.ClientConnInterface) StacksClient { - return &stacksClient{cc} -} - -func (c *stacksClient) OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) { - out := new(OpenStackConfiguration_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/OpenStackConfiguration", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) { - out := new(CloseStackConfiguration_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/CloseStackConfiguration", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) { - out := new(ValidateStackConfiguration_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/ValidateStackConfiguration", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) { - out := new(FindStackConfigurationComponents_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/FindStackConfigurationComponents", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) { - stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[0], "/terraform1.stacks.Stacks/OpenState", opts...) - if err != nil { - return nil, err - } - x := &stacksOpenStateClient{stream} - return x, nil -} - -type Stacks_OpenStateClient interface { - Send(*OpenStackState_RequestItem) error - CloseAndRecv() (*OpenStackState_Response, error) - grpc.ClientStream -} - -type stacksOpenStateClient struct { - grpc.ClientStream -} - -func (x *stacksOpenStateClient) Send(m *OpenStackState_RequestItem) error { - return x.ClientStream.SendMsg(m) -} - -func (x *stacksOpenStateClient) CloseAndRecv() (*OpenStackState_Response, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(OpenStackState_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) { - out := new(CloseStackState_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/CloseState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[1], "/terraform1.stacks.Stacks/PlanStackChanges", opts...) - if err != nil { - return nil, err - } - x := &stacksPlanStackChangesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Stacks_PlanStackChangesClient interface { - Recv() (*PlanStackChanges_Event, error) - grpc.ClientStream -} - -type stacksPlanStackChangesClient struct { - grpc.ClientStream -} - -func (x *stacksPlanStackChangesClient) Recv() (*PlanStackChanges_Event, error) { - m := new(PlanStackChanges_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) { - stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[2], "/terraform1.stacks.Stacks/OpenPlan", opts...) - if err != nil { - return nil, err - } - x := &stacksOpenPlanClient{stream} - return x, nil -} - -type Stacks_OpenPlanClient interface { - Send(*OpenStackPlan_RequestItem) error - CloseAndRecv() (*OpenStackPlan_Response, error) - grpc.ClientStream -} - -type stacksOpenPlanClient struct { - grpc.ClientStream -} - -func (x *stacksOpenPlanClient) Send(m *OpenStackPlan_RequestItem) error { - return x.ClientStream.SendMsg(m) -} - -func (x *stacksOpenPlanClient) CloseAndRecv() (*OpenStackPlan_Response, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(OpenStackPlan_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) { - out := new(CloseStackPlan_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/ClosePlan", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[3], "/terraform1.stacks.Stacks/ApplyStackChanges", opts...) - if err != nil { - return nil, err - } - x := &stacksApplyStackChangesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Stacks_ApplyStackChangesClient interface { - Recv() (*ApplyStackChanges_Event, error) - grpc.ClientStream -} - -type stacksApplyStackChangesClient struct { - grpc.ClientStream -} - -func (x *stacksApplyStackChangesClient) Recv() (*ApplyStackChanges_Event, error) { - m := new(ApplyStackChanges_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) { - out := new(OpenStackInspector_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/OpenStackInspector", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) { - out := new(InspectExpressionResult_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/InspectExpressionResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) { - out := new(OpenTerraformState_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/OpenTerraformState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) { - out := new(CloseTerraformState_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/CloseTerraformState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) { - stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[4], "/terraform1.stacks.Stacks/MigrateTerraformState", opts...) - if err != nil { - return nil, err - } - x := &stacksMigrateTerraformStateClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Stacks_MigrateTerraformStateClient interface { - Recv() (*MigrateTerraformState_Event, error) - grpc.ClientStream -} - -type stacksMigrateTerraformStateClient struct { - grpc.ClientStream -} - -func (x *stacksMigrateTerraformStateClient) Recv() (*MigrateTerraformState_Event, error) { - m := new(MigrateTerraformState_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) { - out := new(ListResourceIdentities_Response) - err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/ListResourceIdentities", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// StacksServer is the server API for Stacks service. -type StacksServer interface { - // Load and perform initial static validation of a stack configuration - // in a previously-opened source bundle. If successful, returns a - // stack configuration handle that can be used with other operations. - OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) - // Close a previously-opened stack configuration using its handle. - CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) - // Validate an open stack configuration. - ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) - // Analyze a stack configuration to find all of the components it declares. - // This is static analysis only, so it cannot produce dynamic information - // such as the number of instances of each component. - FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) - // Load a stack state by sending a stream of raw state objects that were - // streamed from a previous ApplyStackChanges response. - OpenState(Stacks_OpenStateServer) error - // Close a stack state handle, discarding the associated state. - CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) - // Calculate a desired state from the given configuration and compare it - // with the current state to propose a set of changes to converge the - // current state with the desired state, at least in part. - PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error - // Load a previously-created plan by sending a stream of raw change objects - // that were streamed from a previous PlanStackChanges response. - OpenPlan(Stacks_OpenPlanServer) error - // Close a saved plan handle, discarding the associated saved plan. - ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) - // Execute the changes proposed by an earlier call to PlanStackChanges. - ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error - // OpenStackInspector creates a stack inspector handle that can be used - // with subsequent calls to the "Inspect"-prefixed functions. - OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) - // InspectExpressionResult evaluates an arbitrary expression in the context - // of a stack inspector handle. - InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) - // Open a previously-saved Terraform state, returning a handle that can be - // used with other operations. This is distinct from OpenState because it - // means core state rather than stack state. - OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) - // Close a previously-opened Terraform state using its handle. - CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) - // MigrateTerraformState migrates a Terraform state into Stacks state using - // a mapping of addresses. - MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error - // ListResourceIdentities lists the identities of all resources in a stack. - ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) -} - -// UnimplementedStacksServer can be embedded to have forward compatible implementations. -type UnimplementedStacksServer struct { -} - -func (*UnimplementedStacksServer) OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenStackConfiguration not implemented") -} -func (*UnimplementedStacksServer) CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseStackConfiguration not implemented") -} -func (*UnimplementedStacksServer) ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateStackConfiguration not implemented") -} -func (*UnimplementedStacksServer) FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method FindStackConfigurationComponents not implemented") -} -func (*UnimplementedStacksServer) OpenState(Stacks_OpenStateServer) error { - return status.Errorf(codes.Unimplemented, "method OpenState not implemented") -} -func (*UnimplementedStacksServer) CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseState not implemented") -} -func (*UnimplementedStacksServer) PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error { - return status.Errorf(codes.Unimplemented, "method PlanStackChanges not implemented") -} -func (*UnimplementedStacksServer) OpenPlan(Stacks_OpenPlanServer) error { - return status.Errorf(codes.Unimplemented, "method OpenPlan not implemented") -} -func (*UnimplementedStacksServer) ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClosePlan not implemented") -} -func (*UnimplementedStacksServer) ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error { - return status.Errorf(codes.Unimplemented, "method ApplyStackChanges not implemented") -} -func (*UnimplementedStacksServer) OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenStackInspector not implemented") -} -func (*UnimplementedStacksServer) InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method InspectExpressionResult not implemented") -} -func (*UnimplementedStacksServer) OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenTerraformState not implemented") -} -func (*UnimplementedStacksServer) CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseTerraformState not implemented") -} -func (*UnimplementedStacksServer) MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error { - return status.Errorf(codes.Unimplemented, "method MigrateTerraformState not implemented") -} -func (*UnimplementedStacksServer) ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListResourceIdentities not implemented") -} - -func RegisterStacksServer(s *grpc.Server, srv StacksServer) { - s.RegisterService(&_Stacks_serviceDesc, srv) -} - -func _Stacks_OpenStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenStackConfiguration_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).OpenStackConfiguration(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/OpenStackConfiguration", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).OpenStackConfiguration(ctx, req.(*OpenStackConfiguration_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_CloseStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStackConfiguration_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).CloseStackConfiguration(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/CloseStackConfiguration", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).CloseStackConfiguration(ctx, req.(*CloseStackConfiguration_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_ValidateStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateStackConfiguration_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).ValidateStackConfiguration(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/ValidateStackConfiguration", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).ValidateStackConfiguration(ctx, req.(*ValidateStackConfiguration_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_FindStackConfigurationComponents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FindStackConfigurationComponents_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).FindStackConfigurationComponents(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/FindStackConfigurationComponents", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).FindStackConfigurationComponents(ctx, req.(*FindStackConfigurationComponents_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_OpenState_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(StacksServer).OpenState(&stacksOpenStateServer{stream}) -} - -type Stacks_OpenStateServer interface { - SendAndClose(*OpenStackState_Response) error - Recv() (*OpenStackState_RequestItem, error) - grpc.ServerStream -} - -type stacksOpenStateServer struct { - grpc.ServerStream -} - -func (x *stacksOpenStateServer) SendAndClose(m *OpenStackState_Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *stacksOpenStateServer) Recv() (*OpenStackState_RequestItem, error) { - m := new(OpenStackState_RequestItem) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Stacks_CloseState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStackState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).CloseState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/CloseState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).CloseState(ctx, req.(*CloseStackState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_PlanStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(PlanStackChanges_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(StacksServer).PlanStackChanges(m, &stacksPlanStackChangesServer{stream}) -} - -type Stacks_PlanStackChangesServer interface { - Send(*PlanStackChanges_Event) error - grpc.ServerStream -} - -type stacksPlanStackChangesServer struct { - grpc.ServerStream -} - -func (x *stacksPlanStackChangesServer) Send(m *PlanStackChanges_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Stacks_OpenPlan_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(StacksServer).OpenPlan(&stacksOpenPlanServer{stream}) -} - -type Stacks_OpenPlanServer interface { - SendAndClose(*OpenStackPlan_Response) error - Recv() (*OpenStackPlan_RequestItem, error) - grpc.ServerStream -} - -type stacksOpenPlanServer struct { - grpc.ServerStream -} - -func (x *stacksOpenPlanServer) SendAndClose(m *OpenStackPlan_Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *stacksOpenPlanServer) Recv() (*OpenStackPlan_RequestItem, error) { - m := new(OpenStackPlan_RequestItem) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Stacks_ClosePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStackPlan_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).ClosePlan(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/ClosePlan", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).ClosePlan(ctx, req.(*CloseStackPlan_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_ApplyStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ApplyStackChanges_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(StacksServer).ApplyStackChanges(m, &stacksApplyStackChangesServer{stream}) -} - -type Stacks_ApplyStackChangesServer interface { - Send(*ApplyStackChanges_Event) error - grpc.ServerStream -} - -type stacksApplyStackChangesServer struct { - grpc.ServerStream -} - -func (x *stacksApplyStackChangesServer) Send(m *ApplyStackChanges_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Stacks_OpenStackInspector_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenStackInspector_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).OpenStackInspector(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/OpenStackInspector", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).OpenStackInspector(ctx, req.(*OpenStackInspector_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_InspectExpressionResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InspectExpressionResult_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).InspectExpressionResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/InspectExpressionResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).InspectExpressionResult(ctx, req.(*InspectExpressionResult_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_OpenTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenTerraformState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).OpenTerraformState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/OpenTerraformState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).OpenTerraformState(ctx, req.(*OpenTerraformState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_CloseTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseTerraformState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).CloseTerraformState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/CloseTerraformState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).CloseTerraformState(ctx, req.(*CloseTerraformState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_MigrateTerraformState_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(MigrateTerraformState_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(StacksServer).MigrateTerraformState(m, &stacksMigrateTerraformStateServer{stream}) -} - -type Stacks_MigrateTerraformStateServer interface { - Send(*MigrateTerraformState_Event) error - grpc.ServerStream -} - -type stacksMigrateTerraformStateServer struct { - grpc.ServerStream -} - -func (x *stacksMigrateTerraformStateServer) Send(m *MigrateTerraformState_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Stacks_ListResourceIdentities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListResourceIdentities_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).ListResourceIdentities(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/terraform1.stacks.Stacks/ListResourceIdentities", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).ListResourceIdentities(ctx, req.(*ListResourceIdentities_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Stacks_serviceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.stacks.Stacks", - HandlerType: (*StacksServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "OpenStackConfiguration", - Handler: _Stacks_OpenStackConfiguration_Handler, - }, - { - MethodName: "CloseStackConfiguration", - Handler: _Stacks_CloseStackConfiguration_Handler, - }, - { - MethodName: "ValidateStackConfiguration", - Handler: _Stacks_ValidateStackConfiguration_Handler, - }, - { - MethodName: "FindStackConfigurationComponents", - Handler: _Stacks_FindStackConfigurationComponents_Handler, - }, - { - MethodName: "CloseState", - Handler: _Stacks_CloseState_Handler, - }, - { - MethodName: "ClosePlan", - Handler: _Stacks_ClosePlan_Handler, - }, - { - MethodName: "OpenStackInspector", - Handler: _Stacks_OpenStackInspector_Handler, - }, - { - MethodName: "InspectExpressionResult", - Handler: _Stacks_InspectExpressionResult_Handler, - }, - { - MethodName: "OpenTerraformState", - Handler: _Stacks_OpenTerraformState_Handler, - }, - { - MethodName: "CloseTerraformState", - Handler: _Stacks_CloseTerraformState_Handler, - }, - { - MethodName: "ListResourceIdentities", - Handler: _Stacks_ListResourceIdentities_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "OpenState", - Handler: _Stacks_OpenState_Handler, - ClientStreams: true, - }, - { - StreamName: "PlanStackChanges", - Handler: _Stacks_PlanStackChanges_Handler, - ServerStreams: true, - }, - { - StreamName: "OpenPlan", - Handler: _Stacks_OpenPlan_Handler, - ClientStreams: true, - }, - { - StreamName: "ApplyStackChanges", - Handler: _Stacks_ApplyStackChanges_Handler, - ServerStreams: true, - }, - { - StreamName: "MigrateTerraformState", - Handler: _Stacks_MigrateTerraformState_Handler, - ServerStreams: true, - }, - }, - Metadata: "stacks.proto", -} diff --git a/internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go b/internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go new file mode 100644 index 000000000000..914efcb61543 --- /dev/null +++ b/internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go @@ -0,0 +1,873 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: stacks.proto + +package stacks + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Stacks_OpenStackConfiguration_FullMethodName = "/terraform1.stacks.Stacks/OpenStackConfiguration" + Stacks_CloseStackConfiguration_FullMethodName = "/terraform1.stacks.Stacks/CloseStackConfiguration" + Stacks_ValidateStackConfiguration_FullMethodName = "/terraform1.stacks.Stacks/ValidateStackConfiguration" + Stacks_FindStackConfigurationComponents_FullMethodName = "/terraform1.stacks.Stacks/FindStackConfigurationComponents" + Stacks_OpenState_FullMethodName = "/terraform1.stacks.Stacks/OpenState" + Stacks_CloseState_FullMethodName = "/terraform1.stacks.Stacks/CloseState" + Stacks_PlanStackChanges_FullMethodName = "/terraform1.stacks.Stacks/PlanStackChanges" + Stacks_OpenPlan_FullMethodName = "/terraform1.stacks.Stacks/OpenPlan" + Stacks_ClosePlan_FullMethodName = "/terraform1.stacks.Stacks/ClosePlan" + Stacks_ApplyStackChanges_FullMethodName = "/terraform1.stacks.Stacks/ApplyStackChanges" + Stacks_OpenStackInspector_FullMethodName = "/terraform1.stacks.Stacks/OpenStackInspector" + Stacks_InspectExpressionResult_FullMethodName = "/terraform1.stacks.Stacks/InspectExpressionResult" + Stacks_OpenTerraformState_FullMethodName = "/terraform1.stacks.Stacks/OpenTerraformState" + Stacks_CloseTerraformState_FullMethodName = "/terraform1.stacks.Stacks/CloseTerraformState" + Stacks_MigrateTerraformState_FullMethodName = "/terraform1.stacks.Stacks/MigrateTerraformState" + Stacks_ListResourceIdentities_FullMethodName = "/terraform1.stacks.Stacks/ListResourceIdentities" +) + +// StacksClient is the client API for Stacks service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type StacksClient interface { + // Load and perform initial static validation of a stack configuration + // in a previously-opened source bundle. If successful, returns a + // stack configuration handle that can be used with other operations. + OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) + // Close a previously-opened stack configuration using its handle. + CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) + // Validate an open stack configuration. + ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) + // Analyze a stack configuration to find all of the components it declares. + // This is static analysis only, so it cannot produce dynamic information + // such as the number of instances of each component. + FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) + // Load a stack state by sending a stream of raw state objects that were + // streamed from a previous ApplyStackChanges response. + OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) + // Close a stack state handle, discarding the associated state. + CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) + // Calculate a desired state from the given configuration and compare it + // with the current state to propose a set of changes to converge the + // current state with the desired state, at least in part. + PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) + // Load a previously-created plan by sending a stream of raw change objects + // that were streamed from a previous PlanStackChanges response. + OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) + // Close a saved plan handle, discarding the associated saved plan. + ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) + // Execute the changes proposed by an earlier call to PlanStackChanges. + ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) + // OpenStackInspector creates a stack inspector handle that can be used + // with subsequent calls to the "Inspect"-prefixed functions. + OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) + // InspectExpressionResult evaluates an arbitrary expression in the context + // of a stack inspector handle. + InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) + // Open a previously-saved Terraform state, returning a handle that can be + // used with other operations. This is distinct from OpenState because it + // means core state rather than stack state. + OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) + // Close a previously-opened Terraform state using its handle. + CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) + // MigrateTerraformState migrates a Terraform state into Stacks state using + // a mapping of addresses. + MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) + // ListResourceIdentities lists the identities of all resources in a stack. + ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) +} + +type stacksClient struct { + cc grpc.ClientConnInterface +} + +func NewStacksClient(cc grpc.ClientConnInterface) StacksClient { + return &stacksClient{cc} +} + +func (c *stacksClient) OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) { + out := new(OpenStackConfiguration_Response) + err := c.cc.Invoke(ctx, Stacks_OpenStackConfiguration_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) { + out := new(CloseStackConfiguration_Response) + err := c.cc.Invoke(ctx, Stacks_CloseStackConfiguration_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) { + out := new(ValidateStackConfiguration_Response) + err := c.cc.Invoke(ctx, Stacks_ValidateStackConfiguration_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) { + out := new(FindStackConfigurationComponents_Response) + err := c.cc.Invoke(ctx, Stacks_FindStackConfigurationComponents_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) { + stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[0], Stacks_OpenState_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &stacksOpenStateClient{stream} + return x, nil +} + +type Stacks_OpenStateClient interface { + Send(*OpenStackState_RequestItem) error + CloseAndRecv() (*OpenStackState_Response, error) + grpc.ClientStream +} + +type stacksOpenStateClient struct { + grpc.ClientStream +} + +func (x *stacksOpenStateClient) Send(m *OpenStackState_RequestItem) error { + return x.ClientStream.SendMsg(m) +} + +func (x *stacksOpenStateClient) CloseAndRecv() (*OpenStackState_Response, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(OpenStackState_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) { + out := new(CloseStackState_Response) + err := c.cc.Invoke(ctx, Stacks_CloseState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) { + stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[1], Stacks_PlanStackChanges_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &stacksPlanStackChangesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Stacks_PlanStackChangesClient interface { + Recv() (*PlanStackChanges_Event, error) + grpc.ClientStream +} + +type stacksPlanStackChangesClient struct { + grpc.ClientStream +} + +func (x *stacksPlanStackChangesClient) Recv() (*PlanStackChanges_Event, error) { + m := new(PlanStackChanges_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) { + stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[2], Stacks_OpenPlan_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &stacksOpenPlanClient{stream} + return x, nil +} + +type Stacks_OpenPlanClient interface { + Send(*OpenStackPlan_RequestItem) error + CloseAndRecv() (*OpenStackPlan_Response, error) + grpc.ClientStream +} + +type stacksOpenPlanClient struct { + grpc.ClientStream +} + +func (x *stacksOpenPlanClient) Send(m *OpenStackPlan_RequestItem) error { + return x.ClientStream.SendMsg(m) +} + +func (x *stacksOpenPlanClient) CloseAndRecv() (*OpenStackPlan_Response, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(OpenStackPlan_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) { + out := new(CloseStackPlan_Response) + err := c.cc.Invoke(ctx, Stacks_ClosePlan_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) { + stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[3], Stacks_ApplyStackChanges_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &stacksApplyStackChangesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Stacks_ApplyStackChangesClient interface { + Recv() (*ApplyStackChanges_Event, error) + grpc.ClientStream +} + +type stacksApplyStackChangesClient struct { + grpc.ClientStream +} + +func (x *stacksApplyStackChangesClient) Recv() (*ApplyStackChanges_Event, error) { + m := new(ApplyStackChanges_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) { + out := new(OpenStackInspector_Response) + err := c.cc.Invoke(ctx, Stacks_OpenStackInspector_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) { + out := new(InspectExpressionResult_Response) + err := c.cc.Invoke(ctx, Stacks_InspectExpressionResult_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) { + out := new(OpenTerraformState_Response) + err := c.cc.Invoke(ctx, Stacks_OpenTerraformState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) { + out := new(CloseTerraformState_Response) + err := c.cc.Invoke(ctx, Stacks_CloseTerraformState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) { + stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[4], Stacks_MigrateTerraformState_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &stacksMigrateTerraformStateClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Stacks_MigrateTerraformStateClient interface { + Recv() (*MigrateTerraformState_Event, error) + grpc.ClientStream +} + +type stacksMigrateTerraformStateClient struct { + grpc.ClientStream +} + +func (x *stacksMigrateTerraformStateClient) Recv() (*MigrateTerraformState_Event, error) { + m := new(MigrateTerraformState_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) { + out := new(ListResourceIdentities_Response) + err := c.cc.Invoke(ctx, Stacks_ListResourceIdentities_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StacksServer is the server API for Stacks service. +// All implementations should embed UnimplementedStacksServer +// for forward compatibility +type StacksServer interface { + // Load and perform initial static validation of a stack configuration + // in a previously-opened source bundle. If successful, returns a + // stack configuration handle that can be used with other operations. + OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) + // Close a previously-opened stack configuration using its handle. + CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) + // Validate an open stack configuration. + ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) + // Analyze a stack configuration to find all of the components it declares. + // This is static analysis only, so it cannot produce dynamic information + // such as the number of instances of each component. + FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) + // Load a stack state by sending a stream of raw state objects that were + // streamed from a previous ApplyStackChanges response. + OpenState(Stacks_OpenStateServer) error + // Close a stack state handle, discarding the associated state. + CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) + // Calculate a desired state from the given configuration and compare it + // with the current state to propose a set of changes to converge the + // current state with the desired state, at least in part. + PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error + // Load a previously-created plan by sending a stream of raw change objects + // that were streamed from a previous PlanStackChanges response. + OpenPlan(Stacks_OpenPlanServer) error + // Close a saved plan handle, discarding the associated saved plan. + ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) + // Execute the changes proposed by an earlier call to PlanStackChanges. + ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error + // OpenStackInspector creates a stack inspector handle that can be used + // with subsequent calls to the "Inspect"-prefixed functions. + OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) + // InspectExpressionResult evaluates an arbitrary expression in the context + // of a stack inspector handle. + InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) + // Open a previously-saved Terraform state, returning a handle that can be + // used with other operations. This is distinct from OpenState because it + // means core state rather than stack state. + OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) + // Close a previously-opened Terraform state using its handle. + CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) + // MigrateTerraformState migrates a Terraform state into Stacks state using + // a mapping of addresses. + MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error + // ListResourceIdentities lists the identities of all resources in a stack. + ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) +} + +// UnimplementedStacksServer should be embedded to have forward compatible implementations. +type UnimplementedStacksServer struct { +} + +func (UnimplementedStacksServer) OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenStackConfiguration not implemented") +} +func (UnimplementedStacksServer) CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseStackConfiguration not implemented") +} +func (UnimplementedStacksServer) ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateStackConfiguration not implemented") +} +func (UnimplementedStacksServer) FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindStackConfigurationComponents not implemented") +} +func (UnimplementedStacksServer) OpenState(Stacks_OpenStateServer) error { + return status.Errorf(codes.Unimplemented, "method OpenState not implemented") +} +func (UnimplementedStacksServer) CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseState not implemented") +} +func (UnimplementedStacksServer) PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error { + return status.Errorf(codes.Unimplemented, "method PlanStackChanges not implemented") +} +func (UnimplementedStacksServer) OpenPlan(Stacks_OpenPlanServer) error { + return status.Errorf(codes.Unimplemented, "method OpenPlan not implemented") +} +func (UnimplementedStacksServer) ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClosePlan not implemented") +} +func (UnimplementedStacksServer) ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error { + return status.Errorf(codes.Unimplemented, "method ApplyStackChanges not implemented") +} +func (UnimplementedStacksServer) OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenStackInspector not implemented") +} +func (UnimplementedStacksServer) InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method InspectExpressionResult not implemented") +} +func (UnimplementedStacksServer) OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenTerraformState not implemented") +} +func (UnimplementedStacksServer) CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseTerraformState not implemented") +} +func (UnimplementedStacksServer) MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error { + return status.Errorf(codes.Unimplemented, "method MigrateTerraformState not implemented") +} +func (UnimplementedStacksServer) ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListResourceIdentities not implemented") +} + +// UnsafeStacksServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StacksServer will +// result in compilation errors. +type UnsafeStacksServer interface { + mustEmbedUnimplementedStacksServer() +} + +func RegisterStacksServer(s grpc.ServiceRegistrar, srv StacksServer) { + s.RegisterService(&Stacks_ServiceDesc, srv) +} + +func _Stacks_OpenStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenStackConfiguration_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).OpenStackConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_OpenStackConfiguration_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).OpenStackConfiguration(ctx, req.(*OpenStackConfiguration_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_CloseStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStackConfiguration_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).CloseStackConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_CloseStackConfiguration_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).CloseStackConfiguration(ctx, req.(*CloseStackConfiguration_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_ValidateStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateStackConfiguration_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).ValidateStackConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_ValidateStackConfiguration_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).ValidateStackConfiguration(ctx, req.(*ValidateStackConfiguration_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_FindStackConfigurationComponents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindStackConfigurationComponents_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).FindStackConfigurationComponents(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_FindStackConfigurationComponents_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).FindStackConfigurationComponents(ctx, req.(*FindStackConfigurationComponents_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_OpenState_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StacksServer).OpenState(&stacksOpenStateServer{stream}) +} + +type Stacks_OpenStateServer interface { + SendAndClose(*OpenStackState_Response) error + Recv() (*OpenStackState_RequestItem, error) + grpc.ServerStream +} + +type stacksOpenStateServer struct { + grpc.ServerStream +} + +func (x *stacksOpenStateServer) SendAndClose(m *OpenStackState_Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *stacksOpenStateServer) Recv() (*OpenStackState_RequestItem, error) { + m := new(OpenStackState_RequestItem) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Stacks_CloseState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStackState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).CloseState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_CloseState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).CloseState(ctx, req.(*CloseStackState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_PlanStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(PlanStackChanges_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StacksServer).PlanStackChanges(m, &stacksPlanStackChangesServer{stream}) +} + +type Stacks_PlanStackChangesServer interface { + Send(*PlanStackChanges_Event) error + grpc.ServerStream +} + +type stacksPlanStackChangesServer struct { + grpc.ServerStream +} + +func (x *stacksPlanStackChangesServer) Send(m *PlanStackChanges_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Stacks_OpenPlan_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StacksServer).OpenPlan(&stacksOpenPlanServer{stream}) +} + +type Stacks_OpenPlanServer interface { + SendAndClose(*OpenStackPlan_Response) error + Recv() (*OpenStackPlan_RequestItem, error) + grpc.ServerStream +} + +type stacksOpenPlanServer struct { + grpc.ServerStream +} + +func (x *stacksOpenPlanServer) SendAndClose(m *OpenStackPlan_Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *stacksOpenPlanServer) Recv() (*OpenStackPlan_RequestItem, error) { + m := new(OpenStackPlan_RequestItem) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Stacks_ClosePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStackPlan_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).ClosePlan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_ClosePlan_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).ClosePlan(ctx, req.(*CloseStackPlan_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_ApplyStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ApplyStackChanges_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StacksServer).ApplyStackChanges(m, &stacksApplyStackChangesServer{stream}) +} + +type Stacks_ApplyStackChangesServer interface { + Send(*ApplyStackChanges_Event) error + grpc.ServerStream +} + +type stacksApplyStackChangesServer struct { + grpc.ServerStream +} + +func (x *stacksApplyStackChangesServer) Send(m *ApplyStackChanges_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Stacks_OpenStackInspector_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenStackInspector_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).OpenStackInspector(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_OpenStackInspector_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).OpenStackInspector(ctx, req.(*OpenStackInspector_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_InspectExpressionResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InspectExpressionResult_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).InspectExpressionResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_InspectExpressionResult_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).InspectExpressionResult(ctx, req.(*InspectExpressionResult_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_OpenTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenTerraformState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).OpenTerraformState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_OpenTerraformState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).OpenTerraformState(ctx, req.(*OpenTerraformState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_CloseTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseTerraformState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).CloseTerraformState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_CloseTerraformState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).CloseTerraformState(ctx, req.(*CloseTerraformState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_MigrateTerraformState_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(MigrateTerraformState_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StacksServer).MigrateTerraformState(m, &stacksMigrateTerraformStateServer{stream}) +} + +type Stacks_MigrateTerraformStateServer interface { + Send(*MigrateTerraformState_Event) error + grpc.ServerStream +} + +type stacksMigrateTerraformStateServer struct { + grpc.ServerStream +} + +func (x *stacksMigrateTerraformStateServer) Send(m *MigrateTerraformState_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Stacks_ListResourceIdentities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListResourceIdentities_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).ListResourceIdentities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Stacks_ListResourceIdentities_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).ListResourceIdentities(ctx, req.(*ListResourceIdentities_Request)) + } + return interceptor(ctx, in, info, handler) +} + +// Stacks_ServiceDesc is the grpc.ServiceDesc for Stacks service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Stacks_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.stacks.Stacks", + HandlerType: (*StacksServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "OpenStackConfiguration", + Handler: _Stacks_OpenStackConfiguration_Handler, + }, + { + MethodName: "CloseStackConfiguration", + Handler: _Stacks_CloseStackConfiguration_Handler, + }, + { + MethodName: "ValidateStackConfiguration", + Handler: _Stacks_ValidateStackConfiguration_Handler, + }, + { + MethodName: "FindStackConfigurationComponents", + Handler: _Stacks_FindStackConfigurationComponents_Handler, + }, + { + MethodName: "CloseState", + Handler: _Stacks_CloseState_Handler, + }, + { + MethodName: "ClosePlan", + Handler: _Stacks_ClosePlan_Handler, + }, + { + MethodName: "OpenStackInspector", + Handler: _Stacks_OpenStackInspector_Handler, + }, + { + MethodName: "InspectExpressionResult", + Handler: _Stacks_InspectExpressionResult_Handler, + }, + { + MethodName: "OpenTerraformState", + Handler: _Stacks_OpenTerraformState_Handler, + }, + { + MethodName: "CloseTerraformState", + Handler: _Stacks_CloseTerraformState_Handler, + }, + { + MethodName: "ListResourceIdentities", + Handler: _Stacks_ListResourceIdentities_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "OpenState", + Handler: _Stacks_OpenState_Handler, + ClientStreams: true, + }, + { + StreamName: "PlanStackChanges", + Handler: _Stacks_PlanStackChanges_Handler, + ServerStreams: true, + }, + { + StreamName: "OpenPlan", + Handler: _Stacks_OpenPlan_Handler, + ClientStreams: true, + }, + { + StreamName: "ApplyStackChanges", + Handler: _Stacks_ApplyStackChanges_Handler, + ServerStreams: true, + }, + { + StreamName: "MigrateTerraformState", + Handler: _Stacks_MigrateTerraformState_Handler, + ServerStreams: true, + }, + }, + Metadata: "stacks.proto", +} diff --git a/internal/stacksplugin/stacksproto1/stacksproto1.pb.go b/internal/stacksplugin/stacksproto1/stacksproto1.pb.go index 88f2717fa3f0..786b85c6f50f 100644 --- a/internal/stacksplugin/stacksproto1/stacksproto1.pb.go +++ b/internal/stacksplugin/stacksproto1/stacksproto1.pb.go @@ -10,10 +10,6 @@ package stacksproto1 import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -271,112 +267,3 @@ func file_stacksproto1_proto_init() { file_stacksproto1_proto_goTypes = nil file_stacksproto1_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// CommandServiceClient is the client API for CommandService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type CommandServiceClient interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) -} - -type commandServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { - return &commandServiceClient{cc} -} - -func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { - stream, err := c.cc.NewStream(ctx, &_CommandService_serviceDesc.Streams[0], "/stacksproto1.CommandService/Execute", opts...) - if err != nil { - return nil, err - } - x := &commandServiceExecuteClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type CommandService_ExecuteClient interface { - Recv() (*CommandResponse, error) - grpc.ClientStream -} - -type commandServiceExecuteClient struct { - grpc.ClientStream -} - -func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { - m := new(CommandResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// CommandServiceServer is the server API for CommandService service. -type CommandServiceServer interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(*CommandRequest, CommandService_ExecuteServer) error -} - -// UnimplementedCommandServiceServer can be embedded to have forward compatible implementations. -type UnimplementedCommandServiceServer struct { -} - -func (*UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { - return status.Errorf(codes.Unimplemented, "method Execute not implemented") -} - -func RegisterCommandServiceServer(s *grpc.Server, srv CommandServiceServer) { - s.RegisterService(&_CommandService_serviceDesc, srv) -} - -func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(CommandRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) -} - -type CommandService_ExecuteServer interface { - Send(*CommandResponse) error - grpc.ServerStream -} - -type commandServiceExecuteServer struct { - grpc.ServerStream -} - -func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { - return x.ServerStream.SendMsg(m) -} - -var _CommandService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "stacksproto1.CommandService", - HandlerType: (*CommandServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Execute", - Handler: _CommandService_Execute_Handler, - ServerStreams: true, - }, - }, - Metadata: "stacksproto1.proto", -} diff --git a/internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go b/internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go new file mode 100644 index 000000000000..9996d19e0e3e --- /dev/null +++ b/internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go @@ -0,0 +1,139 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: stacksproto1.proto + +package stacksproto1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + CommandService_Execute_FullMethodName = "/stacksproto1.CommandService/Execute" +) + +// CommandServiceClient is the client API for CommandService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type CommandServiceClient interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) +} + +type commandServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { + return &commandServiceClient{cc} +} + +func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { + stream, err := c.cc.NewStream(ctx, &CommandService_ServiceDesc.Streams[0], CommandService_Execute_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &commandServiceExecuteClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type CommandService_ExecuteClient interface { + Recv() (*CommandResponse, error) + grpc.ClientStream +} + +type commandServiceExecuteClient struct { + grpc.ClientStream +} + +func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { + m := new(CommandResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// CommandServiceServer is the server API for CommandService service. +// All implementations should embed UnimplementedCommandServiceServer +// for forward compatibility +type CommandServiceServer interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(*CommandRequest, CommandService_ExecuteServer) error +} + +// UnimplementedCommandServiceServer should be embedded to have forward compatible implementations. +type UnimplementedCommandServiceServer struct { +} + +func (UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { + return status.Errorf(codes.Unimplemented, "method Execute not implemented") +} + +// UnsafeCommandServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CommandServiceServer will +// result in compilation errors. +type UnsafeCommandServiceServer interface { + mustEmbedUnimplementedCommandServiceServer() +} + +func RegisterCommandServiceServer(s grpc.ServiceRegistrar, srv CommandServiceServer) { + s.RegisterService(&CommandService_ServiceDesc, srv) +} + +func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(CommandRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) +} + +type CommandService_ExecuteServer interface { + Send(*CommandResponse) error + grpc.ServerStream +} + +type commandServiceExecuteServer struct { + grpc.ServerStream +} + +func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { + return x.ServerStream.SendMsg(m) +} + +// CommandService_ServiceDesc is the grpc.ServiceDesc for CommandService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CommandService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "stacksproto1.CommandService", + HandlerType: (*CommandServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Execute", + Handler: _CommandService_Execute_Handler, + ServerStreams: true, + }, + }, + Metadata: "stacksproto1.proto", +} diff --git a/internal/tfplugin5/tfplugin5.pb.go b/internal/tfplugin5/tfplugin5.pb.go index 151e1376a840..85e273150051 100644 --- a/internal/tfplugin5/tfplugin5.pb.go +++ b/internal/tfplugin5/tfplugin5.pb.go @@ -28,10 +28,6 @@ package tfplugin5 import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" @@ -7849,1356 +7845,3 @@ func file_tfplugin5_proto_init() { file_tfplugin5_proto_goTypes = nil file_tfplugin5_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ProviderClient is the client API for Provider service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ProviderClient interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) - PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) - ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) - ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) - UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) - PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) - ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) - ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) - MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) - ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) - GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) - ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) - // ////// Actions - PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) - InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) - ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) -} - -type providerClient struct { - cc grpc.ClientConnInterface -} - -func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { - return &providerClient{cc} -} - -func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { - out := new(GetMetadata_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetMetadata", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { - out := new(GetProviderSchema_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetSchema", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) { - out := new(PrepareProviderConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/PrepareProviderConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) { - out := new(ValidateResourceTypeConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateResourceTypeConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) { - out := new(ValidateDataSourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateDataSourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { - out := new(UpgradeResourceState_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/UpgradeResourceState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { - out := new(GetResourceIdentitySchemas_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetResourceIdentitySchemas", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { - out := new(UpgradeResourceIdentity_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/UpgradeResourceIdentity", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) { - out := new(Configure_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/Configure", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { - out := new(ReadResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ReadResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { - out := new(PlanResourceChange_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/PlanResourceChange", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { - out := new(ApplyResourceChange_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ApplyResourceChange", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { - out := new(ImportResourceState_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ImportResourceState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { - out := new(MoveResourceState_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/MoveResourceState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { - out := new(ReadDataSource_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ReadDataSource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { - out := new(GenerateResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GenerateResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { - out := new(ValidateEphemeralResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateEphemeralResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { - out := new(OpenEphemeralResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/OpenEphemeralResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { - out := new(RenewEphemeralResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/RenewEphemeralResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { - out := new(CloseEphemeralResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/CloseEphemeralResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[0], "/tfplugin5.Provider/ListResource", opts...) - if err != nil { - return nil, err - } - x := &providerListResourceClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_ListResourceClient interface { - Recv() (*ListResource_Event, error) - grpc.ClientStream -} - -type providerListResourceClient struct { - grpc.ClientStream -} - -func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { - m := new(ListResource_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { - out := new(ValidateListResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateListResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { - out := new(GetFunctions_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetFunctions", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { - out := new(CallFunction_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/CallFunction", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { - out := new(PlanAction_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/PlanAction", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[1], "/tfplugin5.Provider/InvokeAction", opts...) - if err != nil { - return nil, err - } - x := &providerInvokeActionClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_InvokeActionClient interface { - Recv() (*InvokeAction_Event, error) - grpc.ClientStream -} - -type providerInvokeActionClient struct { - grpc.ClientStream -} - -func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { - m := new(InvokeAction_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { - out := new(ValidateActionConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateActionConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { - out := new(Stop_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provider/Stop", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProviderServer is the server API for Provider service. -type ProviderServer interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) - PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) - ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) - ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) - UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - Configure(context.Context, *Configure_Request) (*Configure_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) - PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) - ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) - ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) - MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) - ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) - GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(*ListResource_Request, Provider_ListResourceServer) error - ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) - // ////// Actions - PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) - InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error - ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - Stop(context.Context, *Stop_Request) (*Stop_Response, error) -} - -// UnimplementedProviderServer can be embedded to have forward compatible implementations. -type UnimplementedProviderServer struct { -} - -func (*UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") -} -func (*UnimplementedProviderServer) GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") -} -func (*UnimplementedProviderServer) PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PrepareProviderConfig not implemented") -} -func (*UnimplementedProviderServer) ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceTypeConfig not implemented") -} -func (*UnimplementedProviderServer) ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateDataSourceConfig not implemented") -} -func (*UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") -} -func (*UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") -} -func (*UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") -} -func (*UnimplementedProviderServer) Configure(context.Context, *Configure_Request) (*Configure_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") -} -func (*UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") -} -func (*UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") -} -func (*UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") -} -func (*UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") -} -func (*UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") -} -func (*UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") -} -func (*UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") -} -func (*UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") -} -func (*UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") -} -func (*UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") -} -func (*UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") -} -func (*UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { - return status.Errorf(codes.Unimplemented, "method ListResource not implemented") -} -func (*UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") -} -func (*UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") -} -func (*UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") -} -func (*UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") -} -func (*UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { - return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") -} -func (*UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") -} -func (*UnimplementedProviderServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") -} - -func RegisterProviderServer(s *grpc.Server, srv ProviderServer) { - s.RegisterService(&_Provider_serviceDesc, srv) -} - -func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMetadata_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/GetMetadata", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/GetSchema", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetSchema(ctx, req.(*GetProviderSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PrepareProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PrepareProviderConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PrepareProviderConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/PrepareProviderConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PrepareProviderConfig(ctx, req.(*PrepareProviderConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateResourceTypeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateResourceTypeConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ValidateResourceTypeConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, req.(*ValidateResourceTypeConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateDataSourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateDataSourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateDataSourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ValidateDataSourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateDataSourceConfig(ctx, req.(*ValidateDataSourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/UpgradeResourceState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetResourceIdentitySchemas_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/GetResourceIdentitySchemas", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceIdentity_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/UpgradeResourceIdentity", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Configure_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).Configure(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/Configure", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).Configure(ctx, req.(*Configure_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ReadResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/PlanResourceChange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ApplyResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ApplyResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ApplyResourceChange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ImportResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ImportResourceState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MoveResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).MoveResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/MoveResourceState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadDataSource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadDataSource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ReadDataSource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GenerateResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GenerateResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/GenerateResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateEphemeralResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ValidateEphemeralResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).OpenEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/OpenEphemeralResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RenewEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).RenewEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/RenewEphemeralResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CloseEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/CloseEphemeralResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListResource_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) -} - -type Provider_ListResourceServer interface { - Send(*ListResource_Event) error - grpc.ServerStream -} - -type providerListResourceServer struct { - grpc.ServerStream -} - -func (x *providerListResourceServer) Send(m *ListResource_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateListResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ValidateListResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFunctions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetFunctions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/GetFunctions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CallFunction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CallFunction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/CallFunction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanAction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanAction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/PlanAction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(InvokeAction_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) -} - -type Provider_InvokeActionServer interface { - Send(*InvokeAction_Event) error - grpc.ServerStream -} - -type providerInvokeActionServer struct { - grpc.ServerStream -} - -func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateActionConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateActionConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/ValidateActionConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Stop_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provider/Stop", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).Stop(ctx, req.(*Stop_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Provider_serviceDesc = grpc.ServiceDesc{ - ServiceName: "tfplugin5.Provider", - HandlerType: (*ProviderServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetMetadata", - Handler: _Provider_GetMetadata_Handler, - }, - { - MethodName: "GetSchema", - Handler: _Provider_GetSchema_Handler, - }, - { - MethodName: "PrepareProviderConfig", - Handler: _Provider_PrepareProviderConfig_Handler, - }, - { - MethodName: "ValidateResourceTypeConfig", - Handler: _Provider_ValidateResourceTypeConfig_Handler, - }, - { - MethodName: "ValidateDataSourceConfig", - Handler: _Provider_ValidateDataSourceConfig_Handler, - }, - { - MethodName: "UpgradeResourceState", - Handler: _Provider_UpgradeResourceState_Handler, - }, - { - MethodName: "GetResourceIdentitySchemas", - Handler: _Provider_GetResourceIdentitySchemas_Handler, - }, - { - MethodName: "UpgradeResourceIdentity", - Handler: _Provider_UpgradeResourceIdentity_Handler, - }, - { - MethodName: "Configure", - Handler: _Provider_Configure_Handler, - }, - { - MethodName: "ReadResource", - Handler: _Provider_ReadResource_Handler, - }, - { - MethodName: "PlanResourceChange", - Handler: _Provider_PlanResourceChange_Handler, - }, - { - MethodName: "ApplyResourceChange", - Handler: _Provider_ApplyResourceChange_Handler, - }, - { - MethodName: "ImportResourceState", - Handler: _Provider_ImportResourceState_Handler, - }, - { - MethodName: "MoveResourceState", - Handler: _Provider_MoveResourceState_Handler, - }, - { - MethodName: "ReadDataSource", - Handler: _Provider_ReadDataSource_Handler, - }, - { - MethodName: "GenerateResourceConfig", - Handler: _Provider_GenerateResourceConfig_Handler, - }, - { - MethodName: "ValidateEphemeralResourceConfig", - Handler: _Provider_ValidateEphemeralResourceConfig_Handler, - }, - { - MethodName: "OpenEphemeralResource", - Handler: _Provider_OpenEphemeralResource_Handler, - }, - { - MethodName: "RenewEphemeralResource", - Handler: _Provider_RenewEphemeralResource_Handler, - }, - { - MethodName: "CloseEphemeralResource", - Handler: _Provider_CloseEphemeralResource_Handler, - }, - { - MethodName: "ValidateListResourceConfig", - Handler: _Provider_ValidateListResourceConfig_Handler, - }, - { - MethodName: "GetFunctions", - Handler: _Provider_GetFunctions_Handler, - }, - { - MethodName: "CallFunction", - Handler: _Provider_CallFunction_Handler, - }, - { - MethodName: "PlanAction", - Handler: _Provider_PlanAction_Handler, - }, - { - MethodName: "ValidateActionConfig", - Handler: _Provider_ValidateActionConfig_Handler, - }, - { - MethodName: "Stop", - Handler: _Provider_Stop_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ListResource", - Handler: _Provider_ListResource_Handler, - ServerStreams: true, - }, - { - StreamName: "InvokeAction", - Handler: _Provider_InvokeAction_Handler, - ServerStreams: true, - }, - }, - Metadata: "tfplugin5.proto", -} - -// ProvisionerClient is the client API for Provisioner service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ProvisionerClient interface { - GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) - ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) - ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) - Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) -} - -type provisionerClient struct { - cc grpc.ClientConnInterface -} - -func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient { - return &provisionerClient{cc} -} - -func (c *provisionerClient) GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) { - out := new(GetProvisionerSchema_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provisioner/GetSchema", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *provisionerClient) ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) { - out := new(ValidateProvisionerConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provisioner/ValidateProvisionerConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *provisionerClient) ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provisioner_serviceDesc.Streams[0], "/tfplugin5.Provisioner/ProvisionResource", opts...) - if err != nil { - return nil, err - } - x := &provisionerProvisionResourceClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provisioner_ProvisionResourceClient interface { - Recv() (*ProvisionResource_Response, error) - grpc.ClientStream -} - -type provisionerProvisionResourceClient struct { - grpc.ClientStream -} - -func (x *provisionerProvisionResourceClient) Recv() (*ProvisionResource_Response, error) { - m := new(ProvisionResource_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *provisionerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { - out := new(Stop_Response) - err := c.cc.Invoke(ctx, "/tfplugin5.Provisioner/Stop", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProvisionerServer is the server API for Provisioner service. -type ProvisionerServer interface { - GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) - ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) - ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error - Stop(context.Context, *Stop_Request) (*Stop_Response, error) -} - -// UnimplementedProvisionerServer can be embedded to have forward compatible implementations. -type UnimplementedProvisionerServer struct { -} - -func (*UnimplementedProvisionerServer) GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") -} -func (*UnimplementedProvisionerServer) ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateProvisionerConfig not implemented") -} -func (*UnimplementedProvisionerServer) ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error { - return status.Errorf(codes.Unimplemented, "method ProvisionResource not implemented") -} -func (*UnimplementedProvisionerServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") -} - -func RegisterProvisionerServer(s *grpc.Server, srv ProvisionerServer) { - s.RegisterService(&_Provisioner_serviceDesc, srv) -} - -func _Provisioner_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProvisionerSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).GetSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provisioner/GetSchema", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).GetSchema(ctx, req.(*GetProvisionerSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provisioner_ValidateProvisionerConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateProvisionerConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provisioner/ValidateProvisionerConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, req.(*ValidateProvisionerConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provisioner_ProvisionResource_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ProvisionResource_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProvisionerServer).ProvisionResource(m, &provisionerProvisionResourceServer{stream}) -} - -type Provisioner_ProvisionResourceServer interface { - Send(*ProvisionResource_Response) error - grpc.ServerStream -} - -type provisionerProvisionResourceServer struct { - grpc.ServerStream -} - -func (x *provisionerProvisionResourceServer) Send(m *ProvisionResource_Response) error { - return x.ServerStream.SendMsg(m) -} - -func _Provisioner_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Stop_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin5.Provisioner/Stop", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).Stop(ctx, req.(*Stop_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Provisioner_serviceDesc = grpc.ServiceDesc{ - ServiceName: "tfplugin5.Provisioner", - HandlerType: (*ProvisionerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetSchema", - Handler: _Provisioner_GetSchema_Handler, - }, - { - MethodName: "ValidateProvisionerConfig", - Handler: _Provisioner_ValidateProvisionerConfig_Handler, - }, - { - MethodName: "Stop", - Handler: _Provisioner_Stop_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ProvisionResource", - Handler: _Provisioner_ProvisionResource_Handler, - ServerStreams: true, - }, - }, - Metadata: "tfplugin5.proto", -} diff --git a/internal/tfplugin5/tfplugin5_grpc.pb.go b/internal/tfplugin5/tfplugin5_grpc.pb.go new file mode 100644 index 000000000000..d97317fd09b5 --- /dev/null +++ b/internal/tfplugin5/tfplugin5_grpc.pb.go @@ -0,0 +1,1447 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Terraform Plugin RPC protocol version 5.10 +// +// This file defines version 5.10 of the RPC protocol. To implement a plugin +// against this protocol, copy this definition into your own codebase and +// use protoc to generate stubs for your target language. +// +// Any minor versions of protocol 5 to follow should modify this file while +// maintaining backwards compatibility. Breaking changes, if any are required, +// will come in a subsequent major version with its own separate proto definition. +// +// Note that only the proto files included in a release tag of Terraform are +// official protocol releases. Proto files taken from other commits may include +// incomplete changes or features that did not make it into a final release. +// In all reasonable cases, plugin developers should take the proto file from +// the tag of the most recent release of Terraform, and not from the main +// branch or any other development branch. +// + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: tfplugin5.proto + +package tfplugin5 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Provider_GetMetadata_FullMethodName = "/tfplugin5.Provider/GetMetadata" + Provider_GetSchema_FullMethodName = "/tfplugin5.Provider/GetSchema" + Provider_PrepareProviderConfig_FullMethodName = "/tfplugin5.Provider/PrepareProviderConfig" + Provider_ValidateResourceTypeConfig_FullMethodName = "/tfplugin5.Provider/ValidateResourceTypeConfig" + Provider_ValidateDataSourceConfig_FullMethodName = "/tfplugin5.Provider/ValidateDataSourceConfig" + Provider_UpgradeResourceState_FullMethodName = "/tfplugin5.Provider/UpgradeResourceState" + Provider_GetResourceIdentitySchemas_FullMethodName = "/tfplugin5.Provider/GetResourceIdentitySchemas" + Provider_UpgradeResourceIdentity_FullMethodName = "/tfplugin5.Provider/UpgradeResourceIdentity" + Provider_Configure_FullMethodName = "/tfplugin5.Provider/Configure" + Provider_ReadResource_FullMethodName = "/tfplugin5.Provider/ReadResource" + Provider_PlanResourceChange_FullMethodName = "/tfplugin5.Provider/PlanResourceChange" + Provider_ApplyResourceChange_FullMethodName = "/tfplugin5.Provider/ApplyResourceChange" + Provider_ImportResourceState_FullMethodName = "/tfplugin5.Provider/ImportResourceState" + Provider_MoveResourceState_FullMethodName = "/tfplugin5.Provider/MoveResourceState" + Provider_ReadDataSource_FullMethodName = "/tfplugin5.Provider/ReadDataSource" + Provider_GenerateResourceConfig_FullMethodName = "/tfplugin5.Provider/GenerateResourceConfig" + Provider_ValidateEphemeralResourceConfig_FullMethodName = "/tfplugin5.Provider/ValidateEphemeralResourceConfig" + Provider_OpenEphemeralResource_FullMethodName = "/tfplugin5.Provider/OpenEphemeralResource" + Provider_RenewEphemeralResource_FullMethodName = "/tfplugin5.Provider/RenewEphemeralResource" + Provider_CloseEphemeralResource_FullMethodName = "/tfplugin5.Provider/CloseEphemeralResource" + Provider_ListResource_FullMethodName = "/tfplugin5.Provider/ListResource" + Provider_ValidateListResourceConfig_FullMethodName = "/tfplugin5.Provider/ValidateListResourceConfig" + Provider_GetFunctions_FullMethodName = "/tfplugin5.Provider/GetFunctions" + Provider_CallFunction_FullMethodName = "/tfplugin5.Provider/CallFunction" + Provider_PlanAction_FullMethodName = "/tfplugin5.Provider/PlanAction" + Provider_InvokeAction_FullMethodName = "/tfplugin5.Provider/InvokeAction" + Provider_ValidateActionConfig_FullMethodName = "/tfplugin5.Provider/ValidateActionConfig" + Provider_Stop_FullMethodName = "/tfplugin5.Provider/Stop" +) + +// ProviderClient is the client API for Provider service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ProviderClient interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) + PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) + ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) + ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) + UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) + PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) + ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) + ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) + MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) + ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) + GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) + ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) + // ////// Actions + PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) + InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) + ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) +} + +type providerClient struct { + cc grpc.ClientConnInterface +} + +func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { + return &providerClient{cc} +} + +func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { + out := new(GetMetadata_Response) + err := c.cc.Invoke(ctx, Provider_GetMetadata_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { + out := new(GetProviderSchema_Response) + err := c.cc.Invoke(ctx, Provider_GetSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) { + out := new(PrepareProviderConfig_Response) + err := c.cc.Invoke(ctx, Provider_PrepareProviderConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) { + out := new(ValidateResourceTypeConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateResourceTypeConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) { + out := new(ValidateDataSourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateDataSourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { + out := new(UpgradeResourceState_Response) + err := c.cc.Invoke(ctx, Provider_UpgradeResourceState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { + out := new(GetResourceIdentitySchemas_Response) + err := c.cc.Invoke(ctx, Provider_GetResourceIdentitySchemas_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { + out := new(UpgradeResourceIdentity_Response) + err := c.cc.Invoke(ctx, Provider_UpgradeResourceIdentity_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) { + out := new(Configure_Response) + err := c.cc.Invoke(ctx, Provider_Configure_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { + out := new(ReadResource_Response) + err := c.cc.Invoke(ctx, Provider_ReadResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { + out := new(PlanResourceChange_Response) + err := c.cc.Invoke(ctx, Provider_PlanResourceChange_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { + out := new(ApplyResourceChange_Response) + err := c.cc.Invoke(ctx, Provider_ApplyResourceChange_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { + out := new(ImportResourceState_Response) + err := c.cc.Invoke(ctx, Provider_ImportResourceState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { + out := new(MoveResourceState_Response) + err := c.cc.Invoke(ctx, Provider_MoveResourceState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { + out := new(ReadDataSource_Response) + err := c.cc.Invoke(ctx, Provider_ReadDataSource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { + out := new(GenerateResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_GenerateResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { + out := new(ValidateEphemeralResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateEphemeralResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { + out := new(OpenEphemeralResource_Response) + err := c.cc.Invoke(ctx, Provider_OpenEphemeralResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { + out := new(RenewEphemeralResource_Response) + err := c.cc.Invoke(ctx, Provider_RenewEphemeralResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { + out := new(CloseEphemeralResource_Response) + err := c.cc.Invoke(ctx, Provider_CloseEphemeralResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { + stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[0], Provider_ListResource_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &providerListResourceClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_ListResourceClient interface { + Recv() (*ListResource_Event, error) + grpc.ClientStream +} + +type providerListResourceClient struct { + grpc.ClientStream +} + +func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { + m := new(ListResource_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { + out := new(ValidateListResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateListResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { + out := new(GetFunctions_Response) + err := c.cc.Invoke(ctx, Provider_GetFunctions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { + out := new(CallFunction_Response) + err := c.cc.Invoke(ctx, Provider_CallFunction_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { + out := new(PlanAction_Response) + err := c.cc.Invoke(ctx, Provider_PlanAction_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { + stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[1], Provider_InvokeAction_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &providerInvokeActionClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_InvokeActionClient interface { + Recv() (*InvokeAction_Event, error) + grpc.ClientStream +} + +type providerInvokeActionClient struct { + grpc.ClientStream +} + +func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { + m := new(InvokeAction_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { + out := new(ValidateActionConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateActionConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { + out := new(Stop_Response) + err := c.cc.Invoke(ctx, Provider_Stop_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProviderServer is the server API for Provider service. +// All implementations should embed UnimplementedProviderServer +// for forward compatibility +type ProviderServer interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) + PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) + ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) + ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) + UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + Configure(context.Context, *Configure_Request) (*Configure_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) + PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) + ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) + ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) + MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) + ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) + GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(*ListResource_Request, Provider_ListResourceServer) error + ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) + // ////// Actions + PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) + InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error + ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + Stop(context.Context, *Stop_Request) (*Stop_Response, error) +} + +// UnimplementedProviderServer should be embedded to have forward compatible implementations. +type UnimplementedProviderServer struct { +} + +func (UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") +} +func (UnimplementedProviderServer) GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (UnimplementedProviderServer) PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PrepareProviderConfig not implemented") +} +func (UnimplementedProviderServer) ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceTypeConfig not implemented") +} +func (UnimplementedProviderServer) ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateDataSourceConfig not implemented") +} +func (UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") +} +func (UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") +} +func (UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") +} +func (UnimplementedProviderServer) Configure(context.Context, *Configure_Request) (*Configure_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") +} +func (UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") +} +func (UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") +} +func (UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") +} +func (UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") +} +func (UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") +} +func (UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") +} +func (UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") +} +func (UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") +} +func (UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") +} +func (UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") +} +func (UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") +} +func (UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { + return status.Errorf(codes.Unimplemented, "method ListResource not implemented") +} +func (UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") +} +func (UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") +} +func (UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") +} +func (UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") +} +func (UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { + return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") +} +func (UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") +} +func (UnimplementedProviderServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + +// UnsafeProviderServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProviderServer will +// result in compilation errors. +type UnsafeProviderServer interface { + mustEmbedUnimplementedProviderServer() +} + +func RegisterProviderServer(s grpc.ServiceRegistrar, srv ProviderServer) { + s.RegisterService(&Provider_ServiceDesc, srv) +} + +func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMetadata_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetMetadata_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetSchema(ctx, req.(*GetProviderSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PrepareProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrepareProviderConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PrepareProviderConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_PrepareProviderConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PrepareProviderConfig(ctx, req.(*PrepareProviderConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateResourceTypeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateResourceTypeConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateResourceTypeConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, req.(*ValidateResourceTypeConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateDataSourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateDataSourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateDataSourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateDataSourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateDataSourceConfig(ctx, req.(*ValidateDataSourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_UpgradeResourceState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetResourceIdentitySchemas_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetResourceIdentitySchemas_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceIdentity_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_UpgradeResourceIdentity_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Configure_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).Configure(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_Configure_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).Configure(ctx, req.(*Configure_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ReadResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_PlanResourceChange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ApplyResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ApplyResourceChange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ImportResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ImportResourceState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MoveResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).MoveResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_MoveResourceState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadDataSource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadDataSource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ReadDataSource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GenerateResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GenerateResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateEphemeralResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateEphemeralResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).OpenEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_OpenEphemeralResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RenewEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).RenewEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_RenewEphemeralResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CloseEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_CloseEphemeralResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListResource_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) +} + +type Provider_ListResourceServer interface { + Send(*ListResource_Event) error + grpc.ServerStream +} + +type providerListResourceServer struct { + grpc.ServerStream +} + +func (x *providerListResourceServer) Send(m *ListResource_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateListResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateListResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFunctions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetFunctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetFunctions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CallFunction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CallFunction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_CallFunction_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanAction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanAction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_PlanAction_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(InvokeAction_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) +} + +type Provider_InvokeActionServer interface { + Send(*InvokeAction_Event) error + grpc.ServerStream +} + +type providerInvokeActionServer struct { + grpc.ServerStream +} + +func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateActionConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateActionConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateActionConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Stop_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).Stop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_Stop_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).Stop(ctx, req.(*Stop_Request)) + } + return interceptor(ctx, in, info, handler) +} + +// Provider_ServiceDesc is the grpc.ServiceDesc for Provider service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Provider_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "tfplugin5.Provider", + HandlerType: (*ProviderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetMetadata", + Handler: _Provider_GetMetadata_Handler, + }, + { + MethodName: "GetSchema", + Handler: _Provider_GetSchema_Handler, + }, + { + MethodName: "PrepareProviderConfig", + Handler: _Provider_PrepareProviderConfig_Handler, + }, + { + MethodName: "ValidateResourceTypeConfig", + Handler: _Provider_ValidateResourceTypeConfig_Handler, + }, + { + MethodName: "ValidateDataSourceConfig", + Handler: _Provider_ValidateDataSourceConfig_Handler, + }, + { + MethodName: "UpgradeResourceState", + Handler: _Provider_UpgradeResourceState_Handler, + }, + { + MethodName: "GetResourceIdentitySchemas", + Handler: _Provider_GetResourceIdentitySchemas_Handler, + }, + { + MethodName: "UpgradeResourceIdentity", + Handler: _Provider_UpgradeResourceIdentity_Handler, + }, + { + MethodName: "Configure", + Handler: _Provider_Configure_Handler, + }, + { + MethodName: "ReadResource", + Handler: _Provider_ReadResource_Handler, + }, + { + MethodName: "PlanResourceChange", + Handler: _Provider_PlanResourceChange_Handler, + }, + { + MethodName: "ApplyResourceChange", + Handler: _Provider_ApplyResourceChange_Handler, + }, + { + MethodName: "ImportResourceState", + Handler: _Provider_ImportResourceState_Handler, + }, + { + MethodName: "MoveResourceState", + Handler: _Provider_MoveResourceState_Handler, + }, + { + MethodName: "ReadDataSource", + Handler: _Provider_ReadDataSource_Handler, + }, + { + MethodName: "GenerateResourceConfig", + Handler: _Provider_GenerateResourceConfig_Handler, + }, + { + MethodName: "ValidateEphemeralResourceConfig", + Handler: _Provider_ValidateEphemeralResourceConfig_Handler, + }, + { + MethodName: "OpenEphemeralResource", + Handler: _Provider_OpenEphemeralResource_Handler, + }, + { + MethodName: "RenewEphemeralResource", + Handler: _Provider_RenewEphemeralResource_Handler, + }, + { + MethodName: "CloseEphemeralResource", + Handler: _Provider_CloseEphemeralResource_Handler, + }, + { + MethodName: "ValidateListResourceConfig", + Handler: _Provider_ValidateListResourceConfig_Handler, + }, + { + MethodName: "GetFunctions", + Handler: _Provider_GetFunctions_Handler, + }, + { + MethodName: "CallFunction", + Handler: _Provider_CallFunction_Handler, + }, + { + MethodName: "PlanAction", + Handler: _Provider_PlanAction_Handler, + }, + { + MethodName: "ValidateActionConfig", + Handler: _Provider_ValidateActionConfig_Handler, + }, + { + MethodName: "Stop", + Handler: _Provider_Stop_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListResource", + Handler: _Provider_ListResource_Handler, + ServerStreams: true, + }, + { + StreamName: "InvokeAction", + Handler: _Provider_InvokeAction_Handler, + ServerStreams: true, + }, + }, + Metadata: "tfplugin5.proto", +} + +const ( + Provisioner_GetSchema_FullMethodName = "/tfplugin5.Provisioner/GetSchema" + Provisioner_ValidateProvisionerConfig_FullMethodName = "/tfplugin5.Provisioner/ValidateProvisionerConfig" + Provisioner_ProvisionResource_FullMethodName = "/tfplugin5.Provisioner/ProvisionResource" + Provisioner_Stop_FullMethodName = "/tfplugin5.Provisioner/Stop" +) + +// ProvisionerClient is the client API for Provisioner service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ProvisionerClient interface { + GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) + ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) + ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) + Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) +} + +type provisionerClient struct { + cc grpc.ClientConnInterface +} + +func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient { + return &provisionerClient{cc} +} + +func (c *provisionerClient) GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) { + out := new(GetProvisionerSchema_Response) + err := c.cc.Invoke(ctx, Provisioner_GetSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionerClient) ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) { + out := new(ValidateProvisionerConfig_Response) + err := c.cc.Invoke(ctx, Provisioner_ValidateProvisionerConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionerClient) ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) { + stream, err := c.cc.NewStream(ctx, &Provisioner_ServiceDesc.Streams[0], Provisioner_ProvisionResource_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &provisionerProvisionResourceClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provisioner_ProvisionResourceClient interface { + Recv() (*ProvisionResource_Response, error) + grpc.ClientStream +} + +type provisionerProvisionResourceClient struct { + grpc.ClientStream +} + +func (x *provisionerProvisionResourceClient) Recv() (*ProvisionResource_Response, error) { + m := new(ProvisionResource_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *provisionerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { + out := new(Stop_Response) + err := c.cc.Invoke(ctx, Provisioner_Stop_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProvisionerServer is the server API for Provisioner service. +// All implementations should embed UnimplementedProvisionerServer +// for forward compatibility +type ProvisionerServer interface { + GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) + ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) + ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error + Stop(context.Context, *Stop_Request) (*Stop_Response, error) +} + +// UnimplementedProvisionerServer should be embedded to have forward compatible implementations. +type UnimplementedProvisionerServer struct { +} + +func (UnimplementedProvisionerServer) GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (UnimplementedProvisionerServer) ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateProvisionerConfig not implemented") +} +func (UnimplementedProvisionerServer) ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error { + return status.Errorf(codes.Unimplemented, "method ProvisionResource not implemented") +} +func (UnimplementedProvisionerServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + +// UnsafeProvisionerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProvisionerServer will +// result in compilation errors. +type UnsafeProvisionerServer interface { + mustEmbedUnimplementedProvisionerServer() +} + +func RegisterProvisionerServer(s grpc.ServiceRegistrar, srv ProvisionerServer) { + s.RegisterService(&Provisioner_ServiceDesc, srv) +} + +func _Provisioner_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProvisionerSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).GetSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provisioner_GetSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).GetSchema(ctx, req.(*GetProvisionerSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provisioner_ValidateProvisionerConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateProvisionerConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provisioner_ValidateProvisionerConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, req.(*ValidateProvisionerConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provisioner_ProvisionResource_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ProvisionResource_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProvisionerServer).ProvisionResource(m, &provisionerProvisionResourceServer{stream}) +} + +type Provisioner_ProvisionResourceServer interface { + Send(*ProvisionResource_Response) error + grpc.ServerStream +} + +type provisionerProvisionResourceServer struct { + grpc.ServerStream +} + +func (x *provisionerProvisionResourceServer) Send(m *ProvisionResource_Response) error { + return x.ServerStream.SendMsg(m) +} + +func _Provisioner_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Stop_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).Stop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provisioner_Stop_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).Stop(ctx, req.(*Stop_Request)) + } + return interceptor(ctx, in, info, handler) +} + +// Provisioner_ServiceDesc is the grpc.ServiceDesc for Provisioner service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Provisioner_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "tfplugin5.Provisioner", + HandlerType: (*ProvisionerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSchema", + Handler: _Provisioner_GetSchema_Handler, + }, + { + MethodName: "ValidateProvisionerConfig", + Handler: _Provisioner_ValidateProvisionerConfig_Handler, + }, + { + MethodName: "Stop", + Handler: _Provisioner_Stop_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ProvisionResource", + Handler: _Provisioner_ProvisionResource_Handler, + ServerStreams: true, + }, + }, + Metadata: "tfplugin5.proto", +} diff --git a/internal/tfplugin6/tfplugin6.pb.go b/internal/tfplugin6/tfplugin6.pb.go index 7351d20d959e..fbbea9c98d0a 100644 --- a/internal/tfplugin6/tfplugin6.pb.go +++ b/internal/tfplugin6/tfplugin6.pb.go @@ -28,10 +28,6 @@ package tfplugin6 import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" @@ -8787,1437 +8783,3 @@ func file_tfplugin6_proto_init() { file_tfplugin6_proto_goTypes = nil file_tfplugin6_proto_depIdxs = nil } - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ProviderClient is the client API for Provider service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ProviderClient interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) - ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) - ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) - ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) - UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) - PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) - ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) - ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) - MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) - ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) - GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) - ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) - // ValidateStateStoreConfig performs configuration validation - ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) - // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider - ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) - // ReadStateBytes streams byte chunks of a given state file from a state store - ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) - // WriteStateBytes streams byte chunks of a given state file into a state store - WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) - // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store - GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) - // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) - DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) - // ////// Actions - PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) - InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) - ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) -} - -type providerClient struct { - cc grpc.ClientConnInterface -} - -func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { - return &providerClient{cc} -} - -func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { - out := new(GetMetadata_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetMetadata", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { - out := new(GetProviderSchema_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetProviderSchema", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) { - out := new(ValidateProviderConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateProviderConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) { - out := new(ValidateResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) { - out := new(ValidateDataResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateDataResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { - out := new(UpgradeResourceState_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/UpgradeResourceState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { - out := new(GetResourceIdentitySchemas_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetResourceIdentitySchemas", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { - out := new(UpgradeResourceIdentity_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/UpgradeResourceIdentity", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) { - out := new(ConfigureProvider_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ConfigureProvider", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { - out := new(ReadResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ReadResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { - out := new(PlanResourceChange_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/PlanResourceChange", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { - out := new(ApplyResourceChange_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ApplyResourceChange", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { - out := new(ImportResourceState_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ImportResourceState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { - out := new(MoveResourceState_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/MoveResourceState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { - out := new(ReadDataSource_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ReadDataSource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { - out := new(GenerateResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GenerateResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { - out := new(ValidateEphemeralResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateEphemeralResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { - out := new(OpenEphemeralResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/OpenEphemeralResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { - out := new(RenewEphemeralResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/RenewEphemeralResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { - out := new(CloseEphemeralResource_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/CloseEphemeralResource", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[0], "/tfplugin6.Provider/ListResource", opts...) - if err != nil { - return nil, err - } - x := &providerListResourceClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_ListResourceClient interface { - Recv() (*ListResource_Event, error) - grpc.ClientStream -} - -type providerListResourceClient struct { - grpc.ClientStream -} - -func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { - m := new(ListResource_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { - out := new(ValidateListResourceConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateListResourceConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { - out := new(GetFunctions_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetFunctions", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { - out := new(CallFunction_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/CallFunction", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) { - out := new(ValidateStateStore_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateStateStoreConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) { - out := new(ConfigureStateStore_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ConfigureStateStore", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[1], "/tfplugin6.Provider/ReadStateBytes", opts...) - if err != nil { - return nil, err - } - x := &providerReadStateBytesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_ReadStateBytesClient interface { - Recv() (*ReadStateBytes_Response, error) - grpc.ClientStream -} - -type providerReadStateBytesClient struct { - grpc.ClientStream -} - -func (x *providerReadStateBytesClient) Recv() (*ReadStateBytes_Response, error) { - m := new(ReadStateBytes_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[2], "/tfplugin6.Provider/WriteStateBytes", opts...) - if err != nil { - return nil, err - } - x := &providerWriteStateBytesClient{stream} - return x, nil -} - -type Provider_WriteStateBytesClient interface { - Send(*WriteStateBytes_RequestChunk) error - CloseAndRecv() (*WriteStateBytes_Response, error) - grpc.ClientStream -} - -type providerWriteStateBytesClient struct { - grpc.ClientStream -} - -func (x *providerWriteStateBytesClient) Send(m *WriteStateBytes_RequestChunk) error { - return x.ClientStream.SendMsg(m) -} - -func (x *providerWriteStateBytesClient) CloseAndRecv() (*WriteStateBytes_Response, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(WriteStateBytes_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) { - out := new(GetStates_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetStates", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) { - out := new(DeleteState_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/DeleteState", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { - out := new(PlanAction_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/PlanAction", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { - stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[3], "/tfplugin6.Provider/InvokeAction", opts...) - if err != nil { - return nil, err - } - x := &providerInvokeActionClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_InvokeActionClient interface { - Recv() (*InvokeAction_Event, error) - grpc.ClientStream -} - -type providerInvokeActionClient struct { - grpc.ClientStream -} - -func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { - m := new(InvokeAction_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { - out := new(ValidateActionConfig_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateActionConfig", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) { - out := new(StopProvider_Response) - err := c.cc.Invoke(ctx, "/tfplugin6.Provider/StopProvider", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProviderServer is the server API for Provider service. -type ProviderServer interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) - ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) - ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) - ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) - UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) - PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) - ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) - ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) - MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) - ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) - GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(*ListResource_Request, Provider_ListResourceServer) error - ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) - // ValidateStateStoreConfig performs configuration validation - ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) - // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider - ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) - // ReadStateBytes streams byte chunks of a given state file from a state store - ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error - // WriteStateBytes streams byte chunks of a given state file into a state store - WriteStateBytes(Provider_WriteStateBytesServer) error - // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store - GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) - // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) - DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) - // ////// Actions - PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) - InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error - ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) -} - -// UnimplementedProviderServer can be embedded to have forward compatible implementations. -type UnimplementedProviderServer struct { -} - -func (*UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") -} -func (*UnimplementedProviderServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") -} -func (*UnimplementedProviderServer) ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateProviderConfig not implemented") -} -func (*UnimplementedProviderServer) ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceConfig not implemented") -} -func (*UnimplementedProviderServer) ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateDataResourceConfig not implemented") -} -func (*UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") -} -func (*UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") -} -func (*UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") -} -func (*UnimplementedProviderServer) ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigureProvider not implemented") -} -func (*UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") -} -func (*UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") -} -func (*UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") -} -func (*UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") -} -func (*UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") -} -func (*UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") -} -func (*UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") -} -func (*UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") -} -func (*UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") -} -func (*UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") -} -func (*UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") -} -func (*UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { - return status.Errorf(codes.Unimplemented, "method ListResource not implemented") -} -func (*UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") -} -func (*UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") -} -func (*UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") -} -func (*UnimplementedProviderServer) ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateStateStoreConfig not implemented") -} -func (*UnimplementedProviderServer) ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigureStateStore not implemented") -} -func (*UnimplementedProviderServer) ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error { - return status.Errorf(codes.Unimplemented, "method ReadStateBytes not implemented") -} -func (*UnimplementedProviderServer) WriteStateBytes(Provider_WriteStateBytesServer) error { - return status.Errorf(codes.Unimplemented, "method WriteStateBytes not implemented") -} -func (*UnimplementedProviderServer) GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetStates not implemented") -} -func (*UnimplementedProviderServer) DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteState not implemented") -} -func (*UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") -} -func (*UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { - return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") -} -func (*UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") -} -func (*UnimplementedProviderServer) StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopProvider not implemented") -} - -func RegisterProviderServer(s *grpc.Server, srv ProviderServer) { - s.RegisterService(&_Provider_serviceDesc, srv) -} - -func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMetadata_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/GetMetadata", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetProviderSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/GetProviderSchema", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateProviderConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateProviderConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ValidateProviderConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateProviderConfig(ctx, req.(*ValidateProviderConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ValidateResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateResourceConfig(ctx, req.(*ValidateResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateDataResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateDataResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateDataResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ValidateDataResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateDataResourceConfig(ctx, req.(*ValidateDataResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/UpgradeResourceState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetResourceIdentitySchemas_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/GetResourceIdentitySchemas", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceIdentity_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/UpgradeResourceIdentity", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ConfigureProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigureProvider_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ConfigureProvider(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ConfigureProvider", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ConfigureProvider(ctx, req.(*ConfigureProvider_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ReadResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/PlanResourceChange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ApplyResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ApplyResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ApplyResourceChange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ImportResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ImportResourceState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MoveResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).MoveResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/MoveResourceState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadDataSource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadDataSource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ReadDataSource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GenerateResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GenerateResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/GenerateResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateEphemeralResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ValidateEphemeralResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).OpenEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/OpenEphemeralResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RenewEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).RenewEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/RenewEphemeralResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CloseEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/CloseEphemeralResource", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListResource_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) -} - -type Provider_ListResourceServer interface { - Send(*ListResource_Event) error - grpc.ServerStream -} - -type providerListResourceServer struct { - grpc.ServerStream -} - -func (x *providerListResourceServer) Send(m *ListResource_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateListResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ValidateListResourceConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFunctions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetFunctions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/GetFunctions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CallFunction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CallFunction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/CallFunction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateStateStoreConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateStateStore_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateStateStoreConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ValidateStateStoreConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateStateStoreConfig(ctx, req.(*ValidateStateStore_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ConfigureStateStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigureStateStore_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ConfigureStateStore(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ConfigureStateStore", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ConfigureStateStore(ctx, req.(*ConfigureStateStore_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ReadStateBytes_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).ReadStateBytes(m, &providerReadStateBytesServer{stream}) -} - -type Provider_ReadStateBytesServer interface { - Send(*ReadStateBytes_Response) error - grpc.ServerStream -} - -type providerReadStateBytesServer struct { - grpc.ServerStream -} - -func (x *providerReadStateBytesServer) Send(m *ReadStateBytes_Response) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_WriteStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ProviderServer).WriteStateBytes(&providerWriteStateBytesServer{stream}) -} - -type Provider_WriteStateBytesServer interface { - SendAndClose(*WriteStateBytes_Response) error - Recv() (*WriteStateBytes_RequestChunk, error) - grpc.ServerStream -} - -type providerWriteStateBytesServer struct { - grpc.ServerStream -} - -func (x *providerWriteStateBytesServer) SendAndClose(m *WriteStateBytes_Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *providerWriteStateBytesServer) Recv() (*WriteStateBytes_RequestChunk, error) { - m := new(WriteStateBytes_RequestChunk) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Provider_GetStates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetStates_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetStates(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/GetStates", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetStates(ctx, req.(*GetStates_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_DeleteState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).DeleteState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/DeleteState", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).DeleteState(ctx, req.(*DeleteState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanAction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanAction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/PlanAction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(InvokeAction_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) -} - -type Provider_InvokeActionServer interface { - Send(*InvokeAction_Event) error - grpc.ServerStream -} - -type providerInvokeActionServer struct { - grpc.ServerStream -} - -func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateActionConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateActionConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/ValidateActionConfig", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_StopProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopProvider_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).StopProvider(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/tfplugin6.Provider/StopProvider", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).StopProvider(ctx, req.(*StopProvider_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Provider_serviceDesc = grpc.ServiceDesc{ - ServiceName: "tfplugin6.Provider", - HandlerType: (*ProviderServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetMetadata", - Handler: _Provider_GetMetadata_Handler, - }, - { - MethodName: "GetProviderSchema", - Handler: _Provider_GetProviderSchema_Handler, - }, - { - MethodName: "ValidateProviderConfig", - Handler: _Provider_ValidateProviderConfig_Handler, - }, - { - MethodName: "ValidateResourceConfig", - Handler: _Provider_ValidateResourceConfig_Handler, - }, - { - MethodName: "ValidateDataResourceConfig", - Handler: _Provider_ValidateDataResourceConfig_Handler, - }, - { - MethodName: "UpgradeResourceState", - Handler: _Provider_UpgradeResourceState_Handler, - }, - { - MethodName: "GetResourceIdentitySchemas", - Handler: _Provider_GetResourceIdentitySchemas_Handler, - }, - { - MethodName: "UpgradeResourceIdentity", - Handler: _Provider_UpgradeResourceIdentity_Handler, - }, - { - MethodName: "ConfigureProvider", - Handler: _Provider_ConfigureProvider_Handler, - }, - { - MethodName: "ReadResource", - Handler: _Provider_ReadResource_Handler, - }, - { - MethodName: "PlanResourceChange", - Handler: _Provider_PlanResourceChange_Handler, - }, - { - MethodName: "ApplyResourceChange", - Handler: _Provider_ApplyResourceChange_Handler, - }, - { - MethodName: "ImportResourceState", - Handler: _Provider_ImportResourceState_Handler, - }, - { - MethodName: "MoveResourceState", - Handler: _Provider_MoveResourceState_Handler, - }, - { - MethodName: "ReadDataSource", - Handler: _Provider_ReadDataSource_Handler, - }, - { - MethodName: "GenerateResourceConfig", - Handler: _Provider_GenerateResourceConfig_Handler, - }, - { - MethodName: "ValidateEphemeralResourceConfig", - Handler: _Provider_ValidateEphemeralResourceConfig_Handler, - }, - { - MethodName: "OpenEphemeralResource", - Handler: _Provider_OpenEphemeralResource_Handler, - }, - { - MethodName: "RenewEphemeralResource", - Handler: _Provider_RenewEphemeralResource_Handler, - }, - { - MethodName: "CloseEphemeralResource", - Handler: _Provider_CloseEphemeralResource_Handler, - }, - { - MethodName: "ValidateListResourceConfig", - Handler: _Provider_ValidateListResourceConfig_Handler, - }, - { - MethodName: "GetFunctions", - Handler: _Provider_GetFunctions_Handler, - }, - { - MethodName: "CallFunction", - Handler: _Provider_CallFunction_Handler, - }, - { - MethodName: "ValidateStateStoreConfig", - Handler: _Provider_ValidateStateStoreConfig_Handler, - }, - { - MethodName: "ConfigureStateStore", - Handler: _Provider_ConfigureStateStore_Handler, - }, - { - MethodName: "GetStates", - Handler: _Provider_GetStates_Handler, - }, - { - MethodName: "DeleteState", - Handler: _Provider_DeleteState_Handler, - }, - { - MethodName: "PlanAction", - Handler: _Provider_PlanAction_Handler, - }, - { - MethodName: "ValidateActionConfig", - Handler: _Provider_ValidateActionConfig_Handler, - }, - { - MethodName: "StopProvider", - Handler: _Provider_StopProvider_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ListResource", - Handler: _Provider_ListResource_Handler, - ServerStreams: true, - }, - { - StreamName: "ReadStateBytes", - Handler: _Provider_ReadStateBytes_Handler, - ServerStreams: true, - }, - { - StreamName: "WriteStateBytes", - Handler: _Provider_WriteStateBytes_Handler, - ClientStreams: true, - }, - { - StreamName: "InvokeAction", - Handler: _Provider_InvokeAction_Handler, - ServerStreams: true, - }, - }, - Metadata: "tfplugin6.proto", -} diff --git a/internal/tfplugin6/tfplugin6_grpc.pb.go b/internal/tfplugin6/tfplugin6_grpc.pb.go new file mode 100644 index 000000000000..d1baecae02e1 --- /dev/null +++ b/internal/tfplugin6/tfplugin6_grpc.pb.go @@ -0,0 +1,1515 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// Terraform Plugin RPC protocol version 6.10 +// +// This file defines version 6.10 of the RPC protocol. To implement a plugin +// against this protocol, copy this definition into your own codebase and +// use protoc to generate stubs for your target language. +// +// Any minor versions of protocol 6 to follow should modify this file while +// maintaining backwards compatibility. Breaking changes, if any are required, +// will come in a subsequent major version with its own separate proto definition. +// +// Note that only the proto files included in a release tag of Terraform are +// official protocol releases. Proto files taken from other commits may include +// incomplete changes or features that did not make it into a final release. +// In all reasonable cases, plugin developers should take the proto file from +// the tag of the most recent release of Terraform, and not from the main +// branch or any other development branch. +// + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.15.6 +// source: tfplugin6.proto + +package tfplugin6 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + Provider_GetMetadata_FullMethodName = "/tfplugin6.Provider/GetMetadata" + Provider_GetProviderSchema_FullMethodName = "/tfplugin6.Provider/GetProviderSchema" + Provider_ValidateProviderConfig_FullMethodName = "/tfplugin6.Provider/ValidateProviderConfig" + Provider_ValidateResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateResourceConfig" + Provider_ValidateDataResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateDataResourceConfig" + Provider_UpgradeResourceState_FullMethodName = "/tfplugin6.Provider/UpgradeResourceState" + Provider_GetResourceIdentitySchemas_FullMethodName = "/tfplugin6.Provider/GetResourceIdentitySchemas" + Provider_UpgradeResourceIdentity_FullMethodName = "/tfplugin6.Provider/UpgradeResourceIdentity" + Provider_ConfigureProvider_FullMethodName = "/tfplugin6.Provider/ConfigureProvider" + Provider_ReadResource_FullMethodName = "/tfplugin6.Provider/ReadResource" + Provider_PlanResourceChange_FullMethodName = "/tfplugin6.Provider/PlanResourceChange" + Provider_ApplyResourceChange_FullMethodName = "/tfplugin6.Provider/ApplyResourceChange" + Provider_ImportResourceState_FullMethodName = "/tfplugin6.Provider/ImportResourceState" + Provider_MoveResourceState_FullMethodName = "/tfplugin6.Provider/MoveResourceState" + Provider_ReadDataSource_FullMethodName = "/tfplugin6.Provider/ReadDataSource" + Provider_GenerateResourceConfig_FullMethodName = "/tfplugin6.Provider/GenerateResourceConfig" + Provider_ValidateEphemeralResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateEphemeralResourceConfig" + Provider_OpenEphemeralResource_FullMethodName = "/tfplugin6.Provider/OpenEphemeralResource" + Provider_RenewEphemeralResource_FullMethodName = "/tfplugin6.Provider/RenewEphemeralResource" + Provider_CloseEphemeralResource_FullMethodName = "/tfplugin6.Provider/CloseEphemeralResource" + Provider_ListResource_FullMethodName = "/tfplugin6.Provider/ListResource" + Provider_ValidateListResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateListResourceConfig" + Provider_GetFunctions_FullMethodName = "/tfplugin6.Provider/GetFunctions" + Provider_CallFunction_FullMethodName = "/tfplugin6.Provider/CallFunction" + Provider_ValidateStateStoreConfig_FullMethodName = "/tfplugin6.Provider/ValidateStateStoreConfig" + Provider_ConfigureStateStore_FullMethodName = "/tfplugin6.Provider/ConfigureStateStore" + Provider_ReadStateBytes_FullMethodName = "/tfplugin6.Provider/ReadStateBytes" + Provider_WriteStateBytes_FullMethodName = "/tfplugin6.Provider/WriteStateBytes" + Provider_GetStates_FullMethodName = "/tfplugin6.Provider/GetStates" + Provider_DeleteState_FullMethodName = "/tfplugin6.Provider/DeleteState" + Provider_PlanAction_FullMethodName = "/tfplugin6.Provider/PlanAction" + Provider_InvokeAction_FullMethodName = "/tfplugin6.Provider/InvokeAction" + Provider_ValidateActionConfig_FullMethodName = "/tfplugin6.Provider/ValidateActionConfig" + Provider_StopProvider_FullMethodName = "/tfplugin6.Provider/StopProvider" +) + +// ProviderClient is the client API for Provider service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ProviderClient interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) + ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) + ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) + ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) + UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) + PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) + ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) + ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) + MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) + ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) + GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) + ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) + // ValidateStateStoreConfig performs configuration validation + ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) + // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider + ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) + // ReadStateBytes streams byte chunks of a given state file from a state store + ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) + // WriteStateBytes streams byte chunks of a given state file into a state store + WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) + // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store + GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) + // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) + DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) + // ////// Actions + PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) + InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) + ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) +} + +type providerClient struct { + cc grpc.ClientConnInterface +} + +func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { + return &providerClient{cc} +} + +func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { + out := new(GetMetadata_Response) + err := c.cc.Invoke(ctx, Provider_GetMetadata_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { + out := new(GetProviderSchema_Response) + err := c.cc.Invoke(ctx, Provider_GetProviderSchema_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) { + out := new(ValidateProviderConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateProviderConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) { + out := new(ValidateResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) { + out := new(ValidateDataResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateDataResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { + out := new(UpgradeResourceState_Response) + err := c.cc.Invoke(ctx, Provider_UpgradeResourceState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { + out := new(GetResourceIdentitySchemas_Response) + err := c.cc.Invoke(ctx, Provider_GetResourceIdentitySchemas_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { + out := new(UpgradeResourceIdentity_Response) + err := c.cc.Invoke(ctx, Provider_UpgradeResourceIdentity_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) { + out := new(ConfigureProvider_Response) + err := c.cc.Invoke(ctx, Provider_ConfigureProvider_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { + out := new(ReadResource_Response) + err := c.cc.Invoke(ctx, Provider_ReadResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { + out := new(PlanResourceChange_Response) + err := c.cc.Invoke(ctx, Provider_PlanResourceChange_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { + out := new(ApplyResourceChange_Response) + err := c.cc.Invoke(ctx, Provider_ApplyResourceChange_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { + out := new(ImportResourceState_Response) + err := c.cc.Invoke(ctx, Provider_ImportResourceState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { + out := new(MoveResourceState_Response) + err := c.cc.Invoke(ctx, Provider_MoveResourceState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { + out := new(ReadDataSource_Response) + err := c.cc.Invoke(ctx, Provider_ReadDataSource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { + out := new(GenerateResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_GenerateResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { + out := new(ValidateEphemeralResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateEphemeralResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { + out := new(OpenEphemeralResource_Response) + err := c.cc.Invoke(ctx, Provider_OpenEphemeralResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { + out := new(RenewEphemeralResource_Response) + err := c.cc.Invoke(ctx, Provider_RenewEphemeralResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { + out := new(CloseEphemeralResource_Response) + err := c.cc.Invoke(ctx, Provider_CloseEphemeralResource_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { + stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[0], Provider_ListResource_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &providerListResourceClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_ListResourceClient interface { + Recv() (*ListResource_Event, error) + grpc.ClientStream +} + +type providerListResourceClient struct { + grpc.ClientStream +} + +func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { + m := new(ListResource_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { + out := new(ValidateListResourceConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateListResourceConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { + out := new(GetFunctions_Response) + err := c.cc.Invoke(ctx, Provider_GetFunctions_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { + out := new(CallFunction_Response) + err := c.cc.Invoke(ctx, Provider_CallFunction_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) { + out := new(ValidateStateStore_Response) + err := c.cc.Invoke(ctx, Provider_ValidateStateStoreConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) { + out := new(ConfigureStateStore_Response) + err := c.cc.Invoke(ctx, Provider_ConfigureStateStore_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) { + stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[1], Provider_ReadStateBytes_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &providerReadStateBytesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_ReadStateBytesClient interface { + Recv() (*ReadStateBytes_Response, error) + grpc.ClientStream +} + +type providerReadStateBytesClient struct { + grpc.ClientStream +} + +func (x *providerReadStateBytesClient) Recv() (*ReadStateBytes_Response, error) { + m := new(ReadStateBytes_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) { + stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[2], Provider_WriteStateBytes_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &providerWriteStateBytesClient{stream} + return x, nil +} + +type Provider_WriteStateBytesClient interface { + Send(*WriteStateBytes_RequestChunk) error + CloseAndRecv() (*WriteStateBytes_Response, error) + grpc.ClientStream +} + +type providerWriteStateBytesClient struct { + grpc.ClientStream +} + +func (x *providerWriteStateBytesClient) Send(m *WriteStateBytes_RequestChunk) error { + return x.ClientStream.SendMsg(m) +} + +func (x *providerWriteStateBytesClient) CloseAndRecv() (*WriteStateBytes_Response, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(WriteStateBytes_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) { + out := new(GetStates_Response) + err := c.cc.Invoke(ctx, Provider_GetStates_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) { + out := new(DeleteState_Response) + err := c.cc.Invoke(ctx, Provider_DeleteState_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { + out := new(PlanAction_Response) + err := c.cc.Invoke(ctx, Provider_PlanAction_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { + stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[3], Provider_InvokeAction_FullMethodName, opts...) + if err != nil { + return nil, err + } + x := &providerInvokeActionClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_InvokeActionClient interface { + Recv() (*InvokeAction_Event, error) + grpc.ClientStream +} + +type providerInvokeActionClient struct { + grpc.ClientStream +} + +func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { + m := new(InvokeAction_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { + out := new(ValidateActionConfig_Response) + err := c.cc.Invoke(ctx, Provider_ValidateActionConfig_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) { + out := new(StopProvider_Response) + err := c.cc.Invoke(ctx, Provider_StopProvider_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProviderServer is the server API for Provider service. +// All implementations should embed UnimplementedProviderServer +// for forward compatibility +type ProviderServer interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) + ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) + ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) + ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) + UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) + PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) + ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) + ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) + MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) + ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) + GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(*ListResource_Request, Provider_ListResourceServer) error + ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) + // ValidateStateStoreConfig performs configuration validation + ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) + // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider + ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) + // ReadStateBytes streams byte chunks of a given state file from a state store + ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error + // WriteStateBytes streams byte chunks of a given state file into a state store + WriteStateBytes(Provider_WriteStateBytesServer) error + // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store + GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) + // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) + DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) + // ////// Actions + PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) + InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error + ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) +} + +// UnimplementedProviderServer should be embedded to have forward compatible implementations. +type UnimplementedProviderServer struct { +} + +func (UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") +} +func (UnimplementedProviderServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") +} +func (UnimplementedProviderServer) ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateProviderConfig not implemented") +} +func (UnimplementedProviderServer) ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceConfig not implemented") +} +func (UnimplementedProviderServer) ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateDataResourceConfig not implemented") +} +func (UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") +} +func (UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") +} +func (UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") +} +func (UnimplementedProviderServer) ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigureProvider not implemented") +} +func (UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") +} +func (UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") +} +func (UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") +} +func (UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") +} +func (UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") +} +func (UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") +} +func (UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") +} +func (UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") +} +func (UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") +} +func (UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") +} +func (UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") +} +func (UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { + return status.Errorf(codes.Unimplemented, "method ListResource not implemented") +} +func (UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") +} +func (UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") +} +func (UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") +} +func (UnimplementedProviderServer) ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateStateStoreConfig not implemented") +} +func (UnimplementedProviderServer) ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigureStateStore not implemented") +} +func (UnimplementedProviderServer) ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error { + return status.Errorf(codes.Unimplemented, "method ReadStateBytes not implemented") +} +func (UnimplementedProviderServer) WriteStateBytes(Provider_WriteStateBytesServer) error { + return status.Errorf(codes.Unimplemented, "method WriteStateBytes not implemented") +} +func (UnimplementedProviderServer) GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStates not implemented") +} +func (UnimplementedProviderServer) DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteState not implemented") +} +func (UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") +} +func (UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { + return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") +} +func (UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") +} +func (UnimplementedProviderServer) StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopProvider not implemented") +} + +// UnsafeProviderServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ProviderServer will +// result in compilation errors. +type UnsafeProviderServer interface { + mustEmbedUnimplementedProviderServer() +} + +func RegisterProviderServer(s grpc.ServiceRegistrar, srv ProviderServer) { + s.RegisterService(&Provider_ServiceDesc, srv) +} + +func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMetadata_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetMetadata_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetProviderSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetProviderSchema_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateProviderConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateProviderConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateProviderConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateProviderConfig(ctx, req.(*ValidateProviderConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateResourceConfig(ctx, req.(*ValidateResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateDataResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateDataResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateDataResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateDataResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateDataResourceConfig(ctx, req.(*ValidateDataResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_UpgradeResourceState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetResourceIdentitySchemas_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetResourceIdentitySchemas_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceIdentity_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_UpgradeResourceIdentity_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ConfigureProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigureProvider_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ConfigureProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ConfigureProvider_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ConfigureProvider(ctx, req.(*ConfigureProvider_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ReadResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_PlanResourceChange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ApplyResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ApplyResourceChange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ImportResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ImportResourceState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MoveResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).MoveResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_MoveResourceState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadDataSource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadDataSource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ReadDataSource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GenerateResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GenerateResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateEphemeralResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateEphemeralResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).OpenEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_OpenEphemeralResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RenewEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).RenewEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_RenewEphemeralResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CloseEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_CloseEphemeralResource_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListResource_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) +} + +type Provider_ListResourceServer interface { + Send(*ListResource_Event) error + grpc.ServerStream +} + +type providerListResourceServer struct { + grpc.ServerStream +} + +func (x *providerListResourceServer) Send(m *ListResource_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateListResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateListResourceConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFunctions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetFunctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetFunctions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CallFunction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CallFunction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_CallFunction_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateStateStoreConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateStateStore_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateStateStoreConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateStateStoreConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateStateStoreConfig(ctx, req.(*ValidateStateStore_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ConfigureStateStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigureStateStore_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ConfigureStateStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ConfigureStateStore_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ConfigureStateStore(ctx, req.(*ConfigureStateStore_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ReadStateBytes_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).ReadStateBytes(m, &providerReadStateBytesServer{stream}) +} + +type Provider_ReadStateBytesServer interface { + Send(*ReadStateBytes_Response) error + grpc.ServerStream +} + +type providerReadStateBytesServer struct { + grpc.ServerStream +} + +func (x *providerReadStateBytesServer) Send(m *ReadStateBytes_Response) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_WriteStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ProviderServer).WriteStateBytes(&providerWriteStateBytesServer{stream}) +} + +type Provider_WriteStateBytesServer interface { + SendAndClose(*WriteStateBytes_Response) error + Recv() (*WriteStateBytes_RequestChunk, error) + grpc.ServerStream +} + +type providerWriteStateBytesServer struct { + grpc.ServerStream +} + +func (x *providerWriteStateBytesServer) SendAndClose(m *WriteStateBytes_Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *providerWriteStateBytesServer) Recv() (*WriteStateBytes_RequestChunk, error) { + m := new(WriteStateBytes_RequestChunk) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Provider_GetStates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStates_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetStates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_GetStates_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetStates(ctx, req.(*GetStates_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_DeleteState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).DeleteState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_DeleteState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).DeleteState(ctx, req.(*DeleteState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanAction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanAction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_PlanAction_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(InvokeAction_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) +} + +type Provider_InvokeActionServer interface { + Send(*InvokeAction_Event) error + grpc.ServerStream +} + +type providerInvokeActionServer struct { + grpc.ServerStream +} + +func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateActionConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateActionConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_ValidateActionConfig_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_StopProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopProvider_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).StopProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Provider_StopProvider_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).StopProvider(ctx, req.(*StopProvider_Request)) + } + return interceptor(ctx, in, info, handler) +} + +// Provider_ServiceDesc is the grpc.ServiceDesc for Provider service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Provider_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "tfplugin6.Provider", + HandlerType: (*ProviderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetMetadata", + Handler: _Provider_GetMetadata_Handler, + }, + { + MethodName: "GetProviderSchema", + Handler: _Provider_GetProviderSchema_Handler, + }, + { + MethodName: "ValidateProviderConfig", + Handler: _Provider_ValidateProviderConfig_Handler, + }, + { + MethodName: "ValidateResourceConfig", + Handler: _Provider_ValidateResourceConfig_Handler, + }, + { + MethodName: "ValidateDataResourceConfig", + Handler: _Provider_ValidateDataResourceConfig_Handler, + }, + { + MethodName: "UpgradeResourceState", + Handler: _Provider_UpgradeResourceState_Handler, + }, + { + MethodName: "GetResourceIdentitySchemas", + Handler: _Provider_GetResourceIdentitySchemas_Handler, + }, + { + MethodName: "UpgradeResourceIdentity", + Handler: _Provider_UpgradeResourceIdentity_Handler, + }, + { + MethodName: "ConfigureProvider", + Handler: _Provider_ConfigureProvider_Handler, + }, + { + MethodName: "ReadResource", + Handler: _Provider_ReadResource_Handler, + }, + { + MethodName: "PlanResourceChange", + Handler: _Provider_PlanResourceChange_Handler, + }, + { + MethodName: "ApplyResourceChange", + Handler: _Provider_ApplyResourceChange_Handler, + }, + { + MethodName: "ImportResourceState", + Handler: _Provider_ImportResourceState_Handler, + }, + { + MethodName: "MoveResourceState", + Handler: _Provider_MoveResourceState_Handler, + }, + { + MethodName: "ReadDataSource", + Handler: _Provider_ReadDataSource_Handler, + }, + { + MethodName: "GenerateResourceConfig", + Handler: _Provider_GenerateResourceConfig_Handler, + }, + { + MethodName: "ValidateEphemeralResourceConfig", + Handler: _Provider_ValidateEphemeralResourceConfig_Handler, + }, + { + MethodName: "OpenEphemeralResource", + Handler: _Provider_OpenEphemeralResource_Handler, + }, + { + MethodName: "RenewEphemeralResource", + Handler: _Provider_RenewEphemeralResource_Handler, + }, + { + MethodName: "CloseEphemeralResource", + Handler: _Provider_CloseEphemeralResource_Handler, + }, + { + MethodName: "ValidateListResourceConfig", + Handler: _Provider_ValidateListResourceConfig_Handler, + }, + { + MethodName: "GetFunctions", + Handler: _Provider_GetFunctions_Handler, + }, + { + MethodName: "CallFunction", + Handler: _Provider_CallFunction_Handler, + }, + { + MethodName: "ValidateStateStoreConfig", + Handler: _Provider_ValidateStateStoreConfig_Handler, + }, + { + MethodName: "ConfigureStateStore", + Handler: _Provider_ConfigureStateStore_Handler, + }, + { + MethodName: "GetStates", + Handler: _Provider_GetStates_Handler, + }, + { + MethodName: "DeleteState", + Handler: _Provider_DeleteState_Handler, + }, + { + MethodName: "PlanAction", + Handler: _Provider_PlanAction_Handler, + }, + { + MethodName: "ValidateActionConfig", + Handler: _Provider_ValidateActionConfig_Handler, + }, + { + MethodName: "StopProvider", + Handler: _Provider_StopProvider_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListResource", + Handler: _Provider_ListResource_Handler, + ServerStreams: true, + }, + { + StreamName: "ReadStateBytes", + Handler: _Provider_ReadStateBytes_Handler, + ServerStreams: true, + }, + { + StreamName: "WriteStateBytes", + Handler: _Provider_WriteStateBytes_Handler, + ClientStreams: true, + }, + { + StreamName: "InvokeAction", + Handler: _Provider_InvokeAction_Handler, + ServerStreams: true, + }, + }, + Metadata: "tfplugin6.proto", +} diff --git a/tools/protobuf-compile/protobuf-compile.go b/tools/protobuf-compile/protobuf-compile.go index 95a1c3cb5f9b..c3e950f8b130 100644 --- a/tools/protobuf-compile/protobuf-compile.go +++ b/tools/protobuf-compile/protobuf-compile.go @@ -33,9 +33,7 @@ const protocVersion = "3.15.6" // in Go modules our version selection for these comes from our top-level // go.mod, as with all other Go dependencies. If you want to switch to a newer // version of either tool then you can upgrade their modules in the usual way. -// -// TODO: Swap to using google.golang.org/protobuf/cmd/protoc-gen-go -const protocGenGoPackage = "github.com/golang/protobuf/protoc-gen-go" +const protocGenGoPackage = "google.golang.org/protobuf/cmd/protoc-gen-go" const protocGenGoGrpcPackage = "google.golang.org/grpc/cmd/protoc-gen-go-grpc" type protocStep struct { @@ -48,30 +46,68 @@ var protocSteps = []protocStep{ { "tfplugin5 (provider wire protocol version 5)", "internal/tfplugin5", - []string{"--go_out=paths=source_relative,plugins=grpc:.", "./tfplugin5.proto"}, + []string{ + "--go_out=.", + "--go_opt=paths=source_relative", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=require_unimplemented_servers=false", + "./tfplugin5.proto", + }, }, { "tfplugin6 (provider wire protocol version 6)", "internal/tfplugin6", - []string{"--go_out=paths=source_relative,plugins=grpc:.", "./tfplugin6.proto"}, + []string{ + "--go_out=.", + "--go_opt=paths=source_relative", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=require_unimplemented_servers=false", + "./tfplugin6.proto", + }, }, { "terraform1 (Terraform Core RPC API)", "internal/rpcapi/terraform1", - []string{"--go_out=paths=source_relative,plugins=grpc:.", "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", "./terraform1.proto"}, + []string{ + "--go_out=.", + "--go_opt=paths=source_relative", + "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", + "--go-grpc_opt=require_unimplemented_servers=false", + "./terraform1.proto", + }, }, { "terraform1 (Terraform Core RPC API) setup", "internal/rpcapi/terraform1/setup", - []string{"--go_out=paths=source_relative,plugins=grpc:.", "--go_opt=Msetup.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/setup", "./setup.proto"}, + []string{ + "--go_out=.", + "--go_opt=paths=source_relative", + "--go_opt=Msetup.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/setup", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=Msetup.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/setup", + "--go-grpc_opt=require_unimplemented_servers=false", + "./setup.proto", + }, }, { "terraform1 (Terraform Core RPC API) dependencies", "internal/rpcapi/terraform1/dependencies", []string{ - "--go_out=paths=source_relative,plugins=grpc:.", + "--go_out=.", + "--go_opt=paths=source_relative", "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", "--go_opt=Mdependencies.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/dependencies", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", + "--go-grpc_opt=Mdependencies.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/dependencies", + "--go-grpc_opt=require_unimplemented_servers=false", "-I.", "-I..", "./dependencies.proto", @@ -81,9 +117,15 @@ var protocSteps = []protocStep{ "terraform1 (Terraform Core RPC API) stacks", "internal/rpcapi/terraform1/stacks", []string{ - "--go_out=paths=source_relative,plugins=grpc:.", + "--go_out=.", + "--go_opt=paths=source_relative", "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", "--go_opt=Mstacks.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/stacks", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", + "--go-grpc_opt=Mstacks.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/stacks", + "--go-grpc_opt=require_unimplemented_servers=false", "-I.", "-I..", "./stacks.proto", @@ -93,9 +135,15 @@ var protocSteps = []protocStep{ "terraform1 (Terraform Core RPC API) packages", "internal/rpcapi/terraform1/packages", []string{ - "--go_out=paths=source_relative,plugins=grpc:.", - "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", + "--go_out=.", + "--go_opt=paths=source_relative", "--go_opt=Mpackages.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/packages", + "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=Mpackages.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/packages", + "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", + "--go-grpc_opt=require_unimplemented_servers=false", "-I.", "-I..", "./packages.proto", @@ -104,22 +152,45 @@ var protocSteps = []protocStep{ { "tfplan (plan file serialization)", "internal/plans/planproto", - []string{"--go_out=paths=source_relative:.", "planfile.proto"}, + []string{ + "--go_out=paths=source_relative:.", + "planfile.proto", + }, }, { "tfstackdata1 (Internal data formats for Stack state and plan)", "internal/stacks/tfstackdata1", - []string{"--go_out=paths=source_relative:.", "--go_opt=Mtfstackdata1.proto=github.com/hashicorp/terraform/internal/stacks/tfstackdata1", "-I.", "-I../../plans/planproto", "./tfstackdata1.proto"}, + []string{ + "--go_out=paths=source_relative:.", + "--go_opt=Mtfstackdata1.proto=github.com/hashicorp/terraform/internal/stacks/tfstackdata1", + "-I.", + "-I../../plans/planproto", + "./tfstackdata1.proto", + }, }, { "cloudproto1 (cloud protocol version 1)", "internal/cloudplugin/cloudproto1", - []string{"--go_out=paths=source_relative,plugins=grpc:.", "cloudproto1.proto"}, + []string{ + "--go_out=.", + "--go_opt=paths=source_relative", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=require_unimplemented_servers=false", + "cloudproto1.proto", + }, }, { "stacksproto1 (stacks protocol version 1)", "internal/stacksplugin/stacksproto1", - []string{"--go_out=paths=source_relative,plugins=grpc:.", "stacksproto1.proto"}, + []string{ + "--go_out=.", + "--go_opt=paths=source_relative", + "--go-grpc_out=.", + "--go-grpc_opt=paths=source_relative", + "--go-grpc_opt=require_unimplemented_servers=false", + "stacksproto1.proto", + }, }, } @@ -183,6 +254,10 @@ func main() { Stdout: os.Stdout, Stderr: os.Stderr, } + log.Printf("running command: %s", cmd.String()) + wd, _ := os.Getwd() + log.Printf("from directory: %s", wd) + err := cmd.Run() if err != nil { log.Printf("failed to compile: %s", err) From 898665193c46642dfddef38a5d47ea2fb4cdcdc9 Mon Sep 17 00:00:00 2001 From: Liam Cervante Date: Wed, 1 Oct 2025 09:52:41 +0200 Subject: [PATCH 22/27] actions: disable support for deferrals (#37700) --- internal/plans/deferring/deferred.go | 68 +++---- .../terraform/context_plan_actions_test.go | 187 +++++------------- internal/terraform/node_action.go | 48 +++-- internal/terraform/node_action_instance.go | 17 +- .../node_action_trigger_instance_plan.go | 36 ++-- 5 files changed, 111 insertions(+), 245 deletions(-) diff --git a/internal/plans/deferring/deferred.go b/internal/plans/deferring/deferred.go index e5d89122a642..4a9a17b71a65 100644 --- a/internal/plans/deferring/deferred.go +++ b/internal/plans/deferring/deferred.go @@ -7,6 +7,7 @@ import ( "fmt" "sync" + "github.com/hashicorp/hcl/v2" "github.com/zclconf/go-cty/cty" "github.com/hashicorp/terraform/internal/addrs" @@ -729,64 +730,51 @@ func (d *Deferred) ReportActionDeferred(addr addrs.AbsActionInstance, reason pro configMap.Put(addr, reason) } -// ShouldDeferActionInvocation returns true if there is a reason to defer the action invocation instance -// We want to defer an action invocation if -// a) the resource was deferred -// or -// b) a previously run action was deferred -func (d *Deferred) ShouldDeferActionInvocation(ai plans.ActionInvocationInstance) bool { +// ShouldDeferActionInvocation returns true if there is a reason to defer the +// action invocation instance. We want to defer an action invocation only if +// the triggering resource was deferred. In addition, we will check if the +// underlying action was deferred via a reference, and consider it an error if +// the triggering resource wasn't also deferred. +// +// The reason behind the slightly different behaviour here, is that if an +// action invocation is deferred, then that implies the triggering action +// should also be deferred. +// +// We don't yet have the capability to retroactively defer a resource, so for +// now actions initiating deferrals themselves is considered an error. +func (d *Deferred) ShouldDeferActionInvocation(ai plans.ActionInvocationInstance, triggerRange *hcl.Range) (bool, tfdiags.Diagnostics) { d.mu.Lock() defer d.mu.Unlock() - // The expansion of the action itself is deferred - if ai.Addr.Action.Key == addrs.WildcardKey { - return true - } - - if c, ok := d.actionExpansionDeferred.GetOk(ai.Addr.ConfigAction()); ok { - if c.Has(ai.Addr) { - return true - } - - for _, k := range c.Keys() { - if k.Action.Key == addrs.WildcardKey { - return true - } - } - } - - if d.partialExpandedActionsDeferred.Has(ai.Addr.ConfigAction()) { - return true - } + var diags tfdiags.Diagnostics // We only want to defer actions that are lifecycle triggered at, ok := ai.ActionTrigger.(*plans.LifecycleActionTrigger) if !ok { - return false + return false, diags } // If the resource was deferred, we also need to defer any action potentially triggering from this if configResourceMap, ok := d.resourceInstancesDeferred.GetOk(at.TriggeringResourceAddr.ConfigResource()); ok { if configResourceMap.Has(at.TriggeringResourceAddr) { - return true + return true, diags } } - // Since all actions plan in order we can just check if an action for this resource instance - // has been deferred already - for _, deferred := range d.actionInvocationDeferred { - deferredAt, deferredOk := deferred.ActionInvocationInstance.ActionTrigger.(*plans.LifecycleActionTrigger) - if !deferredOk { - continue // We only care about lifecycle triggered actions here - } - - if deferredAt.TriggeringResourceAddr.Equal(at.TriggeringResourceAddr) { - return true + if c, ok := d.actionExpansionDeferred.GetOk(ai.Addr.ConfigAction()); ok { + if c.Has(ai.Addr) { + // Then in this case, the resource wasn't deferred but the action + // was and so we will consider this to be an error. + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid action deferral", + Detail: fmt.Sprintf("The action %s was marked as deferred, but was triggered by a non-deferred resource %s. To work around this, use the -target argument to first apply only the resources that the action block depends on.", ai.Addr, at.TriggeringResourceAddr), + Subject: triggerRange, + }) } } - // We found no reason, so we return false - return false + return false, diags } // ShouldDeferAction returns true if the action should be deferred. This is the case if a diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index b928fd6252d7..2dfd0854c196 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -1818,7 +1818,7 @@ resource "test_object" "a" { expectPlanActionCalled: true, planOpts: &PlanOpts{ Mode: plans.NormalMode, - DeferralAllowed: true, + DeferralAllowed: true, // actions should ignore this setting }, planActionFn: func(*testing.T, providers.PlanActionRequest) providers.PlanActionResponse { return providers.PlanActionResponse{ @@ -1827,25 +1827,13 @@ resource "test_object" "a" { }, } }, - - assertPlan: func(t *testing.T, p *plans.Plan) { - if len(p.Changes.ActionInvocations) != 0 { - t.Fatalf("expected 0 actions in plan, got %d", len(p.Changes.ActionInvocations)) - } - - if len(p.DeferredActionInvocations) != 1 { - t.Fatalf("expected 1 deferred action in plan, got %d", len(p.DeferredActionInvocations)) - } - deferredActionInvocation := p.DeferredActionInvocations[0] - if deferredActionInvocation.DeferredReason != providers.DeferredReasonAbsentPrereq { - t.Fatalf("expected deferred action to be deferred due to absent prereq, but got %s", deferredActionInvocation.DeferredReason) - } - if deferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String() != "test_object.a" { - t.Fatalf("expected deferred action to be triggered by test_object.a, but got %s", deferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String()) - } - - if deferredActionInvocation.ActionInvocationInstanceSrc.Addr.String() != "action.test_action.hello" { - t.Fatalf("expected deferred action to be triggered by action.test_action.hello, but got %s", deferredActionInvocation.ActionInvocationInstanceSrc.Addr.String()) + expectPlanDiagnostics: func(m *configs.Config) tfdiags.Diagnostics { + return tfdiags.Diagnostics{ + tfdiags.Sourceless( + tfdiags.Error, + "Provider deferred changes when Terraform did not allow deferrals", + `The provider signaled a deferred action for "action.test_action.hello", but in this context deferrals are disabled. This is a bug in the provider, please file an issue with the provider developers.`, + ), } }, }, @@ -1888,37 +1876,17 @@ resource "test_object" "a" { }, } }, - - assertPlan: func(t *testing.T, p *plans.Plan) { - if len(p.Changes.ActionInvocations) != 0 { - t.Fatalf("expected 0 actions in plan, got %d", len(p.Changes.ActionInvocations)) - } - - if len(p.DeferredActionInvocations) != 2 { - t.Fatalf("expected 2 deferred actions in plan, got %d", len(p.DeferredActionInvocations)) - } - firstDeferredActionInvocation := p.DeferredActionInvocations[0] - if firstDeferredActionInvocation.DeferredReason != providers.DeferredReasonAbsentPrereq { - t.Fatalf("expected deferred action to be deferred due to absent prereq, but got %s", firstDeferredActionInvocation.DeferredReason) - } - if firstDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String() != "test_object.a" { - t.Fatalf("expected deferred action to be triggered by test_object.a, but got %s", firstDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String()) - } - - if firstDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String() != "action.test_action.hello" { - t.Fatalf("expected deferred action to be triggered by action.test_action.hello, but got %s", firstDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String()) - } - - secondDeferredActionInvocation := p.DeferredActionInvocations[1] - if secondDeferredActionInvocation.DeferredReason != providers.DeferredReasonDeferredPrereq { - t.Fatalf("expected second deferred action to be deferred due to deferred prereq, but got %s", secondDeferredActionInvocation.DeferredReason) - } - if secondDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String() != "test_object.a" { - t.Fatalf("expected second deferred action to be triggered by test_object.a, but got %s", secondDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String()) - } - - if secondDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String() != "action.ecosystem.world" { - t.Fatalf("expected second deferred action to be triggered by action.ecosystem.world, but got %s", secondDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String()) + expectPlanDiagnostics: func(m *configs.Config) tfdiags.Diagnostics { + // for now, it's just an error for any deferrals but when + // this gets implemented we should check that all the + // actions are deferred even though only one of them + // was actually marked as deferred. + return tfdiags.Diagnostics{ + tfdiags.Sourceless( + tfdiags.Error, + "Provider deferred changes when Terraform did not allow deferrals", + `The provider signaled a deferred action for "action.test_action.hello", but in this context deferrals are disabled. This is a bug in the provider, please file an issue with the provider developers.`, + ), } }, }, @@ -1965,50 +1933,17 @@ resource "test_object" "a" { }, } }, - - assertPlan: func(t *testing.T, p *plans.Plan) { - if len(p.Changes.ActionInvocations) != 0 { - t.Fatalf("expected 0 actions in plan, got %d", len(p.Changes.ActionInvocations)) - } - - if len(p.DeferredActionInvocations) != 2 { - t.Fatalf("expected 2 deferred actions in plan, got %d", len(p.DeferredActionInvocations)) - } - firstDeferredActionInvocation := p.DeferredActionInvocations[0] - if firstDeferredActionInvocation.DeferredReason != providers.DeferredReasonAbsentPrereq { - t.Fatalf("expected deferred action to be deferred due to absent prereq, but got %s", firstDeferredActionInvocation.DeferredReason) - } - if firstDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String() != "test_object.a" { - t.Fatalf("expected deferred action to be triggered by test_object.a, but got %s", firstDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String()) - } - - if firstDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String() != "action.test_action.hello" { - t.Fatalf("expected deferred action to be triggered by action.test_action.hello, but got %s", firstDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String()) - } - - secondDeferredActionInvocation := p.DeferredActionInvocations[1] - if secondDeferredActionInvocation.DeferredReason != providers.DeferredReasonDeferredPrereq { - t.Fatalf("expected second deferred action to be deferred due to deferred prereq, but got %s", secondDeferredActionInvocation.DeferredReason) - } - if secondDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String() != "test_object.a" { - t.Fatalf("expected second deferred action to be triggered by test_object.a, but got %s", secondDeferredActionInvocation.ActionInvocationInstanceSrc.ActionTrigger.(*plans.LifecycleActionTrigger).TriggeringResourceAddr.String()) - } - - if secondDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String() != "action.ecosystem.world" { - t.Fatalf("expected second deferred action to be triggered by action.ecosystem.world, but got %s", secondDeferredActionInvocation.ActionInvocationInstanceSrc.Addr.String()) - } - - if len(p.DeferredResources) != 1 { - t.Fatalf("expected 1 resource to be deferred, got %d", len(p.DeferredResources)) - } - deferredResource := p.DeferredResources[0] - - if deferredResource.ChangeSrc.Addr.String() != "test_object.a" { - t.Fatalf("Expected resource %s to be deferred, but it was not", deferredResource.ChangeSrc.Addr) - } - - if deferredResource.DeferredReason != providers.DeferredReasonDeferredPrereq { - t.Fatalf("Expected deferred reason to be deferred prereq, got %s", deferredResource.DeferredReason) + expectPlanDiagnostics: func(m *configs.Config) tfdiags.Diagnostics { + // for now, it's just an error for any deferrals but when + // this gets implemented we should check that all the + // actions are deferred even though only one of them + // was actually marked as deferred. + return tfdiags.Diagnostics{ + tfdiags.Sourceless( + tfdiags.Error, + "Provider deferred changes when Terraform did not allow deferrals", + `The provider signaled a deferred action for "action.test_action.hello", but in this context deferrals are disabled. This is a bug in the provider, please file an issue with the provider developers.`, + ), } }, }, @@ -2130,26 +2065,17 @@ resource "test_object" "a" { }, }, }, - assertPlan: func(t *testing.T, p *plans.Plan) { - if len(p.DeferredActionInvocations) != 1 { - t.Fatalf("expected exactly one invocation, and found %d", len(p.DeferredActionInvocations)) + assertPlanDiagnostics: func(t *testing.T, diagnostics tfdiags.Diagnostics) { + if len(diagnostics) != 1 { + t.Fatal("wrong number of diagnostics") } - if p.DeferredActionInvocations[0].DeferredReason != providers.DeferredReasonDeferredPrereq { - t.Fatalf("expected.DeferredReasonDeferredPrereq, got %s", p.DeferredActionInvocations[0].DeferredReason) + if diagnostics[0].Severity() != tfdiags.Error { + t.Error("expected error severity") } - ai := p.DeferredActionInvocations[0].ActionInvocationInstanceSrc - if ai.Addr.String() != `action.test_action.hello["a"]` { - t.Fatalf(`expected action invocation for action.test_action.hello["a"], got %s`, ai.Addr.String()) - } - - if len(p.DeferredResources) != 1 { - t.Fatalf("expected 1 deferred resource, got %d", len(p.DeferredResources)) - } - - if p.DeferredResources[0].ChangeSrc.Addr.String() != "test_object.a" { - t.Fatalf("expected test_object.a, got %s", p.DeferredResources[0].ChangeSrc.Addr.String()) + if diagnostics[0].Description().Summary != "Invalid for_each argument" { + t.Errorf("expected for_each argument to be source of error but was %s", diagnostics[0].Description().Summary) } }, }, @@ -2335,42 +2261,17 @@ resource "test_object" "a" { } }, - assertPlan: func(t *testing.T, p *plans.Plan) { - if len(p.DeferredActionInvocations) != 1 { - t.Errorf("Expected 1 deferred action invocation, got %d", len(p.DeferredActionInvocations)) - } - if p.DeferredActionInvocations[0].ActionInvocationInstanceSrc.Addr.String() != "action.test_action.hello" { - t.Errorf("Expected action. test_action.hello, got %s", p.DeferredActionInvocations[0].ActionInvocationInstanceSrc.Addr.String()) - } - if p.DeferredActionInvocations[0].DeferredReason != providers.DeferredReasonDeferredPrereq { - t.Errorf("Expected DeferredReasonDeferredPrereq, got %s", p.DeferredActionInvocations[0].DeferredReason) + assertPlanDiagnostics: func(t *testing.T, diagnostics tfdiags.Diagnostics) { + if len(diagnostics) != 1 { + t.Fatal("wrong number of diagnostics") } - if len(p.DeferredResources) != 2 { - t.Fatalf("Expected 2 deferred resources, got %d", len(p.DeferredResources)) + if diagnostics[0].Severity() != tfdiags.Error { + t.Error("expected error diagnostics") } - slices.SortFunc(p.DeferredResources, func(a, b *plans.DeferredResourceInstanceChangeSrc) int { - if a.ChangeSrc.Addr.Less(b.ChangeSrc.Addr) { - return -1 - } - if b.ChangeSrc.Addr.Less(a.ChangeSrc.Addr) { - return 1 - } - return 0 - }) - - if p.DeferredResources[0].ChangeSrc.Addr.String() != "test_object.a" { - t.Errorf("Expected test_object.a to be first, got %s", p.DeferredResources[0].ChangeSrc.Addr.String()) - } - if p.DeferredResources[0].DeferredReason != providers.DeferredReasonDeferredPrereq { - t.Errorf("Expected DeferredReasonDeferredPrereq, got %s", p.DeferredResources[0].DeferredReason) - } - if p.DeferredResources[1].ChangeSrc.Addr.String() != "test_object.origin" { - t.Errorf("Expected test_object.origin to be second, got %s", p.DeferredResources[1].ChangeSrc.Addr.String()) - } - if p.DeferredResources[1].DeferredReason != providers.DeferredReasonAbsentPrereq { - t.Errorf("Expected DeferredReasonAbsentPrereq, got %s", p.DeferredResources[1].DeferredReason) + if diagnostics[0].Description().Summary != "Invalid action deferral" { + t.Errorf("expected deferral to be source of error was %s", diagnostics[0].Description().Summary) } }, }, diff --git a/internal/terraform/node_action.go b/internal/terraform/node_action.go index 9647e754bbf3..21ec1c39d662 100644 --- a/internal/terraform/node_action.go +++ b/internal/terraform/node_action.go @@ -76,27 +76,23 @@ func (n *nodeExpandActionDeclaration) DynamicExpand(ctx EvalContext) (*Graph, tf _, knownInstKeys, haveUnknownKeys := expander.ActionInstanceKeys(absActAddr) if haveUnknownKeys { + // this should never happen, n.recordActionData explicitly sets + // allowUnknown to be false, so we should pick up diagnostics + // during that call instance reaching this branch. + panic("found unknown keys in action instance") + } + + // Expand the action instances for this module. + for _, knownInstKey := range knownInstKeys { node := NodeActionDeclarationInstance{ - Addr: absActAddr.Instance(addrs.WildcardKey), + Addr: absActAddr.Instance(knownInstKey), Config: &n.Config, Schema: n.Schema, ResolvedProvider: n.ResolvedProvider, Dependencies: n.Dependencies, } + g.Add(&node) - } else { - // Expand the action instances for this module. - for _, knownInstKey := range knownInstKeys { - node := NodeActionDeclarationInstance{ - Addr: absActAddr.Instance(knownInstKey), - Config: &n.Config, - Schema: n.Schema, - ResolvedProvider: n.ResolvedProvider, - Dependencies: n.Dependencies, - } - - g.Add(&node) - } } addRootNodeToGraph(&g) @@ -113,16 +109,15 @@ func (n *nodeExpandActionDeclaration) recordActionData(ctx EvalContext, addr add // to expand the module here to create all resources. expander := ctx.InstanceExpander() - // Allowing unknown values in count and for_each is a top-level plan option. - // - // If this is false then the codepaths that handle unknown values below - // become unreachable, because the evaluate functions will reject unknown - // values as an error. - allowUnknown := ctx.Deferrals().DeferralAllowed() + // For now, action instances cannot evaluate to unknown. When an action + // would have an unknown instance key, we'd want to defer executing that + // action, and in turn defer executing the triggering resource. Delayed + // deferrals are not currently possible (we need to reconfigure exactly how + // deferrals are checked) so for now deferred actions are simply blocked. switch { case n.Config.Count != nil: - count, countDiags := evaluateCountExpression(n.Config.Count, ctx, allowUnknown) + count, countDiags := evaluateCountExpression(n.Config.Count, ctx, false) diags = diags.Append(countDiags) if countDiags.HasErrors() { return diags @@ -131,12 +126,13 @@ func (n *nodeExpandActionDeclaration) recordActionData(ctx EvalContext, addr add if count >= 0 { expander.SetActionCount(addr.Module, n.Addr.Action, count) } else { - // -1 represents "unknown" - expander.SetActionCountUnknown(addr.Module, n.Addr.Action) + // this should not be possible as allowUnknown was set to false + // in the evaluateCountExpression function call. + panic("evaluateCountExpression returned unknown") } case n.Config.ForEach != nil: - forEach, known, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, allowUnknown) + forEach, known, forEachDiags := evaluateForEachExpression(n.Config.ForEach, ctx, false) diags = diags.Append(forEachDiags) if forEachDiags.HasErrors() { return diags @@ -147,7 +143,9 @@ func (n *nodeExpandActionDeclaration) recordActionData(ctx EvalContext, addr add if known { expander.SetActionForEach(addr.Module, n.Addr.Action, forEach) } else { - expander.SetActionForEachUnknown(addr.Module, n.Addr.Action) + // this should not be possible as allowUnknown was set to false + // in the evaluateForEachExpression function call. + panic("evaluateForEachExpression returned unknown") } default: diff --git a/internal/terraform/node_action_instance.go b/internal/terraform/node_action_instance.go index f27a3d53521b..cec79da1d564 100644 --- a/internal/terraform/node_action_instance.go +++ b/internal/terraform/node_action_instance.go @@ -6,7 +6,6 @@ package terraform import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/configs" "github.com/hashicorp/terraform/internal/lang/langrefs" @@ -44,22 +43,8 @@ func (n *NodeActionDeclarationInstance) Path() addrs.ModuleInstance { func (n *NodeActionDeclarationInstance) Execute(ctx EvalContext, _ walkOperation) tfdiags.Diagnostics { var diags tfdiags.Diagnostics - deferrals := ctx.Deferrals() - - if n.Addr.Action.Key == addrs.WildcardKey { - if deferrals.DeferralAllowed() { - deferrals.ReportActionDeferred(n.Addr, providers.DeferredReasonInstanceCountUnknown) - } else { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Action expansion was deferred", - Detail: "Deferral is not allowed in this context", - Subject: n.Config.DeclRange.Ptr(), - }) - } - return diags - } + deferrals := ctx.Deferrals() if deferrals.DeferralAllowed() && deferrals.ShouldDeferAction(n.Dependencies) { deferrals.ReportActionDeferred(n.Addr, providers.DeferredReasonDeferredPrereq) return diags diff --git a/internal/terraform/node_action_trigger_instance_plan.go b/internal/terraform/node_action_trigger_instance_plan.go index dfb10f267449..68cf1f913afe 100644 --- a/internal/terraform/node_action_trigger_instance_plan.go +++ b/internal/terraform/node_action_trigger_instance_plan.go @@ -77,20 +77,20 @@ func (n *nodeActionTriggerPlanInstance) Execute(ctx EvalContext, operation walkO } change := ctx.Changes().GetResourceInstanceChange(n.lifecycleActionTrigger.resourceAddress, n.lifecycleActionTrigger.resourceAddress.CurrentObject().DeposedKey) - // If we should defer the action invocation, we need to report it and if the resource instance - // was not deferred (and therefore was planned) we need to retroactively remove the change - if deferrals.ShouldDeferActionInvocation(ai) { + deferred, moreDiags := deferrals.ShouldDeferActionInvocation(ai, n.lifecycleActionTrigger.invokingSubject) + diags = diags.Append(moreDiags) + if deferred { deferrals.ReportActionInvocationDeferred(ai, providers.DeferredReasonDeferredPrereq) - if change != nil { - ctx.Changes().RemoveResourceInstanceChange(change.Addr, change.Addr.CurrentObject().DeposedKey) - deferrals.ReportResourceInstanceDeferred(change.Addr, providers.DeferredReasonDeferredPrereq, change) - } - return nil + return diags + } + + if moreDiags.HasErrors() { + return diags } if change == nil { // nothing to do (this may be a refresh ) - return nil + return diags } if n.lifecycleActionTrigger == nil { @@ -151,10 +151,12 @@ func (n *nodeActionTriggerPlanInstance) Execute(ctx EvalContext, operation walkO // We remove the marks for planning, we will record the sensitive values in the plans.ActionInvocationInstance unmarkedConfig, _ := actionInstance.ConfigValue.UnmarkDeepWithPaths() + cc := ctx.ClientCapabilities() + cc.DeferralAllowed = false // for now, deferrals in actions are always disabled resp := provider.PlanAction(providers.PlanActionRequest{ ActionType: n.actionAddress.Action.Action.Type, ProposedActionData: unmarkedConfig, - ClientCapabilities: ctx.ClientCapabilities(), + ClientCapabilities: cc, }) if len(resp.Diagnostics) > 0 { @@ -174,7 +176,9 @@ func (n *nodeActionTriggerPlanInstance) Execute(ctx EvalContext, operation walkO Subject: n.lifecycleActionTrigger.invokingSubject, }) } - if resp.Deferred != nil && !deferrals.DeferralAllowed() { + if resp.Deferred != nil { + // we always set allow_deferrals to be false for actions, so this + // should not happen diags = diags.Append(deferring.UnexpectedProviderDeferralDiagnostic(n.actionAddress)) } if resp.Diagnostics.HasErrors() { @@ -186,16 +190,6 @@ func (n *nodeActionTriggerPlanInstance) Execute(ctx EvalContext, operation walkO eventSpecificAi := ai.DeepCopy() // We need to set the triggering event on the action invocation eventSpecificAi.ActionTrigger = n.lifecycleActionTrigger.ActionTrigger(triggeredEvent) - - // If the action is deferred, we need to also defer the resource instance - if resp.Deferred != nil { - deferrals.ReportActionInvocationDeferred(*eventSpecificAi, resp.Deferred.Reason) - ctx.Changes().RemoveResourceInstanceChange(change.Addr, change.Addr.CurrentObject().DeposedKey) - deferrals.ReportResourceInstanceDeferred(change.Addr, providers.DeferredReasonDeferredPrereq, change) - - return diags - } - ctx.Changes().AppendActionInvocation(eventSpecificAi) } return diags From 2274026c68260dd7be6ca77e72c355a0da6db1b6 Mon Sep 17 00:00:00 2001 From: Samsondeen <40821565+dsa0x@users.noreply.github.com> Date: Wed, 1 Oct 2025 11:33:52 +0200 Subject: [PATCH 23/27] query: add -query flag to validate command (#37671) --- .changes/v1.14/BUG FIXES-20250926-113318.yaml | 5 + .../v1.14/ENHANCEMENTS-20250925-151237.yaml | 5 + internal/command/arguments/validate.go | 4 + .../testdata/query/invalid-traversal/main.tf | 9 + .../query/invalid-traversal/main.tfquery.hcl | 21 + internal/command/validate.go | 60 +- internal/command/validate_test.go | 82 +++ internal/genconfig/generate_config.go | 13 +- internal/instances/expander.go | 11 + internal/terraform/context_plan_query_test.go | 598 +++++++++++------- .../terraform/node_resource_plan_instance.go | 5 +- 11 files changed, 540 insertions(+), 273 deletions(-) create mode 100644 .changes/v1.14/BUG FIXES-20250926-113318.yaml create mode 100644 .changes/v1.14/ENHANCEMENTS-20250925-151237.yaml create mode 100644 internal/command/testdata/query/invalid-traversal/main.tf create mode 100644 internal/command/testdata/query/invalid-traversal/main.tfquery.hcl diff --git a/.changes/v1.14/BUG FIXES-20250926-113318.yaml b/.changes/v1.14/BUG FIXES-20250926-113318.yaml new file mode 100644 index 000000000000..3adfd48017f1 --- /dev/null +++ b/.changes/v1.14/BUG FIXES-20250926-113318.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: 'query: generate unique resource identifiers for results of expanded list resources' +time: 2025-09-26T11:33:18.241184+02:00 +custom: + Issue: "37681" diff --git a/.changes/v1.14/ENHANCEMENTS-20250925-151237.yaml b/.changes/v1.14/ENHANCEMENTS-20250925-151237.yaml new file mode 100644 index 000000000000..6e6c3381c79f --- /dev/null +++ b/.changes/v1.14/ENHANCEMENTS-20250925-151237.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: "query: support offline validation of query files via -query flag in the validate command" +time: 2025-09-25T15:12:37.198573+02:00 +custom: + Issue: "37671" diff --git a/internal/command/arguments/validate.go b/internal/command/arguments/validate.go index 7df4b2c5d9e8..4347f39eb1cf 100644 --- a/internal/command/arguments/validate.go +++ b/internal/command/arguments/validate.go @@ -24,6 +24,9 @@ type Validate struct { // ViewType specifies which output format to use: human, JSON, or "raw". ViewType ViewType + + // Query indicates that Terraform should also validate .tfquery files. + Query bool } // ParseValidate processes CLI arguments, returning a Validate value and errors. @@ -40,6 +43,7 @@ func ParseValidate(args []string) (*Validate, tfdiags.Diagnostics) { cmdFlags.BoolVar(&jsonOutput, "json", false, "json") cmdFlags.StringVar(&validate.TestDirectory, "test-directory", "tests", "test-directory") cmdFlags.BoolVar(&validate.NoTests, "no-tests", false, "no-tests") + cmdFlags.BoolVar(&validate.Query, "query", false, "query") if err := cmdFlags.Parse(args); err != nil { diags = diags.Append(tfdiags.Sourceless( diff --git a/internal/command/testdata/query/invalid-traversal/main.tf b/internal/command/testdata/query/invalid-traversal/main.tf new file mode 100644 index 000000000000..4a6f9760d0ec --- /dev/null +++ b/internal/command/testdata/query/invalid-traversal/main.tf @@ -0,0 +1,9 @@ +terraform { + required_providers { + test = { + source = "hashicorp/test" + } + } +} + +provider "test" {} diff --git a/internal/command/testdata/query/invalid-traversal/main.tfquery.hcl b/internal/command/testdata/query/invalid-traversal/main.tfquery.hcl new file mode 100644 index 000000000000..71139321a6bf --- /dev/null +++ b/internal/command/testdata/query/invalid-traversal/main.tfquery.hcl @@ -0,0 +1,21 @@ +variable "input" { + type = string + default = "foo" +} + +list "test_instance" "test" { + provider = test + + config { + ami = var.input + } +} + +list "test_instance" "test2" { + provider = test + + config { + // this traversal is invalid for a list resource + ami = list.test_instance.test.state.instance_type + } +} diff --git a/internal/command/validate.go b/internal/command/validate.go index a574f00c0fc2..f679e2fae8b8 100644 --- a/internal/command/validate.go +++ b/internal/command/validate.go @@ -19,6 +19,8 @@ import ( // ValidateCommand is a Command implementation that validates the terraform files type ValidateCommand struct { Meta + + ParsedArgs *arguments.Validate } func (c *ValidateCommand) Run(rawArgs []string) int { @@ -34,6 +36,7 @@ func (c *ValidateCommand) Run(rawArgs []string) int { return 1 } + c.ParsedArgs = args view := views.NewValidate(args.ViewType, c.View) // After this point, we must only produce JSON output if JSON mode is @@ -54,7 +57,7 @@ func (c *ValidateCommand) Run(rawArgs []string) int { return view.Results(diags) } - validateDiags := c.validate(dir, args.TestDirectory, args.NoTests) + validateDiags := c.validate(dir) diags = diags.Append(validateDiags) // Validating with dev overrides in effect means that the result might @@ -66,47 +69,54 @@ func (c *ValidateCommand) Run(rawArgs []string) int { return view.Results(diags) } -func (c *ValidateCommand) validate(dir, testDir string, noTests bool) tfdiags.Diagnostics { +func (c *ValidateCommand) validate(dir string) tfdiags.Diagnostics { var diags tfdiags.Diagnostics var cfg *configs.Config - if noTests { + // If the query flag is set, include query files in the validation. + c.includeQueryFiles = c.ParsedArgs.Query + + if c.ParsedArgs.NoTests { cfg, diags = c.loadConfig(dir) } else { - cfg, diags = c.loadConfigWithTests(dir, testDir) + cfg, diags = c.loadConfigWithTests(dir, c.ParsedArgs.TestDirectory) } if diags.HasErrors() { return diags } - validate := func(cfg *configs.Config) tfdiags.Diagnostics { - var diags tfdiags.Diagnostics + diags = diags.Append(c.validateConfig(cfg)) - opts, err := c.contextOpts() - if err != nil { - diags = diags.Append(err) - return diags - } + // Unless excluded, we'll also do a quick validation of the Terraform test files. These live + // outside the Terraform graph so we have to do this separately. + if !c.ParsedArgs.NoTests { + diags = diags.Append(c.validateTestFiles(cfg)) + } - tfCtx, ctxDiags := terraform.NewContext(opts) - diags = diags.Append(ctxDiags) - if ctxDiags.HasErrors() { - return diags - } + return diags +} - return diags.Append(tfCtx.Validate(cfg, nil)) - } +func (c *ValidateCommand) validateConfig(cfg *configs.Config) tfdiags.Diagnostics { + var diags tfdiags.Diagnostics - diags = diags.Append(validate(cfg)) + opts, err := c.contextOpts() + if err != nil { + diags = diags.Append(err) + return diags + } - if noTests { + tfCtx, ctxDiags := terraform.NewContext(opts) + diags = diags.Append(ctxDiags) + if ctxDiags.HasErrors() { return diags } - validatedModules := make(map[string]bool) + return diags.Append(tfCtx.Validate(cfg, nil)) +} - // We'll also do a quick validation of the Terraform test files. These live - // outside the Terraform graph so we have to do this separately. +func (c *ValidateCommand) validateTestFiles(cfg *configs.Config) tfdiags.Diagnostics { + diags := tfdiags.Diagnostics{} + validatedModules := make(map[string]bool) for _, file := range cfg.Module.Tests { // The file validation only returns warnings so we'll just add them @@ -131,7 +141,7 @@ func (c *ValidateCommand) validate(dir, testDir string, noTests bool) tfdiags.Di // not validate the same thing multiple times. validatedModules[run.Module.Source.String()] = true - diags = diags.Append(validate(run.ConfigUnderTest)) + diags = diags.Append(c.validateConfig(run.ConfigUnderTest)) } } @@ -188,6 +198,8 @@ Options: -no-tests If specified, Terraform will not validate test files. -test-directory=path Set the Terraform test directory, defaults to "tests". + + -query If specified, the command will also validate .tfquery.hcl files. ` return strings.TrimSpace(helpText) } diff --git a/internal/command/validate_test.go b/internal/command/validate_test.go index 6651b3435a52..3cbeb4a02be7 100644 --- a/internal/command/validate_test.go +++ b/internal/command/validate_test.go @@ -449,3 +449,85 @@ func TestValidate_json(t *testing.T) { }) } } + +func TestValidateWithInvalidListResource(t *testing.T) { + td := t.TempDir() + cases := []struct { + name string + path string + wantError string + args []string + code int + }{ + { + name: "invalid-traversal with validate -query command", + path: "query/invalid-traversal", + wantError: ` +Error: Invalid list resource traversal + + on main.tfquery.hcl line 19, in list "test_instance" "test2": + 19: ami = list.test_instance.test.state.instance_type + +The first step in the traversal for a list resource must be an attribute +"data". +`, + args: []string{"-query"}, + code: 1, + }, + { + name: "invalid-traversal with no -query", + path: "query/invalid-traversal", + }, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + testCopyDir(t, testFixturePath(tc.path), td) + t.Chdir(td) + + streams, done := terminal.StreamsForTesting(t) + view := views.NewView(streams) + ui := new(cli.MockUi) + + provider := queryFixtureProvider() + providerSource, close := newMockProviderSource(t, map[string][]string{ + "test": {"1.0.0"}, + }) + defer close() + + meta := Meta{ + testingOverrides: metaOverridesForProvider(provider), + Ui: ui, + View: view, + Streams: streams, + ProviderSource: providerSource, + } + + init := &InitCommand{ + Meta: meta, + } + + if code := init.Run(nil); code != 0 { + t.Fatalf("expected status code 0 but got %d: %s", code, ui.ErrorWriter) + } + + c := &ValidateCommand{ + Meta: meta, + } + + var args []string + args = append(args, "-no-color") + args = append(args, tc.args...) + + code := c.Run(args) + output := done(t) + + if code != tc.code { + t.Fatalf("Expected status code %d but got %d: %s", tc.code, code, output.Stderr()) + } + + if diff := cmp.Diff(tc.wantError, output.Stderr()); diff != "" { + t.Fatalf("Expected error string %q but got %q\n\ndiff: \n%s", tc.wantError, output.Stderr(), diff) + } + }) + } +} diff --git a/internal/genconfig/generate_config.go b/internal/genconfig/generate_config.go index 80a6f017343b..746a04220dba 100644 --- a/internal/genconfig/generate_config.go +++ b/internal/genconfig/generate_config.go @@ -138,6 +138,9 @@ type ResourceListElement struct { Config cty.Value Identity cty.Value + + // ExpansionEnum is a unique enumeration of the list resource address relative to its expanded siblings. + ExpansionEnum int } func GenerateListResourceContents(addr addrs.AbsResourceInstance, @@ -158,12 +161,18 @@ func GenerateListResourceContents(addr addrs.AbsResourceInstance, Resource: addrs.Resource{ Mode: addrs.ManagedResourceMode, Type: addr.Resource.Resource.Type, - Name: fmt.Sprintf("%s_%d", addr.Resource.Resource.Name, idx), }, - Key: addr.Resource.Key, }, } + // If the list resource instance is keyed, the expansion counter is included in the address + // to ensure uniqueness across the entire configuration. + if addr.Resource.Key == addrs.NoKey { + resAddr.Resource.Resource.Name = fmt.Sprintf("%s_%d", addr.Resource.Resource.Name, idx) + } else { + resAddr.Resource.Resource.Name = fmt.Sprintf("%s_%d_%d", addr.Resource.Resource.Name, res.ExpansionEnum, idx) + } + content, gDiags := GenerateResourceContents(resAddr, schema, pc, res.Config, true) if gDiags.HasErrors() { diags = diags.Append(gDiags) diff --git a/internal/instances/expander.go b/internal/instances/expander.go index 414ede32c507..93a38b4060aa 100644 --- a/internal/instances/expander.go +++ b/internal/instances/expander.go @@ -5,6 +5,7 @@ package instances import ( "fmt" + "slices" "sort" "sync" @@ -338,6 +339,16 @@ func (e *Expander) ExpandResource(resourceAddr addrs.AbsResource) []addrs.AbsRes return ret } +// ResourceExpansionEnum returns the expansion enum for the given resource instance address +// within the sorted list of resource instances belonging to the same resource config within +// the same module instance. +func (e *Expander) ResourceExpansionEnum(resourceAddr addrs.AbsResourceInstance) int { + res := e.ExpandResource(resourceAddr.ContainingResource()) + return slices.IndexFunc(res, func(addr addrs.AbsResourceInstance) bool { + return addr.Equal(resourceAddr) + }) +} + // UnknownResourceInstances finds a set of patterns that collectively cover // all of the possible resource instance addresses that could appear for the // given static resource once all of the intermediate module expansions are diff --git a/internal/terraform/context_plan_query_test.go b/internal/terraform/context_plan_query_test.go index 902f6cf972bc..9c2b9e14696c 100644 --- a/internal/terraform/context_plan_query_test.go +++ b/internal/terraform/context_plan_query_test.go @@ -5,6 +5,8 @@ package terraform import ( "fmt" + "maps" + "slices" "sort" "strings" "testing" @@ -62,18 +64,20 @@ func TestContext2Plan_queryList(t *testing.T) { return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} } + type resources struct { + list map[string]bool // map of list resource addresses to whether they want the resource state included in the response + managed []string + } + cases := []struct { name string mainConfig string queryConfig string generatedPath string - expectedErrMsg []string transformSchema func(*providers.GetProviderSchemaResponse) - assertState func(*states.State) assertValidateDiags func(t *testing.T, diags tfdiags.Diagnostics) assertPlanDiags func(t *testing.T, diags tfdiags.Diagnostics) - assertChanges func(providers.ProviderSchema, *plans.ChangesSrc) - listResourceFn func(request providers.ListResourceRequest) providers.ListResourceResponse + expectedResources resources }{ { name: "valid list reference - generates config", @@ -114,46 +118,13 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - generatedPath: t.TempDir(), - listResourceFn: listResourceFn, - assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { - expectedResources := []string{"list.test_resource.test", "list.test_resource.test2"} - actualResources := make([]string, 0) - generatedCfgs := make([]string, 0) - for _, change := range changes.Queries { - actualResources = append(actualResources, change.Addr.String()) - schema := sch.ListResourceTypes[change.Addr.Resource.Resource.Type] - cs, err := change.Decode(schema) - if err != nil { - t.Fatalf("failed to decode change: %s", err) - } - - obj := cs.Results.Value.GetAttr("data") - if obj.IsNull() { - t.Fatalf("Expected 'data' attribute to be present, but it is null") - } - obj.ForEachElement(func(key cty.Value, val cty.Value) bool { - if val.Type().HasAttribute("state") { - val = val.GetAttr("state") - if !val.IsNull() { - if val.GetAttr("instance_type").IsNull() { - t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") - } - } - } - - return false - }) - generatedCfgs = append(generatedCfgs, change.Generated.String()) - } - - if diff := cmp.Diff(expectedResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } - - if diff := cmp.Diff([]string{testResourceCfg, testResourceCfg2}, generatedCfgs); diff != "" { - t.Fatalf("Expected generated configs to match, but they differ: %s", diff) - } + generatedPath: t.TempDir(), + expectedResources: resources{ + list: map[string]bool{ + "list.test_resource.test": true, + "list.test_resource.test2": false, + }, + managed: []string{}, }, }, { @@ -197,47 +168,9 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: listResourceFn, - assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { - expectedResources := []string{"list.test_resource.test[0]", "list.test_resource.test2"} - actualResources := make([]string, 0) - for _, change := range changes.Queries { - actualResources = append(actualResources, change.Addr.String()) - schema := sch.ListResourceTypes[change.Addr.Resource.Resource.Type] - cs, err := change.Decode(schema) - if err != nil { - t.Fatalf("failed to decode change: %s", err) - } - - // Verify instance types - expectedTypes := []string{"ami-123456", "ami-654321", "ami-789012"} - actualTypes := make([]string, 0) - obj := cs.Results.Value.GetAttr("data") - if obj.IsNull() { - t.Fatalf("Expected 'data' attribute to be present, but it is null") - } - obj.ForEachElement(func(key cty.Value, val cty.Value) bool { - val = val.GetAttr("state") - if val.IsNull() { - t.Fatalf("Expected 'state' attribute to be present, but it is null") - } - if val.GetAttr("instance_type").IsNull() { - t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") - } - actualTypes = append(actualTypes, val.GetAttr("instance_type").AsString()) - return false - }) - sort.Strings(actualTypes) - sort.Strings(expectedTypes) - if diff := cmp.Diff(expectedTypes, actualTypes); diff != "" { - t.Fatalf("Expected instance types to match, but they differ: %s", diff) - } - } - sort.Strings(actualResources) - sort.Strings(expectedResources) - if diff := cmp.Diff(expectedResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } + expectedResources: resources{ + list: map[string]bool{"list.test_resource.test[0]": true, "list.test_resource.test2": true}, + managed: []string{}, }, }, { @@ -346,47 +279,9 @@ func TestContext2Plan_queryList(t *testing.T) { } }, - listResourceFn: listResourceFn, - assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { - expectedResources := []string{"list.test_resource.test"} - actualResources := make([]string, 0) - for _, change := range changes.Queries { - actualResources = append(actualResources, change.Addr.String()) - schema := sch.ListResourceTypes[change.Addr.Resource.Resource.Type] - cs, err := change.Decode(schema) - if err != nil { - t.Fatalf("failed to decode change: %s", err) - } - - // Verify identities - expectedTypes := []string{"i-v1", "i-v2", "i-v3"} - actualTypes := make([]string, 0) - obj := cs.Results.Value.GetAttr("data") - if obj.IsNull() { - t.Fatalf("Expected 'data' attribute to be present, but it is null") - } - obj.ForEachElement(func(key cty.Value, val cty.Value) bool { - val = val.GetAttr("identity") - if val.IsNull() { - t.Fatalf("Expected 'identity' attribute to be present, but it is null") - } - if val.GetAttr("id").IsNull() { - t.Fatalf("Expected 'id' attribute to be present, but it is missing") - } - actualTypes = append(actualTypes, val.GetAttr("id").AsString()) - return false - }) - sort.Strings(actualTypes) - sort.Strings(expectedTypes) - if diff := cmp.Diff(expectedTypes, actualTypes); diff != "" { - t.Fatalf("Expected instance types to match, but they differ: %s", diff) - } - } - sort.Strings(actualResources) - sort.Strings(expectedResources) - if diff := cmp.Diff(expectedResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } + expectedResources: resources{ + list: map[string]bool{"list.test_resource.test": false}, + managed: []string{}, }, }, { @@ -530,7 +425,6 @@ func TestContext2Plan_queryList(t *testing.T) { tfdiags.AssertDiagnosticsMatch(t, diags, exp) }, - listResourceFn: listResourceFn, }, { name: "circular reference between list resources", @@ -618,47 +512,9 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: listResourceFn, - assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { - expectedResources := []string{"list.test_resource.test1", "list.test_resource.test2"} - actualResources := make([]string, 0) - for _, change := range changes.Queries { - actualResources = append(actualResources, change.Addr.String()) - schema := sch.ListResourceTypes[change.Addr.Resource.Resource.Type] - cs, err := change.Decode(schema) - if err != nil { - t.Fatalf("failed to decode change: %s", err) - } - - // Verify instance types - expectedTypes := []string{"ami-123456", "ami-654321", "ami-789012"} - actualTypes := make([]string, 0) - obj := cs.Results.Value.GetAttr("data") - if obj.IsNull() { - t.Fatalf("Expected 'data' attribute to be present, but it is null") - } - obj.ForEachElement(func(key cty.Value, val cty.Value) bool { - val = val.GetAttr("state") - if val.IsNull() { - t.Fatalf("Expected 'state' attribute to be present, but it is null") - } - if val.GetAttr("instance_type").IsNull() { - t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") - } - actualTypes = append(actualTypes, val.GetAttr("instance_type").AsString()) - return false - }) - sort.Strings(actualTypes) - sort.Strings(expectedTypes) - if diff := cmp.Diff(expectedTypes, actualTypes); diff != "" { - t.Fatalf("Expected instance types to match, but they differ: %s", diff) - } - } - sort.Strings(actualResources) - sort.Strings(expectedResources) - if diff := cmp.Diff(expectedResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } + expectedResources: resources{ + list: map[string]bool{"list.test_resource.test1": true, "list.test_resource.test2": true}, + managed: []string{}, }, }, { @@ -698,47 +554,14 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: listResourceFn, - assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { - expectedResources := []string{"list.test_resource.test1[\"foo\"]", "list.test_resource.test1[\"bar\"]", "list.test_resource.test2[\"foo\"]", "list.test_resource.test2[\"bar\"]"} - actualResources := make([]string, 0) - for _, change := range changes.Queries { - actualResources = append(actualResources, change.Addr.String()) - schema := sch.ListResourceTypes[change.Addr.Resource.Resource.Type] - cs, err := change.Decode(schema) - if err != nil { - t.Fatalf("failed to decode change: %s", err) - } - - // Verify instance types - expectedTypes := []string{"ami-123456", "ami-654321", "ami-789012"} - actualTypes := make([]string, 0) - obj := cs.Results.Value.GetAttr("data") - if obj.IsNull() { - t.Fatalf("Expected 'data' attribute to be present, but it is null") - } - obj.ForEachElement(func(key cty.Value, val cty.Value) bool { - val = val.GetAttr("state") - if val.IsNull() { - t.Fatalf("Expected 'state' attribute to be present, but it is null") - } - if val.GetAttr("instance_type").IsNull() { - t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") - } - actualTypes = append(actualTypes, val.GetAttr("instance_type").AsString()) - return false - }) - sort.Strings(actualTypes) - sort.Strings(expectedTypes) - if diff := cmp.Diff(expectedTypes, actualTypes); diff != "" { - t.Fatalf("Expected instance types to match, but they differ: %s", diff) - } - } - sort.Strings(actualResources) - sort.Strings(expectedResources) - if diff := cmp.Diff(expectedResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } + expectedResources: resources{ + list: map[string]bool{ + "list.test_resource.test1[\"foo\"]": true, + "list.test_resource.test1[\"bar\"]": true, + "list.test_resource.test2[\"foo\"]": true, + "list.test_resource.test2[\"bar\"]": true, + }, + managed: []string{}, }, }, { @@ -785,16 +608,11 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: listResourceFn, - assertChanges: func(sch providers.ProviderSchema, changes *plans.ChangesSrc) { - expectedResources := []string{"list.test_resource.test"} - actualResources := make([]string, 0) - for _, change := range changes.Queries { - actualResources = append(actualResources, change.Addr.String()) - } - if diff := cmp.Diff(expectedResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } + expectedResources: resources{ + list: map[string]bool{ + "list.test_resource.test": true, + }, + managed: []string{}, }, }, { @@ -838,26 +656,11 @@ func TestContext2Plan_queryList(t *testing.T) { } } `, - listResourceFn: listResourceFn, - assertChanges: func(ps providers.ProviderSchema, changes *plans.ChangesSrc) { - expectedListResources := []string{"list.test_resource.test"} - actualResources := make([]string, 0) - for _, change := range changes.Queries { - actualResources = append(actualResources, change.Addr.String()) - } - if diff := cmp.Diff(expectedListResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } - - expectedManagedResources := []string{"test_resource.example"} - actualResources = make([]string, 0) - for _, change := range changes.Resources { - actualResources = append(actualResources, change.Addr.String()) - } - if diff := cmp.Diff(expectedManagedResources, actualResources); diff != "" { - t.Fatalf("Expected resources to match, but they differ: %s", diff) - } - + expectedResources: resources{ + list: map[string]bool{ + "list.test_resource.test": true, + }, + managed: []string{"test_resource.example"}, }, }, } @@ -883,11 +686,7 @@ func TestContext2Plan_queryList(t *testing.T) { t.Fatalf("config should never be null, got null for %s", request.TypeName) } requestConfigs[request.TypeName] = request.Config - fn := tc.listResourceFn - if fn == nil { - return provider.ListResourceResponse - } - return fn(request) + return listResourceFn(request) } ctx, diags := NewContext(&ContextOpts{ @@ -920,12 +719,86 @@ func TestContext2Plan_queryList(t *testing.T) { tfdiags.AssertNoDiagnostics(t, diags) } - if tc.assertChanges != nil { + // If no diags expected, assert that the plan is valid + if tc.assertValidateDiags == nil && tc.assertPlanDiags == nil { sch, err := ctx.Schemas(mod, states.NewState()) if err != nil { t.Fatalf("failed to get schemas: %s", err) } - tc.assertChanges(sch.Providers[providerAddr], plan.Changes) + expectedResources := slices.Collect(maps.Keys(tc.expectedResources.list)) + actualResources := make([]string, 0) + generatedCfgs := make([]string, 0) + for _, change := range plan.Changes.Queries { + actualResources = append(actualResources, change.Addr.String()) + schema := sch.Providers[providerAddr].ListResourceTypes[change.Addr.Resource.Resource.Type] + cs, err := change.Decode(schema) + if err != nil { + t.Fatalf("failed to decode change: %s", err) + } + + // Verify data. If the state is included, we check that, otherwise we check the id. + expectedData := []string{"ami-123456", "ami-654321", "ami-789012"} + includeState := tc.expectedResources.list[change.Addr.String()] + if !includeState { + expectedData = []string{"i-v1", "i-v2", "i-v3"} + } + actualData := make([]string, 0) + obj := cs.Results.Value.GetAttr("data") + if obj.IsNull() { + t.Fatalf("Expected 'data' attribute to be present, but it is null") + } + obj.ForEachElement(func(key cty.Value, val cty.Value) bool { + if includeState { + val = val.GetAttr("state") + if val.IsNull() { + t.Fatalf("Expected 'state' attribute to be present, but it is null") + } + if val.GetAttr("instance_type").IsNull() { + t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") + } + actualData = append(actualData, val.GetAttr("instance_type").AsString()) + } else { + val = val.GetAttr("identity") + if val.IsNull() { + t.Fatalf("Expected 'identity' attribute to be present, but it is null") + } + if val.GetAttr("id").IsNull() { + t.Fatalf("Expected 'id' attribute to be present, but it is missing") + } + actualData = append(actualData, val.GetAttr("id").AsString()) + } + return false + }) + sort.Strings(actualData) + sort.Strings(expectedData) + if diff := cmp.Diff(expectedData, actualData); diff != "" { + t.Fatalf("Expected instance types to match, but they differ: %s", diff) + } + + if tc.generatedPath != "" { + generatedCfgs = append(generatedCfgs, change.Generated.String()) + } + } + sort.Strings(actualResources) + sort.Strings(expectedResources) + if diff := cmp.Diff(expectedResources, actualResources); diff != "" { + t.Fatalf("Expected resources to match, but they differ: %s", diff) + } + + expectedManagedResources := tc.expectedResources.managed + actualResources = make([]string, 0) + for _, change := range plan.Changes.Resources { + actualResources = append(actualResources, change.Addr.String()) + } + if diff := cmp.Diff(expectedManagedResources, actualResources); diff != "" { + t.Fatalf("Expected resources to match, but they differ: %s", diff) + } + + if tc.generatedPath != "" { + if diff := cmp.Diff([]string{testResourceCfg, testResourceCfg2}, generatedCfgs); diff != "" { + t.Fatalf("Expected generated configs to match, but they differ: %s", diff) + } + } } }) } @@ -1169,6 +1042,239 @@ func getListProviderSchemaResp() *providers.GetProviderSchemaResponse { }) } +func TestContext2Plan_queryListConfigGeneration(t *testing.T) { + listResourceFn := func(request providers.ListResourceRequest) providers.ListResourceResponse { + instanceTypes := []string{"ami-123456", "ami-654321", "ami-789012"} + madeUp := []cty.Value{} + for i := range len(instanceTypes) { + madeUp = append(madeUp, cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal(instanceTypes[i])})) + } + + ids := []cty.Value{} + for i := range madeUp { + ids = append(ids, cty.ObjectVal(map[string]cty.Value{ + "id": cty.StringVal(fmt.Sprintf("i-v%d", i+1)), + })) + } + + resp := []cty.Value{} + for i, v := range madeUp { + mp := map[string]cty.Value{ + "identity": ids[i], + "display_name": cty.StringVal(fmt.Sprintf("Instance %d", i+1)), + } + if request.IncludeResourceObject { + mp["state"] = v + } + resp = append(resp, cty.ObjectVal(mp)) + } + + ret := map[string]cty.Value{ + "data": cty.TupleVal(resp), + } + for k, v := range request.Config.AsValueMap() { + if k != "data" { + ret[k] = v + } + } + + return providers.ListResourceResponse{Result: cty.ObjectVal(ret)} + } + + mainConfig := ` + terraform { + required_providers { + test = { + source = "hashicorp/test" + version = "1.0.0" + } + } + } + ` + queryConfig := ` + variable "input" { + type = string + default = "foo" + } + + list "test_resource" "test2" { + for_each = toset(["§us-east-2", "§us-west-1"]) + provider = test + + config { + filter = { + attr = var.input + } + } + } + ` + + configFiles := map[string]string{"main.tf": mainConfig} + configFiles["main.tfquery.hcl"] = queryConfig + + mod := testModuleInline(t, configFiles, configs.MatchQueryFiles()) + providerAddr := addrs.NewDefaultProvider("test") + provider := testProvider("test") + provider.ConfigureProvider(providers.ConfigureProviderRequest{}) + provider.GetProviderSchemaResponse = getListProviderSchemaResp() + + var requestConfigs = make(map[string]cty.Value) + provider.ListResourceFn = func(request providers.ListResourceRequest) providers.ListResourceResponse { + if request.Config.IsNull() || request.Config.GetAttr("config").IsNull() { + t.Fatalf("config should never be null, got null for %s", request.TypeName) + } + requestConfigs[request.TypeName] = request.Config + return listResourceFn(request) + } + + ctx, diags := NewContext(&ContextOpts{ + Providers: map[addrs.Provider]providers.Factory{ + providerAddr: testProviderFuncFixed(provider), + }, + }) + tfdiags.AssertNoDiagnostics(t, diags) + + diags = ctx.Validate(mod, &ValidateOpts{ + Query: true, + }) + tfdiags.AssertNoDiagnostics(t, diags) + + generatedPath := t.TempDir() + plan, diags := ctx.Plan(mod, states.NewState(), &PlanOpts{ + Mode: plans.NormalMode, + SetVariables: testInputValuesUnset(mod.Module.Variables), + Query: true, + GenerateConfigPath: generatedPath, + }) + tfdiags.AssertNoDiagnostics(t, diags) + + sch, err := ctx.Schemas(mod, states.NewState()) + if err != nil { + t.Fatalf("failed to get schemas: %s", err) + } + + expectedResources := []string{ + `list.test_resource.test2["§us-east-2"]`, + `list.test_resource.test2["§us-west-1"]`, + } + actualResources := make([]string, 0) + generatedCfgs := make([]string, 0) + uniqCfgs := make(map[string]struct{}) + + for _, change := range plan.Changes.Queries { + actualResources = append(actualResources, change.Addr.String()) + schema := sch.Providers[providerAddr].ListResourceTypes[change.Addr.Resource.Resource.Type] + cs, err := change.Decode(schema) + if err != nil { + t.Fatalf("failed to decode change: %s", err) + } + + // Verify data. If the state is included, we check that, otherwise we check the id. + expectedData := []string{"ami-123456", "ami-654321", "ami-789012"} + includeState := change.Addr.String() == "list.test_resource.test" + if !includeState { + expectedData = []string{"i-v1", "i-v2", "i-v3"} + } + actualData := make([]string, 0) + obj := cs.Results.Value.GetAttr("data") + if obj.IsNull() { + t.Fatalf("Expected 'data' attribute to be present, but it is null") + } + obj.ForEachElement(func(key cty.Value, val cty.Value) bool { + if includeState { + val = val.GetAttr("state") + if val.IsNull() { + t.Fatalf("Expected 'state' attribute to be present, but it is null") + } + if val.GetAttr("instance_type").IsNull() { + t.Fatalf("Expected 'instance_type' attribute to be present, but it is missing") + } + actualData = append(actualData, val.GetAttr("instance_type").AsString()) + } else { + val = val.GetAttr("identity") + if val.IsNull() { + t.Fatalf("Expected 'identity' attribute to be present, but it is null") + } + if val.GetAttr("id").IsNull() { + t.Fatalf("Expected 'id' attribute to be present, but it is missing") + } + actualData = append(actualData, val.GetAttr("id").AsString()) + } + return false + }) + sort.Strings(actualData) + sort.Strings(expectedData) + if diff := cmp.Diff(expectedData, actualData); diff != "" { + t.Fatalf("Expected instance types to match, but they differ: %s", diff) + } + + generatedCfgs = append(generatedCfgs, change.Generated.String()) + uniqCfgs[change.Addr.String()] = struct{}{} + } + + sort.Strings(actualResources) + sort.Strings(expectedResources) + if diff := cmp.Diff(expectedResources, actualResources); diff != "" { + t.Fatalf("Expected resources to match, but they differ: %s", diff) + } + + // Verify no managed resources are created + if len(plan.Changes.Resources) != 0 { + t.Fatalf("Expected no managed resources, but got %d", len(plan.Changes.Resources)) + } + + // Verify generated configs match expected + expected := `resource "test_resource" "test2_0_0" { + provider = test + instance_type = "ami-123456" +} + +import { + to = test_resource.test2_0_0 + provider = test + identity = { + id = "i-v1" + } +} + +resource "test_resource" "test2_0_1" { + provider = test + instance_type = "ami-654321" +} + +import { + to = test_resource.test2_0_1 + provider = test + identity = { + id = "i-v2" + } +} + +resource "test_resource" "test2_0_2" { + provider = test + instance_type = "ami-789012" +} + +import { + to = test_resource.test2_0_2 + provider = test + identity = { + id = "i-v3" + } +} +` + joinedCfgs := strings.Join(generatedCfgs, "\n") + if !strings.Contains(joinedCfgs, expected) { + t.Fatalf("Expected config to contain expected resource, but it does not: %s", cmp.Diff(expected, joinedCfgs)) + } + + // Verify that the generated config is valid. + // The function panics if the config is invalid. + testModuleInline(t, map[string]string{ + "main.tf": strings.Join(generatedCfgs, "\n"), + }) +} + var ( testResourceCfg = `resource "test_resource" "test_0" { provider = test diff --git a/internal/terraform/node_resource_plan_instance.go b/internal/terraform/node_resource_plan_instance.go index f9c790837aca..e4fd8e059d7e 100644 --- a/internal/terraform/node_resource_plan_instance.go +++ b/internal/terraform/node_resource_plan_instance.go @@ -938,6 +938,9 @@ func (n *NodePlannableResourceInstance) generateHCLListResourceDef(ctx EvalConte var listElements []genconfig.ResourceListElement + expander := ctx.InstanceExpander() + enum := expander.ResourceExpansionEnum(addr) + iter := state.ElementIterator() for iter.Next() { _, val := iter.Element() @@ -955,7 +958,7 @@ func (n *NodePlannableResourceInstance) generateHCLListResourceDef(ctx EvalConte } idVal := val.GetAttr("identity") - listElements = append(listElements, genconfig.ResourceListElement{Config: config, Identity: idVal}) + listElements = append(listElements, genconfig.ResourceListElement{Config: config, Identity: idVal, ExpansionEnum: enum}) } return genconfig.GenerateListResourceContents(addr, schema.Body, schema.Identity, providerAddr, listElements) From d802fe39cc31bbbdb306c24e6aa0db81a53ee16d Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Wed, 1 Oct 2025 15:50:33 +0200 Subject: [PATCH 24/27] Modernize Go --- internal/states/instance_object_test.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/internal/states/instance_object_test.go b/internal/states/instance_object_test.go index 7b5a1a4bde8d..ba8cccb8efdf 100644 --- a/internal/states/instance_object_test.go +++ b/internal/states/instance_object_test.go @@ -61,22 +61,22 @@ func TestResourceInstanceObject_encode(t *testing.T) { // multiple instances may have been assigned the same deps slice objs := []*ResourceInstanceObject{ - &ResourceInstanceObject{ + { Value: value, Status: ObjectPlanned, Dependencies: depsOne, }, - &ResourceInstanceObject{ + { Value: value, Status: ObjectPlanned, Dependencies: depsTwo, }, - &ResourceInstanceObject{ + { Value: value, Status: ObjectPlanned, Dependencies: depsOne, }, - &ResourceInstanceObject{ + { Value: value, Status: ObjectPlanned, Dependencies: depsOne, @@ -91,10 +91,7 @@ func TestResourceInstanceObject_encode(t *testing.T) { var mu sync.Mutex for _, obj := range objs { - obj := obj - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { rios, err := obj.Encode(schema) if err != nil { t.Errorf("unexpected error: %s", err) @@ -102,7 +99,7 @@ func TestResourceInstanceObject_encode(t *testing.T) { mu.Lock() encoded = append(encoded, rios) mu.Unlock() - }() + }) } wg.Wait() From 5c0b37ab088283e2e17af6bc7dca27f3753186b2 Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Wed, 1 Oct 2025 13:50:33 +0000 Subject: [PATCH 25/27] backport of commit d802fe39cc31bbbdb306c24e6aa0db81a53ee16d --- .changes/{1.15.0.md => 1.14.0.md} | 0 .changes/previous-releases.md | 1 - .changes/v1.13/BUG FIXES-20250804-162137.yaml | 5 + .changes/v1.13/BUG FIXES-20250821-091753.yaml | 5 + .changes/v1.13/BUG FIXES-20250825-125018.yaml | 5 + .changes/v1.13/BUG FIXES-20250905-083104.yaml | 5 + .changes/v1.13/BUG FIXES-20250910-095424.yaml | 5 + .changes/v1.13/BUG FIXES-20250911-142038.yaml | 5 + .changes/v1.14/BUG FIXES-20250714-135938.yaml | 5 + .changes/v1.14/BUG FIXES-20250828-182746.yaml | 5 + .changes/v1.14/BUGFIX-20250927-184134.yaml | 5 + .../v1.14/ENHANCEMENTS-20250723-122922.yaml | 5 + .../v1.14/ENHANCEMENTS-20250723-141420.yaml | 5 + .../v1.14/NEW FEATURES-20250829-151946.yaml | 5 + .../v1.14/NEW FEATURES-20250829-183404.yaml | 3 + .../v1.14/NEW FEATURES-20250829-184206.yaml | 3 + .../v1.14/NEW FEATURES-20250903-131921.yaml | 5 + .../v1.14/UPGRADE NOTES-20250814-162650.yaml | 5 + .../v1.14/UPGRADE NOTES-20250814-162752.yaml | 5 + .changes/v1.15/.gitkeep | 0 .../v1.15/NEW FEATURES-20250926-164134.yaml | 5 - .changie.yaml | 2 +- .github/pull_request_template.md | 2 +- .github/workflows/build.yml | 1 - CHANGELOG.md | 39 +- docs/destroying.md | 6 +- docs/plugin-protocol/tfplugin6.proto | 53 +- go.mod | 2 +- go.sum | 5 +- .../builtin/providers/terraform/provider.go | 12 - .../cloudplugin/cloudproto1/cloudproto1.pb.go | 113 + .../cloudproto1/cloudproto1_grpc.pb.go | 139 - internal/command/e2etest/meta_backend_test.go | 85 - .../command/e2etest/providers_schema_test.go | 2 - internal/command/init.go | 33 +- internal/command/init_run.go | 6 +- internal/command/init_run_experiment.go | 4 +- internal/command/meta.go | 2 +- internal/command/meta_backend.go | 52 - internal/command/meta_backend_test.go | 77 - internal/command/meta_providers.go | 34 +- internal/command/query_test.go | 10 +- internal/command/views/apply.go | 24 +- internal/getproviders/reattach/reattach.go | 99 - .../getproviders/reattach/reattach_test.go | 288 -- internal/grpcwrap/provider6.go | 8 - internal/plugin/grpc_provider.go | 8 - internal/plugin6/grpc_provider.go | 256 +- internal/plugin6/grpc_provider_test.go | 809 ----- internal/plugin6/mock_proto/generate.go | 2 +- internal/plugin6/mock_proto/mock.go | 306 +- internal/provider-simple-v6/provider.go | 12 +- internal/provider-simple/provider.go | 12 +- internal/providers/mock.go | 8 - internal/providers/provider.go | 49 - internal/providers/testing/provider_mock.go | 36 - internal/refactoring/mock_provider.go | 8 - .../rpcapi/dynrpcserver/generator/main.go | 10 - .../dependencies/dependencies.pb.go | 602 ++++ .../dependencies/dependencies_grpc.pb.go | 639 ---- .../rpcapi/terraform1/packages/packages.pb.go | 228 ++ .../terraform1/packages/packages_grpc.pb.go | 258 -- internal/rpcapi/terraform1/setup/setup.pb.go | 134 + .../rpcapi/terraform1/setup/setup_grpc.pb.go | 161 - .../rpcapi/terraform1/stacks/stacks.pb.go | 832 +++++ .../terraform1/stacks/stacks_grpc.pb.go | 873 ------ .../internal/stackeval/stubs/errored.go | 28 - .../internal/stackeval/stubs/offline.go | 28 - .../internal/stackeval/stubs/unknown.go | 28 - .../stacksproto1/stacksproto1.pb.go | 113 + .../stacksproto1/stacksproto1_grpc.pb.go | 139 - .../terraform/context_apply_action_test.go | 40 - .../terraform/context_plan_actions_test.go | 67 - internal/terraform/context_plan_query_test.go | 9 +- .../terraform/node_resource_plan_instance.go | 11 +- internal/tfplugin5/tfplugin5.pb.go | 1357 ++++++++ internal/tfplugin5/tfplugin5_grpc.pb.go | 1447 --------- internal/tfplugin6/tfplugin6.pb.go | 2741 +++++++++++------ internal/tfplugin6/tfplugin6_grpc.pb.go | 1515 --------- main.go | 58 +- tools/protobuf-compile/protobuf-compile.go | 109 +- version/VERSION | 2 +- 82 files changed, 5393 insertions(+), 8727 deletions(-) rename .changes/{1.15.0.md => 1.14.0.md} (100%) create mode 100644 .changes/v1.13/BUG FIXES-20250804-162137.yaml create mode 100644 .changes/v1.13/BUG FIXES-20250821-091753.yaml create mode 100644 .changes/v1.13/BUG FIXES-20250825-125018.yaml create mode 100644 .changes/v1.13/BUG FIXES-20250905-083104.yaml create mode 100644 .changes/v1.13/BUG FIXES-20250910-095424.yaml create mode 100644 .changes/v1.13/BUG FIXES-20250911-142038.yaml create mode 100644 .changes/v1.14/BUG FIXES-20250714-135938.yaml create mode 100644 .changes/v1.14/BUG FIXES-20250828-182746.yaml create mode 100644 .changes/v1.14/BUGFIX-20250927-184134.yaml create mode 100644 .changes/v1.14/ENHANCEMENTS-20250723-122922.yaml create mode 100644 .changes/v1.14/ENHANCEMENTS-20250723-141420.yaml create mode 100644 .changes/v1.14/NEW FEATURES-20250829-151946.yaml create mode 100644 .changes/v1.14/NEW FEATURES-20250829-183404.yaml create mode 100644 .changes/v1.14/NEW FEATURES-20250829-184206.yaml create mode 100644 .changes/v1.14/NEW FEATURES-20250903-131921.yaml create mode 100644 .changes/v1.14/UPGRADE NOTES-20250814-162650.yaml create mode 100644 .changes/v1.14/UPGRADE NOTES-20250814-162752.yaml delete mode 100644 .changes/v1.15/.gitkeep delete mode 100644 .changes/v1.15/NEW FEATURES-20250926-164134.yaml delete mode 100644 internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go delete mode 100644 internal/command/e2etest/meta_backend_test.go delete mode 100644 internal/getproviders/reattach/reattach.go delete mode 100644 internal/getproviders/reattach/reattach_test.go delete mode 100644 internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go delete mode 100644 internal/rpcapi/terraform1/packages/packages_grpc.pb.go delete mode 100644 internal/rpcapi/terraform1/setup/setup_grpc.pb.go delete mode 100644 internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go delete mode 100644 internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go delete mode 100644 internal/tfplugin5/tfplugin5_grpc.pb.go delete mode 100644 internal/tfplugin6/tfplugin6_grpc.pb.go diff --git a/.changes/1.15.0.md b/.changes/1.14.0.md similarity index 100% rename from .changes/1.15.0.md rename to .changes/1.14.0.md diff --git a/.changes/previous-releases.md b/.changes/previous-releases.md index d3f9501009c2..9dbc3d602248 100644 --- a/.changes/previous-releases.md +++ b/.changes/previous-releases.md @@ -1,4 +1,3 @@ -- [v1.14](https://github.com/hashicorp/terraform/blob/v1.14/CHANGELOG.md) - [v1.13](https://github.com/hashicorp/terraform/blob/v1.13/CHANGELOG.md) - [v1.12](https://github.com/hashicorp/terraform/blob/v1.12/CHANGELOG.md) - [v1.11](https://github.com/hashicorp/terraform/blob/v1.11/CHANGELOG.md) diff --git a/.changes/v1.13/BUG FIXES-20250804-162137.yaml b/.changes/v1.13/BUG FIXES-20250804-162137.yaml new file mode 100644 index 000000000000..2a9dbd238f20 --- /dev/null +++ b/.changes/v1.13/BUG FIXES-20250804-162137.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: Fixes resource identity being dropped from state in certain cases +time: 2025-08-04T16:21:37.590435+02:00 +custom: + Issue: "37396" diff --git a/.changes/v1.13/BUG FIXES-20250821-091753.yaml b/.changes/v1.13/BUG FIXES-20250821-091753.yaml new file mode 100644 index 000000000000..d39012ed0c8d --- /dev/null +++ b/.changes/v1.13/BUG FIXES-20250821-091753.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: Fix regression that caused `terraform test` with zero tests to return a non-zero exit code. +time: 2025-08-21T09:17:53.534792+02:00 +custom: + Issue: "37477" diff --git a/.changes/v1.13/BUG FIXES-20250825-125018.yaml b/.changes/v1.13/BUG FIXES-20250825-125018.yaml new file mode 100644 index 000000000000..1d915d7d5a8b --- /dev/null +++ b/.changes/v1.13/BUG FIXES-20250825-125018.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: 'terraform test: prevent panic when resolving incomplete references' +time: 2025-08-25T12:50:18.511449+02:00 +custom: + Issue: "37484" diff --git a/.changes/v1.13/BUG FIXES-20250905-083104.yaml b/.changes/v1.13/BUG FIXES-20250905-083104.yaml new file mode 100644 index 000000000000..0cbd970f7447 --- /dev/null +++ b/.changes/v1.13/BUG FIXES-20250905-083104.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: "test: Fix the order of execution of cleanup nodes" +time: 2025-09-05T08:31:04.56877+02:00 +custom: + Issue: "37546" diff --git a/.changes/v1.13/BUG FIXES-20250910-095424.yaml b/.changes/v1.13/BUG FIXES-20250910-095424.yaml new file mode 100644 index 000000000000..d34da5672be8 --- /dev/null +++ b/.changes/v1.13/BUG FIXES-20250910-095424.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: 'apply: hide sensitive inputs when values have changed between plan and apply' +time: 2025-09-10T09:54:24.889605+02:00 +custom: + Issue: "37582" diff --git a/.changes/v1.13/BUG FIXES-20250911-142038.yaml b/.changes/v1.13/BUG FIXES-20250911-142038.yaml new file mode 100644 index 000000000000..4355a4c01788 --- /dev/null +++ b/.changes/v1.13/BUG FIXES-20250911-142038.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: 'variable validation: keep sensitive and ephemeral metadata when evaluating variable conditions.' +time: 2025-09-11T14:20:38.411183+02:00 +custom: + Issue: "37595" diff --git a/.changes/v1.14/BUG FIXES-20250714-135938.yaml b/.changes/v1.14/BUG FIXES-20250714-135938.yaml new file mode 100644 index 000000000000..69b483e11a62 --- /dev/null +++ b/.changes/v1.14/BUG FIXES-20250714-135938.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: Retrieve all workspace variables while doing a `terraform import`, include variables inherited from variable sets but not overwritten by the workspace. +time: 2025-07-14T13:59:38.867411+05:30 +custom: + Issue: "37241" diff --git a/.changes/v1.14/BUG FIXES-20250828-182746.yaml b/.changes/v1.14/BUG FIXES-20250828-182746.yaml new file mode 100644 index 000000000000..a7f07b433a87 --- /dev/null +++ b/.changes/v1.14/BUG FIXES-20250828-182746.yaml @@ -0,0 +1,5 @@ +kind: BUG FIXES +body: Fix OSS backend proxy support by adding a proxy layer for OSS backend operations. Resolves hashicorp/terraform#36897. +time: 2025-08-28T18:27:46.867411+05:30 +custom: + Issue: "36897" \ No newline at end of file diff --git a/.changes/v1.14/BUGFIX-20250927-184134.yaml b/.changes/v1.14/BUGFIX-20250927-184134.yaml new file mode 100644 index 000000000000..a6772d3afbb4 --- /dev/null +++ b/.changes/v1.14/BUGFIX-20250927-184134.yaml @@ -0,0 +1,5 @@ +kind: BUGFIX +body: The CLI now summarizes the number of actions invoked during `terraform apply`, matching the plan output. +time: 2025-09-27T18:41:34.771437+02:00 +custom: + Issue: "37689" diff --git a/.changes/v1.14/ENHANCEMENTS-20250723-122922.yaml b/.changes/v1.14/ENHANCEMENTS-20250723-122922.yaml new file mode 100644 index 000000000000..2738fafb61d9 --- /dev/null +++ b/.changes/v1.14/ENHANCEMENTS-20250723-122922.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: 'terraform test: expected diagnostics will be included in test output when running in verbose mode"' +time: 2025-07-23T12:29:22.244611+02:00 +custom: + Issue: "37362" diff --git a/.changes/v1.14/ENHANCEMENTS-20250723-141420.yaml b/.changes/v1.14/ENHANCEMENTS-20250723-141420.yaml new file mode 100644 index 000000000000..7edfaa2280b2 --- /dev/null +++ b/.changes/v1.14/ENHANCEMENTS-20250723-141420.yaml @@ -0,0 +1,5 @@ +kind: ENHANCEMENTS +body: 'terraform test: ignore prevent_destroy attribute during when cleaning up tests"' +time: 2025-07-23T14:14:20.602923+02:00 +custom: + Issue: "37364" diff --git a/.changes/v1.14/NEW FEATURES-20250829-151946.yaml b/.changes/v1.14/NEW FEATURES-20250829-151946.yaml new file mode 100644 index 000000000000..d59ca48e43ec --- /dev/null +++ b/.changes/v1.14/NEW FEATURES-20250829-151946.yaml @@ -0,0 +1,5 @@ +kind: NEW FEATURES +body: A new GenerateResourceConfiguration RPC allows providers to create more precise configuration values during import. +time: 2025-08-29T15:19:46.781245-04:00 +custom: + Issue: "37515" diff --git a/.changes/v1.14/NEW FEATURES-20250829-183404.yaml b/.changes/v1.14/NEW FEATURES-20250829-183404.yaml new file mode 100644 index 000000000000..e0751ba14201 --- /dev/null +++ b/.changes/v1.14/NEW FEATURES-20250829-183404.yaml @@ -0,0 +1,3 @@ +kind: NEW FEATURES +body: "**List Resources**: List resources can be defined in `*.tfquery.hcl` files and allow querying and filterting existing infrastructure." +time: 2025-08-29T18:34:04.250038+02:00 diff --git a/.changes/v1.14/NEW FEATURES-20250829-184206.yaml b/.changes/v1.14/NEW FEATURES-20250829-184206.yaml new file mode 100644 index 000000000000..ae79073e2f9a --- /dev/null +++ b/.changes/v1.14/NEW FEATURES-20250829-184206.yaml @@ -0,0 +1,3 @@ +kind: NEW FEATURES +body: "A new Terraform command `terraform query`: Executes list operations against existing infrastructure and displays the results. The command can optionally generate configuration for importing results into Terraform." +time: 2025-08-29T18:42:06.659172+02:00 diff --git a/.changes/v1.14/NEW FEATURES-20250903-131921.yaml b/.changes/v1.14/NEW FEATURES-20250903-131921.yaml new file mode 100644 index 000000000000..6087d99b9757 --- /dev/null +++ b/.changes/v1.14/NEW FEATURES-20250903-131921.yaml @@ -0,0 +1,5 @@ +kind: NEW FEATURES +body: "New top-level Actions block: Actions are provider defined and meant to codify use cases outside the normal CRUD model in your Terraform configuration. Providers can define Actions like `aws_lambda_invoke` or `aws_cloudfront_create_invalidation` that do something imparative outside of Terraforms normal CRUD model. You can configure such a side-effect with an action block and have actions triggered through the lifecycle of a resource or through passing the `-invoke` CLI flag." +time: 2025-09-03T13:19:21.097051+02:00 +custom: + Issue: "37553" diff --git a/.changes/v1.14/UPGRADE NOTES-20250814-162650.yaml b/.changes/v1.14/UPGRADE NOTES-20250814-162650.yaml new file mode 100644 index 000000000000..17baa54cca2e --- /dev/null +++ b/.changes/v1.14/UPGRADE NOTES-20250814-162650.yaml @@ -0,0 +1,5 @@ +kind: UPGRADE NOTES +body: 'The parallelism of Terraform operations within container runtimes may be reduced depending on the CPU bandwidth limit setting.' +time: 2025-08-14T16:26:50.569878+02:00 +custom: + Issue: "37436" diff --git a/.changes/v1.14/UPGRADE NOTES-20250814-162752.yaml b/.changes/v1.14/UPGRADE NOTES-20250814-162752.yaml new file mode 100644 index 000000000000..c42a78470ce1 --- /dev/null +++ b/.changes/v1.14/UPGRADE NOTES-20250814-162752.yaml @@ -0,0 +1,5 @@ +kind: UPGRADE NOTES +body: 'Building Terraform 1.14 requires macOS Monterey or later (due to being built on Go 1.25 which imposes these requirements)' +time: 2025-08-14T16:27:52.659896+02:00 +custom: + Issue: "37436" diff --git a/.changes/v1.15/.gitkeep b/.changes/v1.15/.gitkeep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/.changes/v1.15/NEW FEATURES-20250926-164134.yaml b/.changes/v1.15/NEW FEATURES-20250926-164134.yaml deleted file mode 100644 index b55e44da384c..000000000000 --- a/.changes/v1.15/NEW FEATURES-20250926-164134.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: NEW FEATURES -body: We now produce builds for Windows ARM64 -time: 2025-09-26T16:41:34.771437+02:00 -custom: - Issue: "32719" diff --git a/.changie.yaml b/.changie.yaml index 831fe6fb5b6f..063ce48dd3c7 100644 --- a/.changie.yaml +++ b/.changie.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: BUSL-1.1 changesDir: .changes -unreleasedDir: v1.15 +unreleasedDir: v1.14 versionFooterPath: version_footer.tpl.md changelogPath: CHANGELOG.md versionExt: md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 0194cc47c352..00f9ad48bbcf 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -31,7 +31,7 @@ label to enable the backport bot. --> -1.15.x +1.14.x ## Rollback Plan diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a877a62353e9..6dc19041c00c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -121,7 +121,6 @@ jobs: - {goos: "solaris", goarch: "amd64", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "windows", goarch: "386", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "windows", goarch: "amd64", runson: "ubuntu-latest", cgo-enabled: "0"} - - {goos: "windows", goarch: "arm64", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "darwin", goarch: "amd64", runson: "ubuntu-latest", cgo-enabled: "0"} - {goos: "darwin", goarch: "arm64", runson: "ubuntu-latest", cgo-enabled: "0"} fail-fast: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b436edc3388..b1ccc4cdec1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,40 @@ -## 1.15.0 (Unreleased) +## 1.14.0 (Unreleased) + + +NEW FEATURES: + +* **List Resources**: List resources can be defined in `*.tfquery.hcl` files and allow querying and filterting existing infrastructure. + +* A new Terraform command `terraform query`: Executes list operations against existing infrastructure and displays the results. The command can optionally generate configuration for importing results into Terraform. + +* A new GenerateResourceConfiguration RPC allows providers to create more precise configuration values during import. ([#37515](https://github.com/hashicorp/terraform/issues/37515)) + +* New top-level Actions block: Actions are provider defined and meant to codify use cases outside the normal CRUD model in your Terraform configuration. Providers can define Actions like `aws_lambda_invoke` or `aws_cloudfront_create_invalidation` that do something imparative outside of Terraforms normal CRUD model. You can configure such a side-effect with an action block and have actions triggered through the lifecycle of a resource or through passing the `-invoke` CLI flag. ([#37553](https://github.com/hashicorp/terraform/issues/37553)) + + +ENHANCEMENTS: + +* terraform test: expected diagnostics will be included in test output when running in verbose mode" ([#37362](https://github.com/hashicorp/terraform/issues/37362)) + +* terraform test: ignore prevent_destroy attribute during when cleaning up tests" ([#37364](https://github.com/hashicorp/terraform/issues/37364)) + +* `terraform stacks` command support for `-help` flag ([#37645](https://github.com/hashicorp/terraform/issues/37645)) + + +BUG FIXES: + +* Retrieve all workspace variables while doing a `terraform import`, include variables inherited from variable sets but not overwritten by the workspace. ([#37241](https://github.com/hashicorp/terraform/issues/37241)) + +* Fix OSS backend proxy support by adding a proxy layer for OSS backend operations. Resolves hashicorp/terraform#36897. ([#36897](https://github.com/hashicorp/terraform/issues/36897)) + +* console and test: return explicit diagnostics when referencing resources that were not included in the most recent operation. ([#37663](https://github.com/hashicorp/terraform/issues/37663)) + + +UPGRADE NOTES: + +* The parallelism of Terraform operations within container runtimes may be reduced depending on the CPU bandwidth limit setting. ([#37436](https://github.com/hashicorp/terraform/issues/37436)) + +* Building Terraform 1.14 requires macOS Monterey or later (due to being built on Go 1.25 which imposes these requirements) ([#37436](https://github.com/hashicorp/terraform/issues/37436)) EXPERIMENTS: @@ -15,7 +51,6 @@ Experiments are only enabled in alpha releases of Terraform CLI. The following f For information on prior major and minor releases, refer to their changelogs: -- [v1.14](https://github.com/hashicorp/terraform/blob/v1.14/CHANGELOG.md) - [v1.13](https://github.com/hashicorp/terraform/blob/v1.13/CHANGELOG.md) - [v1.12](https://github.com/hashicorp/terraform/blob/v1.12/CHANGELOG.md) - [v1.11](https://github.com/hashicorp/terraform/blob/v1.11/CHANGELOG.md) diff --git a/docs/destroying.md b/docs/destroying.md index 37bbe4ef7417..9643e26cbbc8 100644 --- a/docs/destroying.md +++ b/docs/destroying.md @@ -59,8 +59,8 @@ digraph update { Order of operations: 1. `A` is created -1. `B` is updated -1. `C` is updated +1. `B` is created +1. `C` is created ## Simple Resource Destruction @@ -87,7 +87,7 @@ digraph destroy { Order of operations: 1. `C` is destroyed 1. `B` is destroyed -1. `A` is destroyed +1. `A` is Destroyed ## Resource Replacement diff --git a/docs/plugin-protocol/tfplugin6.proto b/docs/plugin-protocol/tfplugin6.proto index b487ea578e5d..f001b4a4798f 100644 --- a/docs/plugin-protocol/tfplugin6.proto +++ b/docs/plugin-protocol/tfplugin6.proto @@ -390,11 +390,6 @@ service Provider { // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider rpc ConfigureStateStore(ConfigureStateStore.Request) returns (ConfigureStateStore.Response); - // ReadStateBytes streams byte chunks of a given state file from a state store - rpc ReadStateBytes(ReadStateBytes.Request) returns (stream ReadStateBytes.Response); - // WriteStateBytes streams byte chunks of a given state file into a state store - rpc WriteStateBytes(stream WriteStateBytes.RequestChunk) returns (WriteStateBytes.Response); - // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store rpc GetStates(GetStates.Request) returns (GetStates.Response); // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) @@ -901,6 +896,7 @@ message ValidateListResourceConfig { } } + message ValidateStateStore { message Request { string type_name = 1; @@ -915,59 +911,12 @@ message ConfigureStateStore { message Request { string type_name = 1; DynamicValue config = 2; - StateStoreClientCapabilities capabilities = 3; } message Response { repeated Diagnostic diagnostics = 1; - StateStoreServerCapabilities capabilities = 2; } } -message StateStoreClientCapabilities { - int64 chunk_size = 1; // suggested chunk size by Core -} - -message StateStoreServerCapabilities { - int64 chunk_size = 1; // chosen chunk size by plugin -} - -message ReadStateBytes { - message Request { - string type_name = 1; - string state_id = 2; - } - message Response { - bytes bytes = 1; - int64 total_length = 2; - StateRange range = 3; - repeated Diagnostic diagnostics = 4; - } -} - -message WriteStateBytes { - message RequestChunk { - // meta is sent with the first chunk only - optional RequestChunkMeta meta = 1; - - bytes bytes = 2; - int64 total_length = 3; - StateRange range = 4; - } - message Response { - repeated Diagnostic diagnostics = 1; - } -} - -message RequestChunkMeta { - string type_name = 1; - string state_id = 2; -} - -message StateRange { - int64 start = 1; - int64 end = 2; -} - message GetStates { message Request { string type_name = 1; diff --git a/go.mod b/go.mod index c2f701719d34..804b778c2e98 100644 --- a/go.mod +++ b/go.mod @@ -82,7 +82,7 @@ require ( golang.org/x/tools v0.36.0 golang.org/x/tools/cmd/cover v0.1.0-deprecated google.golang.org/grpc v1.69.4 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 google.golang.org/protobuf v1.36.6 honnef.co/go/tools v0.6.0 ) diff --git a/go.sum b/go.sum index 2ffcb84fe6e8..608a0bee9b65 100644 --- a/go.sum +++ b/go.sum @@ -1278,8 +1278,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 h1:TLkBREm4nIsEcexnCjgQd5GQWaHcqMzwQV0TX9pq8S0= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1292,6 +1292,7 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/internal/builtin/providers/terraform/provider.go b/internal/builtin/providers/terraform/provider.go index 89030e394c6e..6028fe7c0fea 100644 --- a/internal/builtin/providers/terraform/provider.go +++ b/internal/builtin/providers/terraform/provider.go @@ -295,18 +295,6 @@ func (p *Provider) ConfigureStateStore(req providers.ConfigureStateStoreRequest) return resp } -func (p *Provider) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - var resp providers.ReadStateBytesResponse - resp.Diagnostics.Append(fmt.Errorf("unsupported state store type %q", req.TypeName)) - return resp -} - -func (p *Provider) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - var resp providers.WriteStateBytesResponse - resp.Diagnostics.Append(fmt.Errorf("unsupported state store type %q", req.TypeName)) - return resp -} - func (p *Provider) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { var resp providers.GetStatesResponse resp.Diagnostics.Append(fmt.Errorf("unsupported state store type %q", req.TypeName)) diff --git a/internal/cloudplugin/cloudproto1/cloudproto1.pb.go b/internal/cloudplugin/cloudproto1/cloudproto1.pb.go index 9cda01b22b87..b2f2f048e43e 100644 --- a/internal/cloudplugin/cloudproto1/cloudproto1.pb.go +++ b/internal/cloudplugin/cloudproto1/cloudproto1.pb.go @@ -10,6 +10,10 @@ package cloudproto1 import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -240,3 +244,112 @@ func file_cloudproto1_proto_init() { file_cloudproto1_proto_goTypes = nil file_cloudproto1_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// CommandServiceClient is the client API for CommandService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CommandServiceClient interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) +} + +type commandServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { + return &commandServiceClient{cc} +} + +func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { + stream, err := c.cc.NewStream(ctx, &_CommandService_serviceDesc.Streams[0], "/cloudproto1.CommandService/Execute", opts...) + if err != nil { + return nil, err + } + x := &commandServiceExecuteClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type CommandService_ExecuteClient interface { + Recv() (*CommandResponse, error) + grpc.ClientStream +} + +type commandServiceExecuteClient struct { + grpc.ClientStream +} + +func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { + m := new(CommandResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// CommandServiceServer is the server API for CommandService service. +type CommandServiceServer interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(*CommandRequest, CommandService_ExecuteServer) error +} + +// UnimplementedCommandServiceServer can be embedded to have forward compatible implementations. +type UnimplementedCommandServiceServer struct { +} + +func (*UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { + return status.Errorf(codes.Unimplemented, "method Execute not implemented") +} + +func RegisterCommandServiceServer(s *grpc.Server, srv CommandServiceServer) { + s.RegisterService(&_CommandService_serviceDesc, srv) +} + +func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(CommandRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) +} + +type CommandService_ExecuteServer interface { + Send(*CommandResponse) error + grpc.ServerStream +} + +type commandServiceExecuteServer struct { + grpc.ServerStream +} + +func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { + return x.ServerStream.SendMsg(m) +} + +var _CommandService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cloudproto1.CommandService", + HandlerType: (*CommandServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Execute", + Handler: _CommandService_Execute_Handler, + ServerStreams: true, + }, + }, + Metadata: "cloudproto1.proto", +} diff --git a/internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go b/internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go deleted file mode 100644 index b43167c8e990..000000000000 --- a/internal/cloudplugin/cloudproto1/cloudproto1_grpc.pb.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: cloudproto1.proto - -package cloudproto1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - CommandService_Execute_FullMethodName = "/cloudproto1.CommandService/Execute" -) - -// CommandServiceClient is the client API for CommandService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type CommandServiceClient interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) -} - -type commandServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { - return &commandServiceClient{cc} -} - -func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { - stream, err := c.cc.NewStream(ctx, &CommandService_ServiceDesc.Streams[0], CommandService_Execute_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &commandServiceExecuteClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type CommandService_ExecuteClient interface { - Recv() (*CommandResponse, error) - grpc.ClientStream -} - -type commandServiceExecuteClient struct { - grpc.ClientStream -} - -func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { - m := new(CommandResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// CommandServiceServer is the server API for CommandService service. -// All implementations should embed UnimplementedCommandServiceServer -// for forward compatibility -type CommandServiceServer interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(*CommandRequest, CommandService_ExecuteServer) error -} - -// UnimplementedCommandServiceServer should be embedded to have forward compatible implementations. -type UnimplementedCommandServiceServer struct { -} - -func (UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { - return status.Errorf(codes.Unimplemented, "method Execute not implemented") -} - -// UnsafeCommandServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CommandServiceServer will -// result in compilation errors. -type UnsafeCommandServiceServer interface { - mustEmbedUnimplementedCommandServiceServer() -} - -func RegisterCommandServiceServer(s grpc.ServiceRegistrar, srv CommandServiceServer) { - s.RegisterService(&CommandService_ServiceDesc, srv) -} - -func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(CommandRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) -} - -type CommandService_ExecuteServer interface { - Send(*CommandResponse) error - grpc.ServerStream -} - -type commandServiceExecuteServer struct { - grpc.ServerStream -} - -func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { - return x.ServerStream.SendMsg(m) -} - -// CommandService_ServiceDesc is the grpc.ServiceDesc for CommandService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var CommandService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "cloudproto1.CommandService", - HandlerType: (*CommandServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Execute", - Handler: _CommandService_Execute_Handler, - ServerStreams: true, - }, - }, - Metadata: "cloudproto1.proto", -} diff --git a/internal/command/e2etest/meta_backend_test.go b/internal/command/e2etest/meta_backend_test.go deleted file mode 100644 index c14898ff383e..000000000000 --- a/internal/command/e2etest/meta_backend_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -package e2etest - -import ( - "fmt" - "os" - "path/filepath" - "testing" - - "github.com/apparentlymart/go-versions/versions" - tfaddr "github.com/hashicorp/terraform-registry-address" - "github.com/hashicorp/terraform/internal/addrs" - "github.com/hashicorp/terraform/internal/command" - "github.com/hashicorp/terraform/internal/configs" - "github.com/hashicorp/terraform/internal/depsfile" - "github.com/hashicorp/terraform/internal/e2e" - "github.com/hashicorp/terraform/internal/getproviders" - "github.com/hashicorp/terraform/internal/getproviders/providerreqs" -) - -func TestMetaBackend_GetStateStoreProviderFactory(t *testing.T) { - t.Run("gets the matching factory from local provider cache", func(t *testing.T) { - if !canRunGoBuild { - // We're running in a separate-build-then-run context, so we can't - // currently execute this test which depends on being able to build - // new executable at runtime. - // - // (See the comment on canRunGoBuild's declaration for more information.) - t.Skip("can't run without building a new provider executable") - } - - // Set up locks - locks := depsfile.NewLocks() - providerAddr := addrs.MustParseProviderSourceString("registry.terraform.io/hashicorp/simple") - constraint, err := providerreqs.ParseVersionConstraints(">1.0.0") - if err != nil { - t.Fatalf("test setup failed when making constraint: %s", err) - } - locks.SetProvider( - providerAddr, - versions.MustParseVersion("9.9.9"), - constraint, - []providerreqs.Hash{""}, - ) - - // Set up a local provider cache for the test to use - // 1. Build a binary for the current platform - simple6Provider := filepath.Join(".", "terraform-provider-simple6") - simple6ProviderExe := e2e.GoBuild("github.com/hashicorp/terraform/internal/provider-simple-v6/main", simple6Provider) - // 2. Create a working directory with .terraform/providers directory - td := t.TempDir() - t.Chdir(td) - providerPath := fmt.Sprintf(".terraform/providers/registry.terraform.io/hashicorp/simple/9.9.9/%s", getproviders.CurrentPlatform.String()) - err = os.MkdirAll(providerPath, os.ModePerm) - if err != nil { - t.Fatal(err) - } - // 3. Move the binary into the cache folder created above. - os.Rename(simple6ProviderExe, fmt.Sprintf("%s/%s/terraform-provider-simple", td, providerPath)) - - config := &configs.StateStore{ - ProviderAddr: tfaddr.MustParseProviderSource("registry.terraform.io/hashicorp/simple"), - // No other fields necessary for test. - } - - // Setup the meta and test GetStateStoreProviderFactory - m := command.Meta{} - factory, diags := m.GetStateStoreProviderFactory(config, locks) - if diags.HasErrors() { - t.Fatalf("unexpected error : %s", err) - } - - p, _ := factory() - defer p.Close() - s := p.GetProviderSchema() - expectedProviderDescription := "This is terraform-provider-simple v6" - if s.Provider.Body.Description != expectedProviderDescription { - t.Fatalf("expected description to be %q, but got %q", expectedProviderDescription, s.Provider.Body.Description) - } - }) - - // See command/meta_backend_test.go for other test cases -} diff --git a/internal/command/e2etest/providers_schema_test.go b/internal/command/e2etest/providers_schema_test.go index d729afdbacd6..582a21710c21 100644 --- a/internal/command/e2etest/providers_schema_test.go +++ b/internal/command/e2etest/providers_schema_test.go @@ -71,7 +71,6 @@ func TestProvidersSchema(t *testing.T) { "provider": { "version": 0, "block": { - "description": "This is terraform-provider-simple v5", "description_kind": "plain" } }, @@ -166,7 +165,6 @@ func TestProvidersSchema(t *testing.T) { "provider": { "version": 0, "block": { - "description": "This is terraform-provider-simple v6", "description_kind": "plain" } }, diff --git a/internal/command/init.go b/internal/command/init.go index 984c6be63f87..114ce62a291b 100644 --- a/internal/command/init.go +++ b/internal/command/init.go @@ -159,7 +159,7 @@ func (c *InitCommand) initCloud(ctx context.Context, root *configs.Module, extra return back, true, diags } -func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, extraConfig arguments.FlagNameValueSlice, viewType arguments.ViewType, configLocks *depsfile.Locks, view views.Init) (be backend.Backend, output bool, diags tfdiags.Diagnostics) { +func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, extraConfig arguments.FlagNameValueSlice, viewType arguments.ViewType, view views.Init) (be backend.Backend, output bool, diags tfdiags.Diagnostics) { ctx, span := tracer.Start(ctx, "initialize backend") _ = ctx // prevent staticcheck from complaining to avoid a maintenance hazard of having the wrong ctx in scope here defer span.End() @@ -187,9 +187,34 @@ func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, ext return nil, true, diags case root.StateStore != nil: // state_store config present - factory, fDiags := c.Meta.GetStateStoreProviderFactory(root.StateStore, configLocks) - diags = diags.Append(fDiags) - if fDiags.HasErrors() { + // Access provider factories + ctxOpts, err := c.contextOpts() + if err != nil { + diags = diags.Append(err) + return nil, true, diags + } + + if root.StateStore.ProviderAddr.IsZero() { + // This should not happen; this data is populated when parsing config, + // even for builtin providers + panic(fmt.Sprintf("unknown provider while beginning to initialize state store %q from provider %q", + root.StateStore.Type, + root.StateStore.Provider.Name)) + } + + var exists bool + factory, exists := ctxOpts.Providers[root.StateStore.ProviderAddr] + if !exists { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Provider unavailable", + Detail: fmt.Sprintf("The provider %s (%q) is required to initialize the %q state store, but the matching provider factory is missing. This is a bug in Terraform and should be reported.", + root.StateStore.Provider.Name, + root.StateStore.ProviderAddr, + root.StateStore.Type, + ), + Subject: &root.StateStore.TypeRange, + }) return nil, true, diags } diff --git a/internal/command/init_run.go b/internal/command/init_run.go index e2f4044dcad2..a030e856d97d 100644 --- a/internal/command/init_run.go +++ b/internal/command/init_run.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/terraform/internal/command/arguments" "github.com/hashicorp/terraform/internal/command/views" "github.com/hashicorp/terraform/internal/configs" - "github.com/hashicorp/terraform/internal/depsfile" "github.com/hashicorp/terraform/internal/states" "github.com/hashicorp/terraform/internal/terraform" "github.com/hashicorp/terraform/internal/tfdiags" @@ -171,10 +170,7 @@ func (c *InitCommand) run(initArgs *arguments.Init, view views.Init) int { case initArgs.Cloud && rootModEarly.CloudConfig != nil: back, backendOutput, backDiags = c.initCloud(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) case initArgs.Backend: - // initBackend has new parameters that aren't relevant to the original (unpluggable) version of the init command logic here. - // So for this version of the init command, we pass in empty locks intentionally. - emptyLocks := depsfile.NewLocks() - back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, emptyLocks, view) + back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) default: // load the previously-stored backend config back, backDiags = c.Meta.backendFromState(ctx) diff --git a/internal/command/init_run_experiment.go b/internal/command/init_run_experiment.go index f546f1444f5b..db97b9b40b02 100644 --- a/internal/command/init_run_experiment.go +++ b/internal/command/init_run_experiment.go @@ -205,7 +205,9 @@ func (c *InitCommand) runPssInit(initArgs *arguments.Init, view views.Init) int case initArgs.Cloud && rootModEarly.CloudConfig != nil: back, backendOutput, backDiags = c.initCloud(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) case initArgs.Backend: - back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, configLocks, view) + // TODO(SarahFrench/radeksimko) - pass information about config locks (`configLocks`) into initBackend to + // enable PSS + back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs.BackendConfig, initArgs.ViewType, view) default: // load the previously-stored backend config back, backDiags = c.Meta.backendFromState(ctx) diff --git a/internal/command/meta.go b/internal/command/meta.go index b7e60acc1c6e..1626109fbfb4 100644 --- a/internal/command/meta.go +++ b/internal/command/meta.go @@ -546,7 +546,7 @@ func (m *Meta) contextOpts() (*terraform.ContextOpts, error) { opts.Provisioners = m.testingOverrides.Provisioners } else { var providerFactories map[addrs.Provider]providers.Factory - providerFactories, err = m.ProviderFactories() + providerFactories, err = m.providerFactories() opts.Providers = providerFactories opts.Provisioners = m.provisionerFactories() } diff --git a/internal/command/meta_backend.go b/internal/command/meta_backend.go index 059ef2993771..41ef334afbb2 100644 --- a/internal/command/meta_backend.go +++ b/internal/command/meta_backend.go @@ -33,7 +33,6 @@ import ( "github.com/hashicorp/terraform/internal/command/views" "github.com/hashicorp/terraform/internal/command/workdir" "github.com/hashicorp/terraform/internal/configs" - "github.com/hashicorp/terraform/internal/depsfile" "github.com/hashicorp/terraform/internal/didyoumean" "github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/providers" @@ -1747,57 +1746,6 @@ func (m *Meta) assertSupportedCloudInitOptions(mode cloud.ConfigChangeMode) tfdi return diags } -func (m *Meta) GetStateStoreProviderFactory(config *configs.StateStore, locks *depsfile.Locks) (providers.Factory, tfdiags.Diagnostics) { - var diags tfdiags.Diagnostics - - if config == nil || locks == nil { - panic(fmt.Sprintf("nil config or nil locks passed to GetStateStoreProviderFactory: config %#v, locks %#v", config, locks)) - } - - if config.ProviderAddr.IsZero() { - // This should not happen; this data is populated when parsing config, - // even for builtin providers - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unknown provider used for state storage", - Detail: "Terraform could not find the provider used with the state_store. This is a bug in Terraform and should be reported.", - Subject: &config.TypeRange, - }) - } - - factories, err := m.ProviderFactoriesFromLocks(locks) - if err != nil { - // This may happen if the provider isn't present in the provider cache. - // This should be caught earlier by logic that diffs the config against the backend state file. - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Provider unavailable", - Detail: fmt.Sprintf("Terraform experienced an error when trying to use provider %s (%q) to initialize the %q state store: %s", - config.Provider.Name, - config.ProviderAddr, - config.Type, - err), - Subject: &config.TypeRange, - }) - } - - factory, exists := factories[config.ProviderAddr] - if !exists { - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Provider unavailable", - Detail: fmt.Sprintf("The provider %s (%q) is required to initialize the %q state store, but the matching provider factory is missing. This is a bug in Terraform and should be reported.", - config.Provider.Name, - config.ProviderAddr, - config.Type, - ), - Subject: &config.TypeRange, - }) - } - - return factory, diags -} - //------------------------------------------------------------------- // Output constants and initialization code //------------------------------------------------------------------- diff --git a/internal/command/meta_backend_test.go b/internal/command/meta_backend_test.go index 9821bfe9903c..9f049ccf0871 100644 --- a/internal/command/meta_backend_test.go +++ b/internal/command/meta_backend_test.go @@ -13,9 +13,7 @@ import ( "strings" "testing" - "github.com/apparentlymart/go-versions/versions" "github.com/hashicorp/cli" - tfaddr "github.com/hashicorp/terraform-registry-address" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/cloud" @@ -23,8 +21,6 @@ import ( "github.com/hashicorp/terraform/internal/configs" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/copy" - "github.com/hashicorp/terraform/internal/depsfile" - "github.com/hashicorp/terraform/internal/getproviders/providerreqs" "github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/providers" testing_provider "github.com/hashicorp/terraform/internal/providers/testing" @@ -2401,79 +2397,6 @@ func TestMetaBackend_configureStateStoreVariableUse(t *testing.T) { } } -func TestMetaBackend_GetStateStoreProviderFactory(t *testing.T) { - // See internal/command/e2etest/meta_backend_test.go for test case - // where a provider factory is found using a local provider cache - - t.Run("returns an error if a matching factory can't be found", func(t *testing.T) { - // Set up locks - locks := depsfile.NewLocks() - providerAddr := addrs.MustParseProviderSourceString("registry.terraform.io/hashicorp/simple") - constraint, err := providerreqs.ParseVersionConstraints(">1.0.0") - if err != nil { - t.Fatalf("test setup failed when making constraint: %s", err) - } - locks.SetProvider( - providerAddr, - versions.MustParseVersion("9.9.9"), - constraint, - []providerreqs.Hash{""}, - ) - - config := &configs.StateStore{ - ProviderAddr: tfaddr.MustParseProviderSource("registry.terraform.io/hashicorp/simple"), - Provider: &configs.Provider{ - Name: "foobar", - }, - Type: "store", - } - - // Setup the meta and test providerFactoriesDuringInit - m := testMetaBackend(t, nil) - _, diags := m.GetStateStoreProviderFactory(config, locks) - if !diags.HasErrors() { - t.Fatalf("expected error but got none") - } - expectedErr := "Provider unavailable" - expectedDetail := "Terraform experienced an error when trying to use provider foobar (\"registry.terraform.io/hashicorp/simple\") to initialize the \"store\" state store" - if diags[0].Description().Summary != expectedErr { - t.Fatalf("expected error summary to include %q but got: %s", - expectedErr, - diags[0].Description().Summary, - ) - } - if !strings.Contains(diags[0].Description().Detail, expectedDetail) { - t.Fatalf("expected error detail to include %q but got: %s", - expectedErr, - diags[0].Description().Detail, - ) - } - }) - - t.Run("returns an error if provider addr data is missing", func(t *testing.T) { - // Only minimal locks needed - locks := depsfile.NewLocks() - - config := &configs.StateStore{ - ProviderAddr: tfaddr.Provider{}, // Empty - } - - // Setup the meta and test providerFactoriesDuringInit - m := testMetaBackend(t, nil) - _, diags := m.GetStateStoreProviderFactory(config, locks) - if !diags.HasErrors() { - t.Fatal("expected and error but got none") - } - expectedErr := "Unknown provider used for state storage" - if !strings.Contains(diags.Err().Error(), expectedErr) { - t.Fatalf("expected error to include %q but got: %s", - expectedErr, - diags.Err().Error(), - ) - } - }) -} - func testMetaBackend(t *testing.T, args []string) *Meta { var m Meta m.Ui = new(cli.MockUi) diff --git a/internal/command/meta_providers.go b/internal/command/meta_providers.go index 8a356b966555..9d8bd2763aac 100644 --- a/internal/command/meta_providers.go +++ b/internal/command/meta_providers.go @@ -16,7 +16,6 @@ import ( "github.com/hashicorp/terraform/internal/addrs" builtinProviders "github.com/hashicorp/terraform/internal/builtin/providers" - "github.com/hashicorp/terraform/internal/depsfile" "github.com/hashicorp/terraform/internal/getproviders" "github.com/hashicorp/terraform/internal/logging" tfplugin "github.com/hashicorp/terraform/internal/plugin" @@ -247,48 +246,23 @@ func (m *Meta) providerDevOverrideRuntimeWarningsRemoteExecution() tfdiags.Diagn } } -// ProviderFactories uses the selections made previously by an installer in +// providerFactories uses the selections made previously by an installer in // the local cache directory (m.providerLocalCacheDir) to produce a map -// of provider addresses to factory functions to create instances of +// from provider addresses to factory functions to create instances of // those providers. // -// ProviderFactories will return an error if the installer's selections cannot +// providerFactories will return an error if the installer's selections cannot // be honored with what is currently in the cache, such as if a selected // package has been removed from the cache or if the contents of a selected // package have been modified outside of the installer. If it returns an error, // the returned map may be incomplete or invalid, but will be as complete // as possible given the cause of the error. -func (m *Meta) ProviderFactories() (map[addrs.Provider]providers.Factory, error) { +func (m *Meta) providerFactories() (map[addrs.Provider]providers.Factory, error) { locks, diags := m.lockedDependencies() if diags.HasErrors() { return nil, fmt.Errorf("failed to read dependency lock file: %s", diags.Err()) } - return m.providerFactoriesFromLocks(locks) -} - -// ProviderFactoriesFromLocks receives in memory locks and uses them to produce a map -// of provider addresses to factory functions to create instances of -// those providers. -// -// ProviderFactoriesFromLocks should only be used if the calling code relies on locks -// that have not yet been persisted to a dependency lock file on disk. Realistically, this -// means only code in the init command should use this method. -func (m *Meta) ProviderFactoriesFromLocks(configLocks *depsfile.Locks) (map[addrs.Provider]providers.Factory, error) { - // Ensure overrides and unmanaged providers are reflected in the returned list of factories, - // while avoiding mutating the in-memory - locks := m.annotateDependencyLocksWithOverrides(configLocks.DeepCopy()) - - return m.providerFactoriesFromLocks(locks) -} - -// providerFactoriesFromLocks returns a map of provider factories from a given set of locks. -// -// In most cases, calling code should not use this method directly. -// Instead, use: -// * `ProviderFactoriesFromLocks` - for use when locks aren't yet persisted to a dependency lock file. -// * `ProviderFactories` - for use when Terraform is guaranteed to read all necessary locks from a dependency lock file. -func (m *Meta) providerFactoriesFromLocks(locks *depsfile.Locks) (map[addrs.Provider]providers.Factory, error) { // We'll always run through all of our providers, even if one of them // encounters an error, so that we can potentially report multiple errors // where appropriate and so that callers can potentially make use of the diff --git a/internal/command/query_test.go b/internal/command/query_test.go index 95162d2ba861..e36c3e0fd1fb 100644 --- a/internal/command/query_test.go +++ b/internal/command/query_test.go @@ -16,7 +16,6 @@ import ( "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/providers" testing_provider "github.com/hashicorp/terraform/internal/providers/testing" - tfversion "github.com/hashicorp/terraform/version" "github.com/zclconf/go-cty/cty" ) @@ -536,7 +535,7 @@ func TestQuery_JSON(t *testing.T) { "ami": "ami-12345", "id": "test-instance-1", }, - "config": "resource \"test_instance\" \"example_0\" {\n provider = test\n ami = \"ami-12345\"\n id = \"test-instance-1\"\n}", + "config": "resource \"test_instance\" \"example_0\" {\n provider = test\n ami = \"ami-12345\"\n}", "import_config": "import {\n to = test_instance.example_0\n provider = test\n identity = {\n id = \"test-instance-1\"\n }\n}", }, "type": "list_resource_found", @@ -556,7 +555,7 @@ func TestQuery_JSON(t *testing.T) { "ami": "ami-67890", "id": "test-instance-2", }, - "config": "resource \"test_instance\" \"example_1\" {\n provider = test\n ami = \"ami-67890\"\n id = \"test-instance-2\"\n}", + "config": "resource \"test_instance\" \"example_1\" {\n provider = test\n ami = \"ami-67890\"\n}", "import_config": "import {\n to = test_instance.example_1\n provider = test\n identity = {\n id = \"test-instance-2\"\n }\n}", }, "type": "list_resource_found", @@ -772,7 +771,6 @@ func TestQuery_JSON(t *testing.T) { func TestQuery_JSON_Raw(t *testing.T) { - tfVer := tfversion.String() tests := []struct { name string directory string @@ -784,7 +782,7 @@ func TestQuery_JSON_Raw(t *testing.T) { { name: "basic query", directory: "basic", - expectedOut: `{"@level":"info","@message":"Terraform ` + tfVer + `","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} + expectedOut: `{"@level":"info","@message":"Terraform 1.14.0-dev","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} {"@level":"info","@message":"list.test_instance.example: Starting query...","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600609+02:00","list_start":{"address":"list.test_instance.example","resource_type":"test_instance","input_config":{"ami":"ami-12345","foo":null}},"type":"list_start"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600729+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 1","identity":{"id":"test-instance-1"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-12345","id":"test-instance-1"}},"type":"list_resource_found"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600759+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 2","identity":{"id":"test-instance-2"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-67890","id":"test-instance-2"}},"type":"list_resource_found"} @@ -794,7 +792,7 @@ func TestQuery_JSON_Raw(t *testing.T) { { name: "empty result", directory: "empty-result", - expectedOut: `{"@level":"info","@message":"Terraform ` + tfVer + `","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} + expectedOut: `{"@level":"info","@message":"Terraform 1.14.0-dev","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.596469+02:00","terraform":"1.14.0-dev","type":"version","ui":"1.2"} {"@level":"info","@message":"list.test_instance.example: Starting query...","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600609+02:00","list_start":{"address":"list.test_instance.example","resource_type":"test_instance","input_config":{"ami":"ami-12345","foo":null}},"type":"list_start"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600729+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 1","identity":{"id":"test-instance-1"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-12345","id":"test-instance-1"}},"type":"list_resource_found"} {"@level":"info","@message":"list.test_instance.example: Result found","@module":"terraform.ui","@timestamp":"2025-09-12T16:52:57.600759+02:00","list_resource_found":{"address":"list.test_instance.example","display_name":"Test Instance 2","identity":{"id":"test-instance-2"},"identity_version":1,"resource_type":"test_instance","resource_object":{"ami":"ami-67890","id":"test-instance-2"}},"type":"list_resource_found"} diff --git a/internal/command/views/apply.go b/internal/command/views/apply.go index 5c623bf62557..b8a64a94654a 100644 --- a/internal/command/views/apply.go +++ b/internal/command/views/apply.go @@ -61,27 +61,27 @@ type ApplyHuman struct { var _ Apply = (*ApplyHuman)(nil) func (v *ApplyHuman) ResourceCount(stateOutPath string) { + var summary string if v.destroy { - v.view.streams.Printf( - v.view.colorize.Color("[reset][bold][green]\nDestroy complete! Resources: %d destroyed.\n"), - v.countHook.Removed, - ) + summary = fmt.Sprintf("Destroy complete! Resources: %d destroyed.", v.countHook.Removed) } else if v.countHook.Imported > 0 { - v.view.streams.Printf( - v.view.colorize.Color("[reset][bold][green]\nApply complete! Resources: %d imported, %d added, %d changed, %d destroyed.\n"), + summary = fmt.Sprintf("Apply complete! Resources: %d imported, %d added, %d changed, %d destroyed.", v.countHook.Imported, v.countHook.Added, v.countHook.Changed, - v.countHook.Removed, - ) + v.countHook.Removed) } else { - v.view.streams.Printf( - v.view.colorize.Color("[reset][bold][green]\nApply complete! Resources: %d added, %d changed, %d destroyed.\n"), + summary = fmt.Sprintf("Apply complete! Resources: %d added, %d changed, %d destroyed.", v.countHook.Added, v.countHook.Changed, - v.countHook.Removed, - ) + v.countHook.Removed) } + v.view.streams.Print(v.view.colorize.Color("[reset][bold][green]\n" + summary)) + if v.countHook.ActionInvocation > 0 { + actionsStr := fmt.Sprintf("[reset][bold][green] Actions: %d invoked.", v.countHook.ActionInvocation) + v.view.streams.Print(v.view.colorize.Color(actionsStr)) + } + v.view.streams.Print("\n") if (v.countHook.Added > 0 || v.countHook.Changed > 0) && stateOutPath != "" { v.view.streams.Printf("\n%s\n\n", format.WordWrap(stateOutPathPostApply, v.view.outputColumns())) v.view.streams.Printf("State path: %s\n", stateOutPath) diff --git a/internal/getproviders/reattach/reattach.go b/internal/getproviders/reattach/reattach.go deleted file mode 100644 index 2b351a020855..000000000000 --- a/internal/getproviders/reattach/reattach.go +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -package reattach - -import ( - "encoding/json" - "fmt" - "net" - - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/terraform/internal/addrs" -) - -// TF_REATTACH_PROVIDERS is JSON string, containing a map of provider source to reattachment config. -// -// E.g this corresponds to a provider with source 'registry.terraform.io/hashicorp/foobar': -/* -{ -"foobar": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String":"/var/folders/xx/abcde12345/T/plugin12345" - } -} -*/ -const TF_REATTACH_PROVIDERS = "TF_REATTACH_PROVIDERS" - -// ParseReattachProviders parses information used for reattaching to unmanaged providers out of a -// JSON-encoded environment variable (TF_REATTACH_PROVIDERS). -// -// Calling code is expected to pass in the value of os.Getenv("TF_REATTACH_PROVIDERS") -func ParseReattachProviders(in string) (map[addrs.Provider]*plugin.ReattachConfig, error) { - unmanagedProviders := map[addrs.Provider]*plugin.ReattachConfig{} - if in != "" { - type reattachConfig struct { - Protocol string - ProtocolVersion int - Addr struct { - Network string - String string - } - Pid int - Test bool - } - var m map[string]reattachConfig - err := json.Unmarshal([]byte(in), &m) - if err != nil { - return unmanagedProviders, fmt.Errorf("Invalid format for %s: %w", TF_REATTACH_PROVIDERS, err) - } - for p, c := range m { - a, diags := addrs.ParseProviderSourceString(p) - if diags.HasErrors() { - return unmanagedProviders, fmt.Errorf("Error parsing %q as a provider address: %w", a, diags.Err()) - } - var addr net.Addr - switch c.Addr.Network { - case "unix": - addr, err = net.ResolveUnixAddr("unix", c.Addr.String) - if err != nil { - return unmanagedProviders, fmt.Errorf("Invalid unix socket path %q for %q: %w", c.Addr.String, p, err) - } - case "tcp": - addr, err = net.ResolveTCPAddr("tcp", c.Addr.String) - if err != nil { - return unmanagedProviders, fmt.Errorf("Invalid TCP address %q for %q: %w", c.Addr.String, p, err) - } - default: - return unmanagedProviders, fmt.Errorf("Unknown address type %q for %q", c.Addr.Network, p) - } - unmanagedProviders[a] = &plugin.ReattachConfig{ - Protocol: plugin.Protocol(c.Protocol), - ProtocolVersion: c.ProtocolVersion, - Pid: c.Pid, - Test: c.Test, - Addr: addr, - } - } - } - return unmanagedProviders, nil -} - -// IsProviderReattached determines if a given provider is being supplied to Terraform via the TF_REATTACH_PROVIDERS -// environment variable. -// -// Calling code is expected to pass in a provider address and the value of os.Getenv("TF_REATTACH_PROVIDERS") -func IsProviderReattached(provider addrs.Provider, in string) (bool, error) { - providers, err := ParseReattachProviders(in) - if err != nil { - return false, err - } - - _, ok := providers[provider] - return ok, nil -} diff --git a/internal/getproviders/reattach/reattach_test.go b/internal/getproviders/reattach/reattach_test.go deleted file mode 100644 index bbd9f2e3bc21..000000000000 --- a/internal/getproviders/reattach/reattach_test.go +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -package reattach - -import ( - "net" - "testing" - - "github.com/google/go-cmp/cmp" - "github.com/hashicorp/go-plugin" - tfaddr "github.com/hashicorp/terraform-registry-address" - "github.com/hashicorp/terraform/internal/addrs" -) - -func Test_parseReattachProviders(t *testing.T) { - cases := map[string]struct { - reattachProviders string - expectedOutput map[addrs.Provider]*plugin.ReattachConfig - expectErr bool - }{ - "simple parse - 1 provider": { - reattachProviders: `{ - "test": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String":"/var/folders/xx/abcde12345/T/plugin12345" - } - } - }`, - expectedOutput: map[addrs.Provider]*plugin.ReattachConfig{ - tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test"): func() *plugin.ReattachConfig { - addr, err := net.ResolveUnixAddr("unix", "/var/folders/xx/abcde12345/T/plugin12345") - if err != nil { - t.Fatal(err) - } - return &plugin.ReattachConfig{ - Protocol: plugin.Protocol("grpc"), - ProtocolVersion: 6, - Pid: 12345, - Test: true, - Addr: addr, - } - }(), - }, - }, - "complex parse - 2 providers via different protocols etc": { - reattachProviders: `{ - "test-grpc": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String": "/var/folders/xx/abcde12345/T/plugin12345" - } - }, - "test-netrpc": { - "Protocol": "netrpc", - "ProtocolVersion": 5, - "Pid": 6789, - "Test": false, - "Addr": { - "Network": "tcp", - "String":"127.0.0.1:1337" - } - } - }`, - expectedOutput: map[addrs.Provider]*plugin.ReattachConfig{ - //test-grpc - tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test-grpc"): func() *plugin.ReattachConfig { - addr, err := net.ResolveUnixAddr("unix", "/var/folders/xx/abcde12345/T/plugin12345") - if err != nil { - t.Fatal(err) - } - return &plugin.ReattachConfig{ - Protocol: plugin.Protocol("grpc"), - ProtocolVersion: 6, - Pid: 12345, - Test: true, - Addr: addr, - } - }(), - //test-netrpc - tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test-netrpc"): func() *plugin.ReattachConfig { - addr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:1337") - if err != nil { - t.Fatal(err) - } - return &plugin.ReattachConfig{ - Protocol: plugin.Protocol("netrpc"), - ProtocolVersion: 5, - Pid: 6789, - Test: false, - Addr: addr, - } - }(), - }, - }, - "can specify the providers host and namespace": { - // The key here has host and namespace data, vs. just "test" - reattachProviders: `{ - "example.com/my-org/test": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String":"/var/folders/xx/abcde12345/T/plugin12345" - } - } - }`, - expectedOutput: map[addrs.Provider]*plugin.ReattachConfig{ - tfaddr.NewProvider("example.com", "my-org", "test"): func() *plugin.ReattachConfig { - addr, err := net.ResolveUnixAddr("unix", "/var/folders/xx/abcde12345/T/plugin12345") - if err != nil { - t.Fatal(err) - } - return &plugin.ReattachConfig{ - Protocol: plugin.Protocol("grpc"), - ProtocolVersion: 6, - Pid: 12345, - Test: true, - Addr: addr, - } - }(), - }, - }, - "error - bad JSON": { - // Missing closing brace - reattachProviders: `{ - "test": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String":"/var/folders/xx/abcde12345/T/plugin12345" - } - } - `, - expectErr: true, - }, - "error - bad provider address": { - reattachProviders: `{ - "bad provider addr": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String":"/var/folders/xx/abcde12345/T/plugin12345" - } - } - }`, - expectErr: true, - }, - "error - unrecognized protocol": { - reattachProviders: `{ - "test": { - "Protocol": "carrier-pigeon", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "pigeon", - "String":"fly home little pigeon" - } - } - }`, - expectErr: true, - }, - "error - unrecognized network": { - reattachProviders: `{ - "test": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "linkedin", - "String":"http://www.linkedin.com/" - } - } - }`, - expectErr: true, - }, - "error - bad tcp address": { - // Addr.String has no port at the end - reattachProviders: `{ - "test": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "tcp", - "String":"127.0.0.1" - } - } - }`, - expectErr: true, - }, - } - - for tn, tc := range cases { - t.Run(tn, func(t *testing.T) { - output, err := ParseReattachProviders(tc.reattachProviders) - if err != nil { - if !tc.expectErr { - t.Fatal(err) - } - // an expected error occurred - return - } - if err == nil && tc.expectErr { - t.Fatal("expected error but there was none") - } - if diff := cmp.Diff(output, tc.expectedOutput); diff != "" { - t.Fatalf("expected diff:\n%s", diff) - } - }) - } -} - -func Test_isProviderReattached(t *testing.T) { - cases := map[string]struct { - provider addrs.Provider - reattachProviders string - expectedOutput bool - }{ - "identifies when a matching provider is present in TF_REATTACH_PROVIDERS": { - // Note that the source in the TF_REATTACH_PROVIDERS value is just the provider name. - // It'll be assumed to be under the default registry host and in the 'hashicorp' namespace. - reattachProviders: `{ - "test": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String":"/var/folders/xx/abcde12345/T/plugin12345" - } - } - }`, - provider: tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "hashicorp", "test"), - expectedOutput: true, - }, - "identifies when a provider doesn't have a match in TF_REATTACH_PROVIDERS": { - // Note the mismatch on namespace - reattachProviders: `{ - "hashicorp/test": { - "Protocol": "grpc", - "ProtocolVersion": 6, - "Pid": 12345, - "Test": true, - "Addr": { - "Network": "unix", - "String":"/var/folders/xx/abcde12345/T/plugin12345" - } - } - }`, - provider: tfaddr.NewProvider(tfaddr.DefaultProviderRegistryHost, "dadgarcorp", "test"), - expectedOutput: false, - }, - } - - for tn, tc := range cases { - t.Run(tn, func(t *testing.T) { - output, err := IsProviderReattached(tc.provider, tc.reattachProviders) - if err != nil { - t.Fatal(err) - } - if output != tc.expectedOutput { - t.Fatalf("expected returned value to be %v, got %v", tc.expectedOutput, output) - } - }) - } -} diff --git a/internal/grpcwrap/provider6.go b/internal/grpcwrap/provider6.go index 78bf0b369de8..d16d6d086ade 100644 --- a/internal/grpcwrap/provider6.go +++ b/internal/grpcwrap/provider6.go @@ -907,14 +907,6 @@ func (p *provider6) ConfigureStateStore(ctx context.Context, req *tfplugin6.Conf panic("not implemented") } -func (p *provider6) ReadStateBytes(req *tfplugin6.ReadStateBytes_Request, srv tfplugin6.Provider_ReadStateBytesServer) error { - panic("not implemented") -} - -func (p *provider6) WriteStateBytes(srv tfplugin6.Provider_WriteStateBytesServer) error { - panic("not implemented") -} - func (p *provider6) GetStates(ctx context.Context, req *tfplugin6.GetStates_Request) (*tfplugin6.GetStates_Response, error) { panic("not implemented") } diff --git a/internal/plugin/grpc_provider.go b/internal/plugin/grpc_provider.go index f416e6e28904..3f8251b4a11d 100644 --- a/internal/plugin/grpc_provider.go +++ b/internal/plugin/grpc_provider.go @@ -1444,14 +1444,6 @@ func (p *GRPCProvider) ConfigureStateStore(r providers.ConfigureStateStoreReques panic("not implemented") } -func (p *GRPCProvider) ReadStateBytes(r providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - panic("not implemented") -} - -func (p *GRPCProvider) WriteStateBytes(r providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - panic("not implemented") -} - func (p *GRPCProvider) GetStates(r providers.GetStatesRequest) providers.GetStatesResponse { panic("not implemented") } diff --git a/internal/plugin6/grpc_provider.go b/internal/plugin6/grpc_provider.go index a475ec66549a..0ab7da98b1a2 100644 --- a/internal/plugin6/grpc_provider.go +++ b/internal/plugin6/grpc_provider.go @@ -4,7 +4,6 @@ package plugin6 import ( - "bytes" "context" "errors" "fmt" @@ -12,7 +11,6 @@ import ( "sync" plugin "github.com/hashicorp/go-plugin" - "github.com/hashicorp/hcl/v2" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" ctyjson "github.com/zclconf/go-cty/cty/json" @@ -48,11 +46,6 @@ func (p *GRPCProviderPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Serve return nil } -// grpcMaxMessageSize is the maximum gRPC send and receive message sizes -// This matches the maximum set by a server implemented via terraform-plugin-go. -// See https://github.com/hashicorp/terraform-plugin-go/blob/a361c9bf/tfprotov6/tf6server/server.go#L88 -const grpcMaxMessageSize = 256 << 20 - // GRPCProvider handles the client, or core side of the plugin rpc connection. // The GRPCProvider methods are mostly a translation layer between the // terraform providers types and the grpc proto types, directly converting @@ -80,12 +73,8 @@ type GRPCProvider struct { // schema stores the schema for this provider. This is used to properly // serialize the requests for schemas. + mu sync.Mutex schema providers.GetProviderSchemaResponse - // stateChunkSize stores the negotiated chunk size for any implemented - // state store (keyed by type name) that have gone through successful configuration. - stateChunkSize map[string]int - - mu sync.Mutex } func (p *GRPCProvider) GetProviderSchema() providers.GetProviderSchemaResponse { @@ -1500,15 +1489,11 @@ func (p *GRPCProvider) ConfigureStateStore(r providers.ConfigureStateStoreReques return resp } - clientCapabilities := stateStoreClientCapabilitiesToProto(r.Capabilities) - logger.Trace("GRPCProvider.v6: ConfigureStateStore: proposing client capabilities", clientCapabilities) - protoReq := &proto6.ConfigureStateStore_Request{ TypeName: r.TypeName, Config: &proto6.DynamicValue{ Msgpack: mp, }, - Capabilities: clientCapabilities, } protoResp, err := p.client.ConfigureStateStore(p.ctx, protoReq) @@ -1516,237 +1501,10 @@ func (p *GRPCProvider) ConfigureStateStore(r providers.ConfigureStateStoreReques resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) return resp } - resp.Capabilities = stateStoreServerCapabilitiesFromProto(protoResp.Capabilities) - logger.Trace("GRPCProvider.v6: ConfigureStateStore: received server capabilities", resp.Capabilities) - resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(protoResp.Diagnostics)) return resp } -func (p *GRPCProvider) ReadStateBytes(r providers.ReadStateBytesRequest) (resp providers.ReadStateBytesResponse) { - logger.Trace("GRPCProvider.v6: ReadStateBytes") - - // ReadStateBytes can be more sensitive to message sizes - // so we ensure it aligns with (the lower) terraform-plugin-go. - opts := grpc.MaxRecvMsgSizeCallOption{ - MaxRecvMsgSize: grpcMaxMessageSize, - } - - schema := p.GetProviderSchema() - if schema.Diagnostics.HasErrors() { - resp.Diagnostics = schema.Diagnostics - return resp - } - - if _, ok := schema.StateStores[r.TypeName]; !ok { - resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("unknown state store type %q", r.TypeName)) - return resp - } - - protoReq := &proto6.ReadStateBytes_Request{ - TypeName: r.TypeName, - StateId: r.StateId, - } - - // Start the streaming RPC with a context. The context will be cancelled - // when this function returns, which will stop the stream if it is still - // running. - ctx, cancel := context.WithCancel(p.ctx) - defer cancel() - - client, err := p.client.ReadStateBytes(ctx, protoReq, opts) - if err != nil { - resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) - return resp - } - - buf := &bytes.Buffer{} - var expectedTotalLength int - for { - chunk, err := client.Recv() - if err == io.EOF { - // No chunk is returned alongside an EOF. - // And as EOF is a sentinel error it isn't wrapped as a diagnostic. - break - } - if err != nil { - resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) - break - } - resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(chunk.Diagnostics)) - if resp.Diagnostics.HasErrors() { - // If we have errors, we stop processing and return early - break - } - - if expectedTotalLength == 0 { - expectedTotalLength = int(chunk.TotalLength) - } - logger.Trace("GRPCProvider.v6: ReadStateBytes: received chunk for range", chunk.Range) - - // check the size of chunks matches to what was agreed - chunkSize, ok := p.stateChunkSize[r.TypeName] - if !ok { - resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("Unable to determine chunk size for provider %s; this is a bug in Terraform - please report it", r.TypeName)) - return resp - } - if chunk.Range.End < chunk.TotalLength { - // all but last chunk must match exactly - if len(chunk.Bytes) != chunkSize { - resp.Diagnostics = resp.Diagnostics.Append(&hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Unexpected size of chunk received", - Detail: fmt.Sprintf("Unexpected chunk of size %d was received, expected %d; this is a bug in the provider %s - please report it there", - len(chunk.Bytes), chunkSize, r.TypeName), - }) - } - } else { - // last chunk must be still within the agreed size - if len(chunk.Bytes) > chunkSize { - resp.Diagnostics = resp.Diagnostics.Append(&hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Unexpected size of last chunk received", - Detail: fmt.Sprintf("Last chunk exceeded agreed size, expected %d, given %d; this is a bug in the provider %s - please report it there", - chunkSize, len(chunk.Bytes), r.TypeName), - }) - } - } - - n, err := buf.Write(chunk.Bytes) - if err != nil { - resp.Diagnostics = resp.Diagnostics.Append(err) - break - } - logger.Trace("GRPCProvider.v6: ReadStateBytes: read bytes of a chunk", n) - } - - if resp.Diagnostics.HasErrors() { - logger.Trace("GRPCProvider.v6: ReadStateBytes: experienced an error when receiving state data from the provider", resp.Diagnostics.Err()) - return resp - } - - if buf.Len() != expectedTotalLength { - logger.Trace("GRPCProvider.v6: ReadStateBytes: received %d bytes but expected the total bytes to be %d.", buf.Len(), expectedTotalLength) - - err = fmt.Errorf("expected state file of total %d bytes, received %d bytes", - expectedTotalLength, buf.Len()) - resp.Diagnostics = resp.Diagnostics.Append(err) - return resp - } - - // We're done, so close the stream - logger.Trace("GRPCProvider.v6: ReadStateBytes: received all chunks, total bytes: ", buf.Len()) - err = client.CloseSend() - if err != nil { - resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) - return resp - } - - // Add the state data in the response once we know there are no errors - resp.Bytes = buf.Bytes() - - return resp -} - -func (p *GRPCProvider) WriteStateBytes(r providers.WriteStateBytesRequest) (resp providers.WriteStateBytesResponse) { - logger.Trace("GRPCProvider.v6: WriteStateBytes") - - // WriteStateBytes can be more sensitive to message sizes - // so we ensure it aligns with (the lower) terraform-plugin-go. - opts := grpc.MaxSendMsgSizeCallOption{ - MaxSendMsgSize: grpcMaxMessageSize, - } - - chunkSize, ok := p.stateChunkSize[r.TypeName] - if !ok { - resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("Unable to determine chunk size for provider %s; this is a bug in Terraform - please report it", r.TypeName)) - return resp - } - - schema := p.GetProviderSchema() - if schema.Diagnostics.HasErrors() { - resp.Diagnostics = schema.Diagnostics - return resp - } - - if _, ok := schema.StateStores[r.TypeName]; !ok { - resp.Diagnostics = resp.Diagnostics.Append(fmt.Errorf("unknown state store type %q", r.TypeName)) - return resp - } - - // Start the streaming RPC with a context. The context will be cancelled - // when this function returns, which will stop the stream if it is still - // running. - ctx, cancel := context.WithCancel(p.ctx) - defer cancel() - - client, err := p.client.WriteStateBytes(ctx, opts) - if err != nil { - resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) - return resp - } - - buf := bytes.NewBuffer(r.Bytes) - var totalLength int64 = int64(len(r.Bytes)) - var totalBytesProcessed int - for { - chunk := buf.Next(chunkSize) - - if len(chunk) == 0 { - // The previous iteration read the last of the data. Now we finish up. - protoResp, err := client.CloseAndRecv() - if err != nil { - resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) - return resp - } - resp.Diagnostics = resp.Diagnostics.Append(convert.ProtoToDiagnostics(protoResp.Diagnostics)) - if resp.Diagnostics.HasErrors() { - return resp - } - break - } - - var meta *proto6.RequestChunkMeta - if totalBytesProcessed == 0 { - // Send metadata with the first chunk only - meta = &proto6.RequestChunkMeta{ - TypeName: r.TypeName, - StateId: r.StateId, - } - } - - // There is more data to write - protoReq := &proto6.WriteStateBytes_RequestChunk{ - Meta: meta, - Bytes: chunk, - TotalLength: totalLength, - Range: &proto6.StateRange{ - Start: int64(totalBytesProcessed), - End: int64(totalBytesProcessed + len(chunk)), - }, - } - err = client.Send(protoReq) - if err != nil { - resp.Diagnostics = resp.Diagnostics.Append(grpcErr(err)) - return resp - } - - // Track progress before next iteration - totalBytesProcessed += len(chunk) - } - - return resp -} - -func (p *GRPCProvider) SetStateStoreChunkSize(typeName string, size int) { - p.mu.Lock() - defer p.mu.Unlock() - if p.stateChunkSize == nil { - p.stateChunkSize = make(map[string]int, 1) - } - p.stateChunkSize[typeName] = size -} - func (p *GRPCProvider) GetStates(r providers.GetStatesRequest) (resp providers.GetStatesResponse) { logger.Trace("GRPCProvider.v6: GetStates") @@ -2000,15 +1758,3 @@ func clientCapabilitiesToProto(c providers.ClientCapabilities) *proto6.ClientCap WriteOnlyAttributesAllowed: c.WriteOnlyAttributesAllowed, } } - -func stateStoreClientCapabilitiesToProto(c providers.StateStoreClientCapabilities) *proto6.StateStoreClientCapabilities { - return &proto6.StateStoreClientCapabilities{ - ChunkSize: c.ChunkSize, - } -} - -func stateStoreServerCapabilitiesFromProto(c *proto6.StateStoreServerCapabilities) providers.StateStoreServerCapabilities { - return providers.StateStoreServerCapabilities{ - ChunkSize: c.ChunkSize, - } -} diff --git a/internal/plugin6/grpc_provider_test.go b/internal/plugin6/grpc_provider_test.go index 226fb1578d35..44fb722dcff3 100644 --- a/internal/plugin6/grpc_provider_test.go +++ b/internal/plugin6/grpc_provider_test.go @@ -6,7 +6,6 @@ package plugin6 import ( "bytes" "context" - "errors" "fmt" "io" "testing" @@ -21,7 +20,6 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" "github.com/hashicorp/terraform/internal/addrs" - "github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/configs/hcl2shim" "github.com/hashicorp/terraform/internal/plans" @@ -62,16 +60,6 @@ func mockProviderClient(t *testing.T) *mockproto.MockProviderClient { return client } -func mockReadStateBytesClient(t *testing.T) *mockproto.MockProvider_ReadStateBytesClient { - ctrl := gomock.NewController(t) - return mockproto.NewMockProvider_ReadStateBytesClient(ctrl) -} - -func mockWriteStateBytesClient(t *testing.T) *mockproto.MockProvider_WriteStateBytesClient { - ctrl := gomock.NewController(t) - return mockproto.NewMockProvider_WriteStateBytesClient(ctrl) -} - func checkDiags(t *testing.T, d tfdiags.Diagnostics) { t.Helper() if d.HasErrors() { @@ -2289,7 +2277,6 @@ func TestGRPCProvider_ValidateStateStoreConfig_schema_errors(t *testing.T) { func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T) { storeName := "mock_store" // mockProviderClient returns a mock that has this state store in its schemas - chunkSize := 4 << 20 // 4MB t.Run("no validation error raised", func(t *testing.T) { typeName := storeName @@ -2305,9 +2292,6 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T gomock.Any(), gomock.Any(), ).Return(&proto.ConfigureStateStore_Response{ - Capabilities: &proto.StateStoreServerCapabilities{ - ChunkSize: int64(chunkSize), - }, Diagnostics: diagnostic, }, nil) @@ -2316,9 +2300,6 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T Config: cty.ObjectVal(map[string]cty.Value{ "region": cty.StringVal("neptune"), }), - Capabilities: providers.StateStoreClientCapabilities{ - ChunkSize: int64(chunkSize), - }, } // Act @@ -2349,9 +2330,6 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T gomock.Any(), gomock.Any(), ).Return(&proto.ConfigureStateStore_Response{ - Capabilities: &proto.StateStoreServerCapabilities{ - ChunkSize: int64(chunkSize), - }, Diagnostics: diagnostic, }, nil) @@ -2360,9 +2338,6 @@ func TestGRPCProvider_ConfigureStateStore_returns_validation_errors(t *testing.T Config: cty.ObjectVal(map[string]cty.Value{ "region": cty.StringVal("neptune"), }), - Capabilities: providers.StateStoreClientCapabilities{ - ChunkSize: int64(chunkSize), - }, } // Act @@ -2581,787 +2556,3 @@ func TestGRPCProvider_DeleteState(t *testing.T) { } }) } - -func TestGRPCProvider_ReadStateBytes(t *testing.T) { - chunkSize := 4 << 20 // 4MB - - t.Run("can process multiple chunks", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", 5) - - // Call to ReadStateBytes - // > Assert the arguments received - // > Define the returned mock client - expectedReq := &proto.ReadStateBytes_Request{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - } - mockReadBytesClient := mockReadStateBytesClient(t) - client.EXPECT().ReadStateBytes( - gomock.Any(), - gomock.Eq(expectedReq), - gomock.Any(), - ).Return(mockReadBytesClient, nil) - - // Define what will be returned by each call to Recv - chunks := []string{"hello", "world"} - totalLength := len(chunks[0]) + len(chunks[1]) - mockResp := map[int]struct { - resp *proto.ReadStateBytes_Response - err error - }{ - 0: { - resp: &proto.ReadStateBytes_Response{ - Bytes: []byte(chunks[0]), - TotalLength: int64(totalLength), - Range: &proto.StateRange{ - Start: 0, - End: int64(len(chunks[0])), - }, - }, - err: nil, - }, - 1: { - resp: &proto.ReadStateBytes_Response{ - Bytes: []byte(chunks[1]), - TotalLength: int64(totalLength), - Range: &proto.StateRange{ - Start: int64(len(chunks[0])), - End: int64(len(chunks[1])), - }, - }, - err: nil, - }, - 2: { - resp: &proto.ReadStateBytes_Response{}, - err: io.EOF, - }, - } - var count int - mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { - ret := mockResp[count] - count++ - return ret.resp, ret.err - }).Times(3) - - // There will be a call to CloseSend to close the stream - mockReadBytesClient.EXPECT().CloseSend().Return(nil).Times(1) - - // Act - request := providers.ReadStateBytesRequest{ - TypeName: expectedReq.TypeName, - StateId: expectedReq.StateId, - } - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiags(t, resp.Diagnostics) - if string(resp.Bytes) != "helloworld" { - t.Fatalf("expected data to be %q, got: %q", "helloworld", string(resp.Bytes)) - } - }) - - t.Run("an error diagnostic is returned when final length does not match expectations", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", 5) - - // Call to ReadStateBytes - // > Assert the arguments received - // > Define the returned mock client - mockReadBytesClient := mockReadStateBytesClient(t) - expectedReq := &proto.ReadStateBytes_Request{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - } - client.EXPECT().ReadStateBytes( - gomock.Any(), - gomock.Eq(expectedReq), - gomock.Any(), - ).Return(mockReadBytesClient, nil) - - // Define what will be returned by each call to Recv - chunks := []string{"hello", "world"} - var incorrectLength int64 = 999 - correctLength := len(chunks[0]) + len(chunks[1]) - mockResp := map[int]struct { - resp *proto.ReadStateBytes_Response - err error - }{ - 0: { - resp: &proto.ReadStateBytes_Response{ - Bytes: []byte(chunks[0]), - TotalLength: incorrectLength, - Range: &proto.StateRange{ - Start: 0, - End: int64(len(chunks[0])), - }, - }, - err: nil, - }, - 1: { - resp: &proto.ReadStateBytes_Response{ - Bytes: []byte(chunks[1]), - TotalLength: incorrectLength, - Range: &proto.StateRange{ - Start: int64(len(chunks[0])), - End: int64(len(chunks[1])), - }, - }, - err: nil, - }, - 2: { - resp: &proto.ReadStateBytes_Response{}, - err: io.EOF, - }, - } - var count int - mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { - ret := mockResp[count] - count++ - return ret.resp, ret.err - }).Times(3) - - // Act - request := providers.ReadStateBytesRequest{ - TypeName: expectedReq.TypeName, - StateId: expectedReq.StateId, - } - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiagsHasError(t, resp.Diagnostics) - expectedErr := fmt.Sprintf("expected state file of total %d bytes, received %d bytes", incorrectLength, correctLength) - if resp.Diagnostics.Err().Error() != expectedErr { - t.Fatalf("expected error diagnostic %q, but got: %q", expectedErr, resp.Diagnostics.Err()) - } - if len(resp.Bytes) != 0 { - t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) - } - }) - - t.Run("an error diagnostic is returned when store type does not exist", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // In this scenario the method returns before the call to the - // ReadStateBytes RPC, so no mocking needed - - badStoreType := "doesnt_exist" - request := providers.ReadStateBytesRequest{ - TypeName: badStoreType, - StateId: backend.DefaultStateName, - } - - // Act - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiagsHasError(t, resp.Diagnostics) - expectedErr := fmt.Sprintf("unknown state store type %q", badStoreType) - if resp.Diagnostics.Err().Error() != expectedErr { - t.Fatalf("expected error diagnostic %q, but got: %q", expectedErr, resp.Diagnostics.Err()) - } - if len(resp.Bytes) != 0 { - t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) - } - }) - - t.Run("error diagnostics from the provider are returned", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Call to ReadStateBytes - // > Assert the arguments received - // > Define the returned mock client - mockReadBytesClient := mockReadStateBytesClient(t) - - expectedReq := &proto.ReadStateBytes_Request{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - } - client.EXPECT().ReadStateBytes( - gomock.Any(), - gomock.Eq(expectedReq), - gomock.Any(), - ).Return(mockReadBytesClient, nil) - - // Define what will be returned by each call to Recv - mockReadBytesClient.EXPECT().Recv().Return(&proto.ReadStateBytes_Response{ - Diagnostics: []*proto.Diagnostic{ - { - Severity: proto.Diagnostic_ERROR, - Summary: "Error from test", - Detail: "This error is forced by the test case", - }, - }, - }, nil) - - // Act - request := providers.ReadStateBytesRequest{ - TypeName: expectedReq.TypeName, - StateId: expectedReq.StateId, - } - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiagsHasError(t, resp.Diagnostics) - expectedErr := "Error from test: This error is forced by the test case" - if resp.Diagnostics.Err().Error() != expectedErr { - t.Fatalf("expected error diagnostic %q, but got: %q", expectedErr, resp.Diagnostics.Err()) - } - if len(resp.Bytes) != 0 { - t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) - } - }) - - t.Run("warning diagnostics from the provider are returned", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Call to ReadStateBytes - // > Assert the arguments received - // > Define the returned mock client - mockReadBytesClient := mockReadStateBytesClient(t) - - expectedReq := &proto.ReadStateBytes_Request{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - } - client.EXPECT().ReadStateBytes( - gomock.Any(), - gomock.Eq(expectedReq), - gomock.Any(), - ).Return(mockReadBytesClient, nil) - - // Define what will be returned by each call to Recv - chunk := "hello world" - totalLength := len(chunk) - mockResp := map[int]struct { - resp *proto.ReadStateBytes_Response - err error - }{ - 0: { - resp: &proto.ReadStateBytes_Response{ - Bytes: []byte(chunk), - TotalLength: int64(totalLength), - Range: &proto.StateRange{ - Start: 0, - End: int64(len(chunk)), - }, - Diagnostics: []*proto.Diagnostic{ - { - Severity: proto.Diagnostic_WARNING, - Summary: "Warning from test", - Detail: "This warning is forced by the test case", - }, - }, - }, - err: nil, - }, - 1: { - resp: &proto.ReadStateBytes_Response{}, - err: io.EOF, - }, - } - var count int - mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { - ret := mockResp[count] - count++ - return ret.resp, ret.err - }).Times(2) - - // There will be a call to CloseSend to close the stream - mockReadBytesClient.EXPECT().CloseSend().Return(nil).Times(1) - - // Act - request := providers.ReadStateBytesRequest{ - TypeName: expectedReq.TypeName, - StateId: expectedReq.StateId, - } - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiags(t, resp.Diagnostics) - expectedWarn := "Warning from test: This warning is forced by the test case" - if resp.Diagnostics.ErrWithWarnings().Error() != expectedWarn { - t.Fatalf("expected warning diagnostic %q, but got: %q", expectedWarn, resp.Diagnostics.ErrWithWarnings().Error()) - } - if len(resp.Bytes) == 0 { - t.Fatal("expected data to included despite warnings, but got no bytes") - } - }) - - t.Run("when reading data, grpc errors are surfaced via diagnostics", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Call to ReadStateBytes - // > Assert the arguments received - // > Define the returned mock client - mockClient := mockReadStateBytesClient(t) - expectedReq := &proto.ReadStateBytes_Request{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - } - client.EXPECT().ReadStateBytes( - gomock.Any(), - gomock.Eq(expectedReq), - gomock.Any(), - ).Return(mockClient, nil) - - mockError := errors.New("grpc error forced in test") - mockClient.EXPECT().Recv().Return(&proto.ReadStateBytes_Response{}, mockError) - - // Act - request := providers.ReadStateBytesRequest{ - TypeName: expectedReq.TypeName, - StateId: expectedReq.StateId, - } - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiagsHasError(t, resp.Diagnostics) - wantErr := fmt.Sprintf("Plugin error: The plugin returned an unexpected error from plugin6.(*GRPCProvider).ReadStateBytes: %s", mockError) - if resp.Diagnostics.Err().Error() != wantErr { - t.Fatalf("expected error diagnostic %q, but got: %q", wantErr, resp.Diagnostics.Err()) - } - if len(resp.Bytes) != 0 { - t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) - } - }) - - t.Run("when closing the stream, grpc errors are surfaced via diagnostics", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Call to ReadStateBytes - // > Assert the arguments received - // > Define the returned mock client - mockClient := mockReadStateBytesClient(t) - expectedReq := &proto.ReadStateBytes_Request{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - } - client.EXPECT().ReadStateBytes( - gomock.Any(), - gomock.Eq(expectedReq), - gomock.Any(), - ).Return(mockClient, nil) - - // Sufficient mocking of Recv to get to the call to CloseSend - mockClient.EXPECT().Recv().Return(&proto.ReadStateBytes_Response{}, io.EOF) - - // Force a gRPC error from CloseSend - mockError := errors.New("grpc error forced in test") - mockClient.EXPECT().CloseSend().Return(mockError).Times(1) - - // Act - request := providers.ReadStateBytesRequest{ - TypeName: expectedReq.TypeName, - StateId: expectedReq.StateId, - } - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiagsHasError(t, resp.Diagnostics) - wantErr := fmt.Sprintf("Plugin error: The plugin returned an unexpected error from plugin6.(*GRPCProvider).ReadStateBytes: %s", mockError) - if resp.Diagnostics.Err().Error() != wantErr { - t.Fatalf("expected error diagnostic %q, but got: %q", wantErr, resp.Diagnostics.Err()) - } - if len(resp.Bytes) != 0 { - t.Fatalf("expected data to be omitted in error condition, but got: %q", string(resp.Bytes)) - } - }) - - t.Run("when reading the data, warnings are raised when chunk sizes mismatch", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", 5) - - // Call to ReadStateBytes - // > Assert the arguments received - // > Define the returned mock client - mockReadBytesClient := mockReadStateBytesClient(t) - - expectedReq := &proto.ReadStateBytes_Request{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - } - client.EXPECT().ReadStateBytes( - gomock.Any(), - gomock.Eq(expectedReq), - gomock.Any(), - ).Return(mockReadBytesClient, nil) - - // Define what will be returned by each call to Recv - chunk := "helloworld" - totalLength := len(chunk) - mockResp := map[int]struct { - resp *proto.ReadStateBytes_Response - err error - }{ - 0: { - resp: &proto.ReadStateBytes_Response{ - Bytes: []byte(chunk[:4]), - TotalLength: int64(totalLength), - Range: &proto.StateRange{ - Start: 0, - End: 4, - }, - Diagnostics: []*proto.Diagnostic{}, - }, - err: nil, - }, - 1: { - resp: &proto.ReadStateBytes_Response{ - Bytes: []byte(chunk[4:]), - TotalLength: int64(totalLength), - Range: &proto.StateRange{ - Start: 4, - End: 10, - }, - Diagnostics: []*proto.Diagnostic{}, - }, - err: nil, - }, - 2: { - resp: &proto.ReadStateBytes_Response{}, - err: io.EOF, - }, - } - var count int - mockReadBytesClient.EXPECT().Recv().DoAndReturn(func() (*proto.ReadStateBytes_Response, error) { - ret := mockResp[count] - count++ - return ret.resp, ret.err - }).Times(3) - - // There will be a call to CloseSend to close the stream - mockReadBytesClient.EXPECT().CloseSend().Return(nil).Times(1) - - // Act - request := providers.ReadStateBytesRequest{ - TypeName: expectedReq.TypeName, - StateId: expectedReq.StateId, - } - resp := p.ReadStateBytes(request) - - // Assert returned values - checkDiags(t, resp.Diagnostics) - expectedWarn := `2 warnings: - -- Unexpected size of chunk received: Unexpected chunk of size 4 was received, expected 5; this is a bug in the provider mock_store - please report it there -- Unexpected size of last chunk received: Last chunk exceeded agreed size, expected 5, given 6; this is a bug in the provider mock_store - please report it there` - if resp.Diagnostics.ErrWithWarnings().Error() != expectedWarn { - t.Fatalf("expected warning diagnostic %q, but got: %q", expectedWarn, resp.Diagnostics.ErrWithWarnings().Error()) - } - if len(resp.Bytes) != 10 { - t.Fatalf("expected 10 bytes to be read despite warnings, but got %d", len(resp.Bytes)) - } - }) -} - -func TestGRPCProvider_WriteStateBytes(t *testing.T) { - chunkSize := 4 << 20 // 4MB - - t.Run("data smaller than the chunk size is sent in one write action", func(t *testing.T) { - // Less than 4MB - data := []byte("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod" + - "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud" + - " exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor" + - " in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint" + - " occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.") - - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Assert there will be a call to WriteStateBytes - // & make it return the mock client - mockWriteClient := mockWriteStateBytesClient(t) - client.EXPECT().WriteStateBytes( - gomock.Any(), - gomock.Any(), - ).Return(mockWriteClient, nil) - - // Spy on arguments passed to the Send method of the client - // - // We expect 1 call to Send as the total data - // is less than the chunk size - expectedReq := &proto.WriteStateBytes_RequestChunk{ - Meta: &proto.RequestChunkMeta{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - }, - Bytes: data, - TotalLength: int64(len(data)), - Range: &proto.StateRange{ - Start: 0, - End: int64(len(data)), - }, - } - mockWriteClient.EXPECT().Send(gomock.Eq(expectedReq)).Times(1).Return(nil) - mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(&proto.WriteStateBytes_Response{}, nil) - - // Act - request := providers.WriteStateBytesRequest{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - Bytes: data, - } - resp := p.WriteStateBytes(request) - - // Assert returned values - checkDiags(t, resp.Diagnostics) - }) - - t.Run("data larger than the chunk size is sent in multiple write actions", func(t *testing.T) { - // Make a buffer that can contain 10 bytes more than the 4MB chunk size - chunkSize := 4 * 1_000_000 - dataBuff := bytes.NewBuffer(make([]byte, 0, chunkSize+10)) - dataBuffCopy := bytes.NewBuffer(make([]byte, 0, chunkSize+10)) - for i := 0; i < (chunkSize + 10); i++ { - dataBuff.WriteByte(63) // We're making 4MB + 10 bytes of question marks because why not - dataBuffCopy.WriteByte(63) // Used to make assertions - } - data := dataBuff.Bytes() - dataFirstChunk := dataBuffCopy.Next(chunkSize) // First write will have a full chunk - dataSecondChunk := dataBuffCopy.Next(chunkSize) // This will be the extra 10 bytes - - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Assert there will be a call to WriteStateBytes - // & make it return the mock client - mockWriteClient := mockWriteStateBytesClient(t) - client.EXPECT().WriteStateBytes( - gomock.Any(), - gomock.Any(), - ).Return(mockWriteClient, nil) - - // Spy on arguments passed to the Send method because data - // is written via separate chunks and separate calls to Send. - // - // We expect 2 calls to Send as the total data - // is 10 bytes larger than the chunk size - req1 := &proto.WriteStateBytes_RequestChunk{ - Meta: &proto.RequestChunkMeta{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - }, - Bytes: dataFirstChunk, - TotalLength: int64(len(data)), - Range: &proto.StateRange{ - Start: 0, - End: int64(chunkSize), - }, - } - req2 := &proto.WriteStateBytes_RequestChunk{ - Meta: nil, - Bytes: dataSecondChunk, - TotalLength: int64(len(data)), - Range: &proto.StateRange{ - Start: int64(chunkSize), - End: int64(chunkSize + 10), - }, - } - mockWriteClient.EXPECT().Send(gomock.AnyOf(req1, req2)).Times(2).Return(nil) - mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(&proto.WriteStateBytes_Response{}, nil) - - // Act - request := providers.WriteStateBytesRequest{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - Bytes: data, - } - resp := p.WriteStateBytes(request) - - // Assert returned values - checkDiags(t, resp.Diagnostics) - }) - - t.Run("when writing data, grpc errors are surfaced via diagnostics", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Assert there will be a call to WriteStateBytes - // & make it return the mock client - mockWriteClient := mockWriteStateBytesClient(t) - client.EXPECT().WriteStateBytes( - gomock.Any(), - gomock.Any(), - ).Return(mockWriteClient, nil) - - mockError := errors.New("grpc error forced in test") - mockWriteClient.EXPECT().Send(gomock.Any()).Return(mockError) - - // Act - request := providers.WriteStateBytesRequest{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - Bytes: []byte("helloworld"), - } - resp := p.WriteStateBytes(request) - - // Assert returned values - checkDiagsHasError(t, resp.Diagnostics) - wantErr := fmt.Sprintf("Plugin error: The plugin returned an unexpected error from plugin6.(*GRPCProvider).WriteStateBytes: %s", mockError) - if resp.Diagnostics.Err().Error() != wantErr { - t.Fatalf("unexpected error, wanted %q, got: %s", wantErr, resp.Diagnostics.Err()) - } - }) - - t.Run("error diagnostics from the provider when closing the connection are returned", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Assert there will be a call to WriteStateBytes - // & make it return the mock client - mockWriteClient := mockWriteStateBytesClient(t) - client.EXPECT().WriteStateBytes( - gomock.Any(), - gomock.Any(), - ).Return(mockWriteClient, nil) - - data := []byte("helloworld") - mockReq := &proto.WriteStateBytes_RequestChunk{ - Meta: &proto.RequestChunkMeta{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - }, - Bytes: data, - TotalLength: int64(len(data)), - Range: &proto.StateRange{ - Start: 0, - End: int64(len(data)), - }, - } - mockResp := &proto.WriteStateBytes_Response{ - Diagnostics: []*proto.Diagnostic{ - { - Severity: proto.Diagnostic_ERROR, - Summary: "Error from test mock", - Detail: "This error is returned from the test mock", - }, - }, - } - mockWriteClient.EXPECT().Send(gomock.Eq(mockReq)).Times(1).Return(nil) - mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(mockResp, nil) - - // Act - request := providers.WriteStateBytesRequest{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - Bytes: data, - } - resp := p.WriteStateBytes(request) - - // Assert returned values - checkDiagsHasError(t, resp.Diagnostics) - if resp.Diagnostics.Err().Error() != "Error from test mock: This error is returned from the test mock" { - t.Fatal() - } - }) - - t.Run("warning diagnostics from the provider when closing the connection are returned", func(t *testing.T) { - client := mockProviderClient(t) - p := &GRPCProvider{ - client: client, - ctx: context.Background(), - } - p.SetStateStoreChunkSize("mock_store", chunkSize) - - // Assert there will be a call to WriteStateBytes - // & make it return the mock client - mockWriteClient := mockWriteStateBytesClient(t) - client.EXPECT().WriteStateBytes( - gomock.Any(), - gomock.Any(), - ).Return(mockWriteClient, nil) - - data := []byte("helloworld") - mockReq := &proto.WriteStateBytes_RequestChunk{ - Meta: &proto.RequestChunkMeta{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - }, - Bytes: data, - TotalLength: int64(len(data)), - Range: &proto.StateRange{ - Start: 0, - End: int64(len(data)), - }, - } - mockResp := &proto.WriteStateBytes_Response{ - Diagnostics: []*proto.Diagnostic{ - { - Severity: proto.Diagnostic_WARNING, - Summary: "Warning from test mock", - Detail: "This warning is returned from the test mock", - }, - }, - } - mockWriteClient.EXPECT().Send(gomock.Eq(mockReq)).Times(1).Return(nil) - mockWriteClient.EXPECT().CloseAndRecv().Times(1).Return(mockResp, nil) - - // Act - request := providers.WriteStateBytesRequest{ - TypeName: "mock_store", - StateId: backend.DefaultStateName, - Bytes: data, - } - resp := p.WriteStateBytes(request) - - // Assert returned values - checkDiags(t, resp.Diagnostics) - if resp.Diagnostics.ErrWithWarnings().Error() != "Warning from test mock: This warning is returned from the test mock" { - t.Fatal() - } - }) -} diff --git a/internal/plugin6/mock_proto/generate.go b/internal/plugin6/mock_proto/generate.go index 4d7f823b94ae..36cc550081ce 100644 --- a/internal/plugin6/mock_proto/generate.go +++ b/internal/plugin6/mock_proto/generate.go @@ -1,6 +1,6 @@ // Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 -//go:generate go tool go.uber.org/mock/mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient,Provider_ReadStateBytesClient,Provider_WriteStateBytesClient +//go:generate go tool go.uber.org/mock/mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient package mock_tfplugin6 diff --git a/internal/plugin6/mock_proto/mock.go b/internal/plugin6/mock_proto/mock.go index 8853386f341c..9e922a0fce74 100644 --- a/internal/plugin6/mock_proto/mock.go +++ b/internal/plugin6/mock_proto/mock.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/hashicorp/terraform/internal/tfplugin6 (interfaces: ProviderClient,Provider_InvokeActionClient,Provider_ReadStateBytesClient,Provider_WriteStateBytesClient) +// Source: github.com/hashicorp/terraform/internal/tfplugin6 (interfaces: ProviderClient,Provider_InvokeActionClient) // // Generated by this command: // -// mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient,Provider_ReadStateBytesClient,Provider_WriteStateBytesClient +// mockgen -destination mock.go github.com/hashicorp/terraform/internal/tfplugin6 ProviderClient,Provider_InvokeActionClient // // Package mock_tfplugin6 is a generated GoMock package. @@ -463,26 +463,6 @@ func (mr *MockProviderClientMockRecorder) ReadResource(ctx, in any, opts ...any) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadResource", reflect.TypeOf((*MockProviderClient)(nil).ReadResource), varargs...) } -// ReadStateBytes mocks base method. -func (m *MockProviderClient) ReadStateBytes(ctx context.Context, in *tfplugin6.ReadStateBytes_Request, opts ...grpc.CallOption) (tfplugin6.Provider_ReadStateBytesClient, error) { - m.ctrl.T.Helper() - varargs := []any{ctx, in} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "ReadStateBytes", varargs...) - ret0, _ := ret[0].(tfplugin6.Provider_ReadStateBytesClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ReadStateBytes indicates an expected call of ReadStateBytes. -func (mr *MockProviderClientMockRecorder) ReadStateBytes(ctx, in any, opts ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{ctx, in}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadStateBytes", reflect.TypeOf((*MockProviderClient)(nil).ReadStateBytes), varargs...) -} - // RenewEphemeralResource mocks base method. func (m *MockProviderClient) RenewEphemeralResource(ctx context.Context, in *tfplugin6.RenewEphemeralResource_Request, opts ...grpc.CallOption) (*tfplugin6.RenewEphemeralResource_Response, error) { m.ctrl.T.Helper() @@ -703,26 +683,6 @@ func (mr *MockProviderClientMockRecorder) ValidateStateStoreConfig(ctx, in any, return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ValidateStateStoreConfig", reflect.TypeOf((*MockProviderClient)(nil).ValidateStateStoreConfig), varargs...) } -// WriteStateBytes mocks base method. -func (m *MockProviderClient) WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (tfplugin6.Provider_WriteStateBytesClient, error) { - m.ctrl.T.Helper() - varargs := []any{ctx} - for _, a := range opts { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "WriteStateBytes", varargs...) - ret0, _ := ret[0].(tfplugin6.Provider_WriteStateBytesClient) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// WriteStateBytes indicates an expected call of WriteStateBytes. -func (mr *MockProviderClientMockRecorder) WriteStateBytes(ctx any, opts ...any) *gomock.Call { - mr.mock.ctrl.T.Helper() - varargs := append([]any{ctx}, opts...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteStateBytes", reflect.TypeOf((*MockProviderClient)(nil).WriteStateBytes), varargs...) -} - // MockProvider_InvokeActionClient is a mock of Provider_InvokeActionClient interface. type MockProvider_InvokeActionClient struct { ctrl *gomock.Controller @@ -846,265 +806,3 @@ func (mr *MockProvider_InvokeActionClientMockRecorder) Trailer() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockProvider_InvokeActionClient)(nil).Trailer)) } - -// MockProvider_ReadStateBytesClient is a mock of Provider_ReadStateBytesClient interface. -type MockProvider_ReadStateBytesClient struct { - ctrl *gomock.Controller - recorder *MockProvider_ReadStateBytesClientMockRecorder - isgomock struct{} -} - -// MockProvider_ReadStateBytesClientMockRecorder is the mock recorder for MockProvider_ReadStateBytesClient. -type MockProvider_ReadStateBytesClientMockRecorder struct { - mock *MockProvider_ReadStateBytesClient -} - -// NewMockProvider_ReadStateBytesClient creates a new mock instance. -func NewMockProvider_ReadStateBytesClient(ctrl *gomock.Controller) *MockProvider_ReadStateBytesClient { - mock := &MockProvider_ReadStateBytesClient{ctrl: ctrl} - mock.recorder = &MockProvider_ReadStateBytesClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockProvider_ReadStateBytesClient) EXPECT() *MockProvider_ReadStateBytesClientMockRecorder { - return m.recorder -} - -// CloseSend mocks base method. -func (m *MockProvider_ReadStateBytesClient) CloseSend() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CloseSend") - ret0, _ := ret[0].(error) - return ret0 -} - -// CloseSend indicates an expected call of CloseSend. -func (mr *MockProvider_ReadStateBytesClientMockRecorder) CloseSend() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).CloseSend)) -} - -// Context mocks base method. -func (m *MockProvider_ReadStateBytesClient) Context() context.Context { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Context") - ret0, _ := ret[0].(context.Context) - return ret0 -} - -// Context indicates an expected call of Context. -func (mr *MockProvider_ReadStateBytesClientMockRecorder) Context() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Context)) -} - -// Header mocks base method. -func (m *MockProvider_ReadStateBytesClient) Header() (metadata.MD, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Header") - ret0, _ := ret[0].(metadata.MD) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Header indicates an expected call of Header. -func (mr *MockProvider_ReadStateBytesClientMockRecorder) Header() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Header)) -} - -// Recv mocks base method. -func (m *MockProvider_ReadStateBytesClient) Recv() (*tfplugin6.ReadStateBytes_Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv") - ret0, _ := ret[0].(*tfplugin6.ReadStateBytes_Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Recv indicates an expected call of Recv. -func (mr *MockProvider_ReadStateBytesClientMockRecorder) Recv() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Recv)) -} - -// RecvMsg mocks base method. -func (m_2 *MockProvider_ReadStateBytesClient) RecvMsg(m any) error { - m_2.ctrl.T.Helper() - ret := m_2.ctrl.Call(m_2, "RecvMsg", m) - ret0, _ := ret[0].(error) - return ret0 -} - -// RecvMsg indicates an expected call of RecvMsg. -func (mr *MockProvider_ReadStateBytesClientMockRecorder) RecvMsg(m any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).RecvMsg), m) -} - -// SendMsg mocks base method. -func (m_2 *MockProvider_ReadStateBytesClient) SendMsg(m any) error { - m_2.ctrl.T.Helper() - ret := m_2.ctrl.Call(m_2, "SendMsg", m) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendMsg indicates an expected call of SendMsg. -func (mr *MockProvider_ReadStateBytesClientMockRecorder) SendMsg(m any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).SendMsg), m) -} - -// Trailer mocks base method. -func (m *MockProvider_ReadStateBytesClient) Trailer() metadata.MD { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Trailer") - ret0, _ := ret[0].(metadata.MD) - return ret0 -} - -// Trailer indicates an expected call of Trailer. -func (mr *MockProvider_ReadStateBytesClientMockRecorder) Trailer() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockProvider_ReadStateBytesClient)(nil).Trailer)) -} - -// MockProvider_WriteStateBytesClient is a mock of Provider_WriteStateBytesClient interface. -type MockProvider_WriteStateBytesClient struct { - ctrl *gomock.Controller - recorder *MockProvider_WriteStateBytesClientMockRecorder - isgomock struct{} -} - -// MockProvider_WriteStateBytesClientMockRecorder is the mock recorder for MockProvider_WriteStateBytesClient. -type MockProvider_WriteStateBytesClientMockRecorder struct { - mock *MockProvider_WriteStateBytesClient -} - -// NewMockProvider_WriteStateBytesClient creates a new mock instance. -func NewMockProvider_WriteStateBytesClient(ctrl *gomock.Controller) *MockProvider_WriteStateBytesClient { - mock := &MockProvider_WriteStateBytesClient{ctrl: ctrl} - mock.recorder = &MockProvider_WriteStateBytesClientMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockProvider_WriteStateBytesClient) EXPECT() *MockProvider_WriteStateBytesClientMockRecorder { - return m.recorder -} - -// CloseAndRecv mocks base method. -func (m *MockProvider_WriteStateBytesClient) CloseAndRecv() (*tfplugin6.WriteStateBytes_Response, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CloseAndRecv") - ret0, _ := ret[0].(*tfplugin6.WriteStateBytes_Response) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CloseAndRecv indicates an expected call of CloseAndRecv. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) CloseAndRecv() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseAndRecv", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).CloseAndRecv)) -} - -// CloseSend mocks base method. -func (m *MockProvider_WriteStateBytesClient) CloseSend() error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CloseSend") - ret0, _ := ret[0].(error) - return ret0 -} - -// CloseSend indicates an expected call of CloseSend. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) CloseSend() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).CloseSend)) -} - -// Context mocks base method. -func (m *MockProvider_WriteStateBytesClient) Context() context.Context { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Context") - ret0, _ := ret[0].(context.Context) - return ret0 -} - -// Context indicates an expected call of Context. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) Context() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Context)) -} - -// Header mocks base method. -func (m *MockProvider_WriteStateBytesClient) Header() (metadata.MD, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Header") - ret0, _ := ret[0].(metadata.MD) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Header indicates an expected call of Header. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) Header() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Header)) -} - -// RecvMsg mocks base method. -func (m_2 *MockProvider_WriteStateBytesClient) RecvMsg(m any) error { - m_2.ctrl.T.Helper() - ret := m_2.ctrl.Call(m_2, "RecvMsg", m) - ret0, _ := ret[0].(error) - return ret0 -} - -// RecvMsg indicates an expected call of RecvMsg. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) RecvMsg(m any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).RecvMsg), m) -} - -// Send mocks base method. -func (m *MockProvider_WriteStateBytesClient) Send(arg0 *tfplugin6.WriteStateBytes_RequestChunk) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Send", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// Send indicates an expected call of Send. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) Send(arg0 any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Send), arg0) -} - -// SendMsg mocks base method. -func (m_2 *MockProvider_WriteStateBytesClient) SendMsg(m any) error { - m_2.ctrl.T.Helper() - ret := m_2.ctrl.Call(m_2, "SendMsg", m) - ret0, _ := ret[0].(error) - return ret0 -} - -// SendMsg indicates an expected call of SendMsg. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) SendMsg(m any) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).SendMsg), m) -} - -// Trailer mocks base method. -func (m *MockProvider_WriteStateBytesClient) Trailer() metadata.MD { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Trailer") - ret0, _ := ret[0].(metadata.MD) - return ret0 -} - -// Trailer indicates an expected call of Trailer. -func (mr *MockProvider_WriteStateBytesClientMockRecorder) Trailer() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockProvider_WriteStateBytesClient)(nil).Trailer)) -} diff --git a/internal/provider-simple-v6/provider.go b/internal/provider-simple-v6/provider.go index 73085cba1930..45462d08bb39 100644 --- a/internal/provider-simple-v6/provider.go +++ b/internal/provider-simple-v6/provider.go @@ -49,9 +49,7 @@ func Provider() providers.Interface { return simple{ schema: providers.GetProviderSchemaResponse{ Provider: providers.Schema{ - Body: &configschema.Block{ - Description: "This is terraform-provider-simple v6", - }, + Body: nil, }, ResourceTypes: map[string]providers.Schema{ "simple_resource": simpleResource, @@ -317,14 +315,6 @@ func (s simple) ConfigureStateStore(req providers.ConfigureStateStoreRequest) pr panic("not implemented") } -func (s simple) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - panic("not implemented") -} - -func (s simple) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - panic("not implemented") -} - func (s simple) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { panic("not implemented") } diff --git a/internal/provider-simple/provider.go b/internal/provider-simple/provider.go index 55093510b55a..1da26521350d 100644 --- a/internal/provider-simple/provider.go +++ b/internal/provider-simple/provider.go @@ -47,9 +47,7 @@ func Provider() providers.Interface { return simple{ schema: providers.GetProviderSchemaResponse{ Provider: providers.Schema{ - Body: &configschema.Block{ - Description: "This is terraform-provider-simple v5", - }, + Body: nil, }, ResourceTypes: map[string]providers.Schema{ "simple_resource": simpleResource, @@ -277,14 +275,6 @@ func (s simple) ConfigureStateStore(req providers.ConfigureStateStoreRequest) pr panic("not implemented") } -func (s simple) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - panic("not implemented") -} - -func (s simple) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - panic("not implemented") -} - func (s simple) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { // provider-simple uses protocol version 5, which does not include the RPC that maps to this method panic("not implemented") diff --git a/internal/providers/mock.go b/internal/providers/mock.go index 1cee9de06f00..a5e4005b6c12 100644 --- a/internal/providers/mock.go +++ b/internal/providers/mock.go @@ -436,14 +436,6 @@ func (m *Mock) ConfigureStateStore(req ConfigureStateStoreRequest) ConfigureStat return m.Provider.ConfigureStateStore(req) } -func (m *Mock) ReadStateBytes(req ReadStateBytesRequest) ReadStateBytesResponse { - return m.Provider.ReadStateBytes(req) -} - -func (m *Mock) WriteStateBytes(req WriteStateBytesRequest) WriteStateBytesResponse { - return m.Provider.WriteStateBytes(req) -} - func (m *Mock) GetStates(req GetStatesRequest) GetStatesResponse { return m.Provider.GetStates(req) } diff --git a/internal/providers/provider.go b/internal/providers/provider.go index 83036bfd3b07..579626c3699f 100644 --- a/internal/providers/provider.go +++ b/internal/providers/provider.go @@ -123,11 +123,6 @@ type Interface interface { // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider ConfigureStateStore(ConfigureStateStoreRequest) ConfigureStateStoreResponse - // ReadStateBytes streams byte chunks of a given state file from a state store - ReadStateBytes(ReadStateBytesRequest) ReadStateBytesResponse - // WriteStateBytes streams byte chunks of a given state file into a state store - WriteStateBytes(WriteStateBytesRequest) WriteStateBytesResponse - // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store GetStates(GetStatesRequest) GetStatesResponse // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) @@ -146,10 +141,6 @@ type Interface interface { Close() error } -type StateStoreChunkSizeSetter interface { - SetStateStoreChunkSize(typeName string, size int) -} - // GetProviderSchemaResponse is the return type for GetProviderSchema, and // should only be used when handling a value for that method. The handling of // of schemas in any other context should always use ProviderSchema, so that @@ -856,51 +847,11 @@ type ConfigureStateStoreRequest struct { // Config is the configuration value to configure the store with. Config cty.Value - - Capabilities StateStoreClientCapabilities -} - -type StateStoreClientCapabilities struct { - ChunkSize int64 } type ConfigureStateStoreResponse struct { // Diagnostics contains any warnings or errors from the method call. Diagnostics tfdiags.Diagnostics - - Capabilities StateStoreServerCapabilities -} - -type StateStoreServerCapabilities struct { - ChunkSize int64 -} - -type ReadStateBytesRequest struct { - // TypeName is the name of the state store to read state from - TypeName string - // StateId is the ID of a state file to read - StateId string -} - -type ReadStateBytesResponse struct { - // Bytes represents all received bytes of the given state file - Bytes []byte - // Diagnostics contains any warnings or errors from the method call. - Diagnostics tfdiags.Diagnostics -} - -type WriteStateBytesRequest struct { - // TypeName is the name of the state store to write state to - TypeName string - // Bytes represents all bytes of the given state file to write - Bytes []byte - // StateId is the ID of a state file to write - StateId string -} - -type WriteStateBytesResponse struct { - // Diagnostics contains any warnings or errors from the method call. - Diagnostics tfdiags.Diagnostics } type GetStatesRequest struct { diff --git a/internal/providers/testing/provider_mock.go b/internal/providers/testing/provider_mock.go index 9b38da2ba83b..82e4dd5db08e 100644 --- a/internal/providers/testing/provider_mock.go +++ b/internal/providers/testing/provider_mock.go @@ -146,16 +146,6 @@ type MockProvider struct { ConfigureStateStoreRequest providers.ConfigureStateStoreRequest ConfigureStateStoreFn func(providers.ConfigureStateStoreRequest) providers.ConfigureStateStoreResponse - ReadStateBytesCalled bool - ReadStateBytesRequest providers.ReadStateBytesRequest - ReadStateBytesFn func(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse - ReadStateBytesResponse providers.ReadStateBytesResponse - - WriteStateBytesCalled bool - WriteStateBytesRequest providers.WriteStateBytesRequest - WriteStateBytesFn func(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse - WriteStateBytesResponse providers.WriteStateBytesResponse - GetStatesCalled bool GetStatesResponse *providers.GetStatesResponse GetStatesRequest providers.GetStatesRequest @@ -314,32 +304,6 @@ func (p *MockProvider) ValidateDataResourceConfig(r providers.ValidateDataResour return resp } -func (p *MockProvider) ReadStateBytes(r providers.ReadStateBytesRequest) (resp providers.ReadStateBytesResponse) { - p.Lock() - defer p.Unlock() - p.ReadStateBytesCalled = true - p.ReadStateBytesRequest = r - - if p.ReadStateBytesFn != nil { - return p.ReadStateBytesFn(r) - } - - return p.ReadStateBytesResponse -} - -func (p *MockProvider) WriteStateBytes(r providers.WriteStateBytesRequest) (resp providers.WriteStateBytesResponse) { - p.Lock() - defer p.Unlock() - p.WriteStateBytesCalled = true - p.WriteStateBytesRequest = r - - if p.WriteStateBytesFn != nil { - return p.WriteStateBytesFn(r) - } - - return p.WriteStateBytesResponse -} - func (p *MockProvider) ValidateEphemeralResourceConfig(r providers.ValidateEphemeralResourceConfigRequest) (resp providers.ValidateEphemeralResourceConfigResponse) { defer p.beginWrite()() diff --git a/internal/refactoring/mock_provider.go b/internal/refactoring/mock_provider.go index 67babcf1904f..15f332b0e8e3 100644 --- a/internal/refactoring/mock_provider.go +++ b/internal/refactoring/mock_provider.go @@ -134,14 +134,6 @@ func (provider *mockProvider) ConfigureStateStore(req providers.ConfigureStateSt panic("not implemented in mock") } -func (provider *mockProvider) ReadStateBytes(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - panic("not implemented in mock") -} - -func (provider *mockProvider) WriteStateBytes(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - panic("not implemented in mock") -} - func (provider *mockProvider) GetStates(req providers.GetStatesRequest) providers.GetStatesResponse { panic("not implemented in mock") } diff --git a/internal/rpcapi/dynrpcserver/generator/main.go b/internal/rpcapi/dynrpcserver/generator/main.go index cd010016295c..9f1631a52e6b 100644 --- a/internal/rpcapi/dynrpcserver/generator/main.go +++ b/internal/rpcapi/dynrpcserver/generator/main.go @@ -94,16 +94,6 @@ func main() { filename := toFilenameCase(baseName) + ".go" absFilename := filepath.Join(outDir, filename) - if regexp.MustCompile("^Unsafe").MatchString(ifaceName) { - // This isn't a gRPC server interface, so skip it. - // - // This is an interface that's intended to be embedded to help users to meet requirements for Unimplemented servers. - // See: - // > Docs: https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc#readme-future-proofing-services - // > PR for Unsafe interfaces: https://github.com/grpc/grpc-go/pull/3911 - continue Types - } - var buf bytes.Buffer fmt.Fprintf(&buf, `// Copyright (c) HashiCorp, Inc. diff --git a/internal/rpcapi/terraform1/dependencies/dependencies.pb.go b/internal/rpcapi/terraform1/dependencies/dependencies.pb.go index 4c4a987e445a..8a7ee854d47f 100644 --- a/internal/rpcapi/terraform1/dependencies/dependencies.pb.go +++ b/internal/rpcapi/terraform1/dependencies/dependencies.pb.go @@ -10,7 +10,11 @@ package dependencies import ( + context "context" terraform1 "github.com/hashicorp/terraform/internal/rpcapi/terraform1" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -3229,3 +3233,601 @@ func file_dependencies_proto_init() { file_dependencies_proto_goTypes = nil file_dependencies_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// DependenciesClient is the client API for Dependencies service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type DependenciesClient interface { + // Opens a source bundle that was already extracted into the filesystem + // somewhere, returning an opaque source bundle handle that can be used for + // subsequent operations. + OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) + // Closes a previously-opened source bundle, invalidating the given handle + // and therefore making it safe to delete or modify the bundle directory + // on disk. + CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) + // Reads and parses an existing dependency lock file from the filesystem, + // returning a dependency locks handle. + // + // This function parses a user-provided source file, and so invalid content + // in that file is treated as diagnostics in a successful response rather + // than as an RPC error. Callers must check whether the dependency locks + // handle in the response is set (non-zero) before using it, and treat + // an unset handle as indicating a user error which is described in the + // accompanying diagnostics. Diagnostics can also be returned along with + // a valid handle, e.g. if there are non-blocking warning diagnostics. + OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) + // Creates an in-memory-only dependency locks handle with a fixed set of + // dependency selections provided as arguments. + CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) + CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) + // Returns information about the provider version selections in a + // dependency locks object. + GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) + // Populates a new provider plugin cache directory in the local filesystem + // based on the provider version selections in a given dependency locks + // object. + // + // This particular RPC can only install already-selected provider packages + // recorded in a dependency locks object; it does not support "upgrading" + // provider selections to newer versions as a CLI user would do with + // "terraform init -upgrade", because there would be no way to then + // commit the updated locks to disk as a lock file. + BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) + // Opens an existing local filesystem directory as a provider plugin cache + // directory, returning a plugin cache handle that can be used with other + // RPC operations. + OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) + CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) + // Returns information about the specific provider packages that are + // available in the given provider plugin cache. + GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) + // Returns information about the built-in providers that are compiled in + // to this Terraform Core server. + GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) + // Returns a description of the schema for a particular provider in a + // given provider plugin cache, or of a particular built-in provider + // known to this version of Terraform Core. + // + // WARNING: This operation requires executing the selected provider plugin, + // which therefore allows it to run arbitrary code as a child process of + // this Terraform Core server, with access to all of the same resources. + // This should typically be used only with providers explicitly selected + // in a dependency lock file, so users can control what external code + // has the potential to run in a context that probably has access to + // private source code and other sensitive information. + GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) +} + +type dependenciesClient struct { + cc grpc.ClientConnInterface +} + +func NewDependenciesClient(cc grpc.ClientConnInterface) DependenciesClient { + return &dependenciesClient{cc} +} + +func (c *dependenciesClient) OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) { + out := new(OpenSourceBundle_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/OpenSourceBundle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) { + out := new(CloseSourceBundle_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CloseSourceBundle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) { + out := new(OpenDependencyLockFile_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/OpenDependencyLockFile", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) { + out := new(CreateDependencyLocks_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CreateDependencyLocks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) { + out := new(CloseDependencyLocks_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CloseDependencyLocks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) { + out := new(GetLockedProviderDependencies_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetLockedProviderDependencies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) { + stream, err := c.cc.NewStream(ctx, &_Dependencies_serviceDesc.Streams[0], "/terraform1.dependencies.Dependencies/BuildProviderPluginCache", opts...) + if err != nil { + return nil, err + } + x := &dependenciesBuildProviderPluginCacheClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Dependencies_BuildProviderPluginCacheClient interface { + Recv() (*BuildProviderPluginCache_Event, error) + grpc.ClientStream +} + +type dependenciesBuildProviderPluginCacheClient struct { + grpc.ClientStream +} + +func (x *dependenciesBuildProviderPluginCacheClient) Recv() (*BuildProviderPluginCache_Event, error) { + m := new(BuildProviderPluginCache_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *dependenciesClient) OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) { + out := new(OpenProviderPluginCache_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/OpenProviderPluginCache", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) { + out := new(CloseProviderPluginCache_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/CloseProviderPluginCache", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) { + out := new(GetCachedProviders_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetCachedProviders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) { + out := new(GetBuiltInProviders_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetBuiltInProviders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependenciesClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { + out := new(GetProviderSchema_Response) + err := c.cc.Invoke(ctx, "/terraform1.dependencies.Dependencies/GetProviderSchema", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DependenciesServer is the server API for Dependencies service. +type DependenciesServer interface { + // Opens a source bundle that was already extracted into the filesystem + // somewhere, returning an opaque source bundle handle that can be used for + // subsequent operations. + OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) + // Closes a previously-opened source bundle, invalidating the given handle + // and therefore making it safe to delete or modify the bundle directory + // on disk. + CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) + // Reads and parses an existing dependency lock file from the filesystem, + // returning a dependency locks handle. + // + // This function parses a user-provided source file, and so invalid content + // in that file is treated as diagnostics in a successful response rather + // than as an RPC error. Callers must check whether the dependency locks + // handle in the response is set (non-zero) before using it, and treat + // an unset handle as indicating a user error which is described in the + // accompanying diagnostics. Diagnostics can also be returned along with + // a valid handle, e.g. if there are non-blocking warning diagnostics. + OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) + // Creates an in-memory-only dependency locks handle with a fixed set of + // dependency selections provided as arguments. + CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) + CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) + // Returns information about the provider version selections in a + // dependency locks object. + GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) + // Populates a new provider plugin cache directory in the local filesystem + // based on the provider version selections in a given dependency locks + // object. + // + // This particular RPC can only install already-selected provider packages + // recorded in a dependency locks object; it does not support "upgrading" + // provider selections to newer versions as a CLI user would do with + // "terraform init -upgrade", because there would be no way to then + // commit the updated locks to disk as a lock file. + BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error + // Opens an existing local filesystem directory as a provider plugin cache + // directory, returning a plugin cache handle that can be used with other + // RPC operations. + OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) + CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) + // Returns information about the specific provider packages that are + // available in the given provider plugin cache. + GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) + // Returns information about the built-in providers that are compiled in + // to this Terraform Core server. + GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) + // Returns a description of the schema for a particular provider in a + // given provider plugin cache, or of a particular built-in provider + // known to this version of Terraform Core. + // + // WARNING: This operation requires executing the selected provider plugin, + // which therefore allows it to run arbitrary code as a child process of + // this Terraform Core server, with access to all of the same resources. + // This should typically be used only with providers explicitly selected + // in a dependency lock file, so users can control what external code + // has the potential to run in a context that probably has access to + // private source code and other sensitive information. + GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) +} + +// UnimplementedDependenciesServer can be embedded to have forward compatible implementations. +type UnimplementedDependenciesServer struct { +} + +func (*UnimplementedDependenciesServer) OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenSourceBundle not implemented") +} +func (*UnimplementedDependenciesServer) CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseSourceBundle not implemented") +} +func (*UnimplementedDependenciesServer) OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenDependencyLockFile not implemented") +} +func (*UnimplementedDependenciesServer) CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDependencyLocks not implemented") +} +func (*UnimplementedDependenciesServer) CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseDependencyLocks not implemented") +} +func (*UnimplementedDependenciesServer) GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLockedProviderDependencies not implemented") +} +func (*UnimplementedDependenciesServer) BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error { + return status.Errorf(codes.Unimplemented, "method BuildProviderPluginCache not implemented") +} +func (*UnimplementedDependenciesServer) OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenProviderPluginCache not implemented") +} +func (*UnimplementedDependenciesServer) CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseProviderPluginCache not implemented") +} +func (*UnimplementedDependenciesServer) GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCachedProviders not implemented") +} +func (*UnimplementedDependenciesServer) GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBuiltInProviders not implemented") +} +func (*UnimplementedDependenciesServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") +} + +func RegisterDependenciesServer(s *grpc.Server, srv DependenciesServer) { + s.RegisterService(&_Dependencies_serviceDesc, srv) +} + +func _Dependencies_OpenSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenSourceBundle_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).OpenSourceBundle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/OpenSourceBundle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).OpenSourceBundle(ctx, req.(*OpenSourceBundle_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CloseSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseSourceBundle_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CloseSourceBundle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/CloseSourceBundle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CloseSourceBundle(ctx, req.(*CloseSourceBundle_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_OpenDependencyLockFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenDependencyLockFile_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).OpenDependencyLockFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/OpenDependencyLockFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).OpenDependencyLockFile(ctx, req.(*OpenDependencyLockFile_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CreateDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateDependencyLocks_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CreateDependencyLocks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/CreateDependencyLocks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CreateDependencyLocks(ctx, req.(*CreateDependencyLocks_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CloseDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseDependencyLocks_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CloseDependencyLocks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/CloseDependencyLocks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CloseDependencyLocks(ctx, req.(*CloseDependencyLocks_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetLockedProviderDependencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetLockedProviderDependencies_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/GetLockedProviderDependencies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, req.(*GetLockedProviderDependencies_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_BuildProviderPluginCache_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(BuildProviderPluginCache_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DependenciesServer).BuildProviderPluginCache(m, &dependenciesBuildProviderPluginCacheServer{stream}) +} + +type Dependencies_BuildProviderPluginCacheServer interface { + Send(*BuildProviderPluginCache_Event) error + grpc.ServerStream +} + +type dependenciesBuildProviderPluginCacheServer struct { + grpc.ServerStream +} + +func (x *dependenciesBuildProviderPluginCacheServer) Send(m *BuildProviderPluginCache_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Dependencies_OpenProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenProviderPluginCache_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).OpenProviderPluginCache(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/OpenProviderPluginCache", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).OpenProviderPluginCache(ctx, req.(*OpenProviderPluginCache_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_CloseProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseProviderPluginCache_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).CloseProviderPluginCache(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/CloseProviderPluginCache", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).CloseProviderPluginCache(ctx, req.(*CloseProviderPluginCache_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetCachedProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCachedProviders_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetCachedProviders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/GetCachedProviders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetCachedProviders(ctx, req.(*GetCachedProviders_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetBuiltInProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBuiltInProviders_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetBuiltInProviders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/GetBuiltInProviders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetBuiltInProviders(ctx, req.(*GetBuiltInProviders_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Dependencies_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependenciesServer).GetProviderSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.dependencies.Dependencies/GetProviderSchema", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependenciesServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Dependencies_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.dependencies.Dependencies", + HandlerType: (*DependenciesServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "OpenSourceBundle", + Handler: _Dependencies_OpenSourceBundle_Handler, + }, + { + MethodName: "CloseSourceBundle", + Handler: _Dependencies_CloseSourceBundle_Handler, + }, + { + MethodName: "OpenDependencyLockFile", + Handler: _Dependencies_OpenDependencyLockFile_Handler, + }, + { + MethodName: "CreateDependencyLocks", + Handler: _Dependencies_CreateDependencyLocks_Handler, + }, + { + MethodName: "CloseDependencyLocks", + Handler: _Dependencies_CloseDependencyLocks_Handler, + }, + { + MethodName: "GetLockedProviderDependencies", + Handler: _Dependencies_GetLockedProviderDependencies_Handler, + }, + { + MethodName: "OpenProviderPluginCache", + Handler: _Dependencies_OpenProviderPluginCache_Handler, + }, + { + MethodName: "CloseProviderPluginCache", + Handler: _Dependencies_CloseProviderPluginCache_Handler, + }, + { + MethodName: "GetCachedProviders", + Handler: _Dependencies_GetCachedProviders_Handler, + }, + { + MethodName: "GetBuiltInProviders", + Handler: _Dependencies_GetBuiltInProviders_Handler, + }, + { + MethodName: "GetProviderSchema", + Handler: _Dependencies_GetProviderSchema_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "BuildProviderPluginCache", + Handler: _Dependencies_BuildProviderPluginCache_Handler, + ServerStreams: true, + }, + }, + Metadata: "dependencies.proto", +} diff --git a/internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go b/internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go deleted file mode 100644 index 66969f990301..000000000000 --- a/internal/rpcapi/terraform1/dependencies/dependencies_grpc.pb.go +++ /dev/null @@ -1,639 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: dependencies.proto - -package dependencies - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Dependencies_OpenSourceBundle_FullMethodName = "/terraform1.dependencies.Dependencies/OpenSourceBundle" - Dependencies_CloseSourceBundle_FullMethodName = "/terraform1.dependencies.Dependencies/CloseSourceBundle" - Dependencies_OpenDependencyLockFile_FullMethodName = "/terraform1.dependencies.Dependencies/OpenDependencyLockFile" - Dependencies_CreateDependencyLocks_FullMethodName = "/terraform1.dependencies.Dependencies/CreateDependencyLocks" - Dependencies_CloseDependencyLocks_FullMethodName = "/terraform1.dependencies.Dependencies/CloseDependencyLocks" - Dependencies_GetLockedProviderDependencies_FullMethodName = "/terraform1.dependencies.Dependencies/GetLockedProviderDependencies" - Dependencies_BuildProviderPluginCache_FullMethodName = "/terraform1.dependencies.Dependencies/BuildProviderPluginCache" - Dependencies_OpenProviderPluginCache_FullMethodName = "/terraform1.dependencies.Dependencies/OpenProviderPluginCache" - Dependencies_CloseProviderPluginCache_FullMethodName = "/terraform1.dependencies.Dependencies/CloseProviderPluginCache" - Dependencies_GetCachedProviders_FullMethodName = "/terraform1.dependencies.Dependencies/GetCachedProviders" - Dependencies_GetBuiltInProviders_FullMethodName = "/terraform1.dependencies.Dependencies/GetBuiltInProviders" - Dependencies_GetProviderSchema_FullMethodName = "/terraform1.dependencies.Dependencies/GetProviderSchema" -) - -// DependenciesClient is the client API for Dependencies service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type DependenciesClient interface { - // Opens a source bundle that was already extracted into the filesystem - // somewhere, returning an opaque source bundle handle that can be used for - // subsequent operations. - OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) - // Closes a previously-opened source bundle, invalidating the given handle - // and therefore making it safe to delete or modify the bundle directory - // on disk. - CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) - // Reads and parses an existing dependency lock file from the filesystem, - // returning a dependency locks handle. - // - // This function parses a user-provided source file, and so invalid content - // in that file is treated as diagnostics in a successful response rather - // than as an RPC error. Callers must check whether the dependency locks - // handle in the response is set (non-zero) before using it, and treat - // an unset handle as indicating a user error which is described in the - // accompanying diagnostics. Diagnostics can also be returned along with - // a valid handle, e.g. if there are non-blocking warning diagnostics. - OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) - // Creates an in-memory-only dependency locks handle with a fixed set of - // dependency selections provided as arguments. - CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) - CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) - // Returns information about the provider version selections in a - // dependency locks object. - GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) - // Populates a new provider plugin cache directory in the local filesystem - // based on the provider version selections in a given dependency locks - // object. - // - // This particular RPC can only install already-selected provider packages - // recorded in a dependency locks object; it does not support "upgrading" - // provider selections to newer versions as a CLI user would do with - // "terraform init -upgrade", because there would be no way to then - // commit the updated locks to disk as a lock file. - BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) - // Opens an existing local filesystem directory as a provider plugin cache - // directory, returning a plugin cache handle that can be used with other - // RPC operations. - OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) - CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) - // Returns information about the specific provider packages that are - // available in the given provider plugin cache. - GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) - // Returns information about the built-in providers that are compiled in - // to this Terraform Core server. - GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) - // Returns a description of the schema for a particular provider in a - // given provider plugin cache, or of a particular built-in provider - // known to this version of Terraform Core. - // - // WARNING: This operation requires executing the selected provider plugin, - // which therefore allows it to run arbitrary code as a child process of - // this Terraform Core server, with access to all of the same resources. - // This should typically be used only with providers explicitly selected - // in a dependency lock file, so users can control what external code - // has the potential to run in a context that probably has access to - // private source code and other sensitive information. - GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) -} - -type dependenciesClient struct { - cc grpc.ClientConnInterface -} - -func NewDependenciesClient(cc grpc.ClientConnInterface) DependenciesClient { - return &dependenciesClient{cc} -} - -func (c *dependenciesClient) OpenSourceBundle(ctx context.Context, in *OpenSourceBundle_Request, opts ...grpc.CallOption) (*OpenSourceBundle_Response, error) { - out := new(OpenSourceBundle_Response) - err := c.cc.Invoke(ctx, Dependencies_OpenSourceBundle_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CloseSourceBundle(ctx context.Context, in *CloseSourceBundle_Request, opts ...grpc.CallOption) (*CloseSourceBundle_Response, error) { - out := new(CloseSourceBundle_Response) - err := c.cc.Invoke(ctx, Dependencies_CloseSourceBundle_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) OpenDependencyLockFile(ctx context.Context, in *OpenDependencyLockFile_Request, opts ...grpc.CallOption) (*OpenDependencyLockFile_Response, error) { - out := new(OpenDependencyLockFile_Response) - err := c.cc.Invoke(ctx, Dependencies_OpenDependencyLockFile_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CreateDependencyLocks(ctx context.Context, in *CreateDependencyLocks_Request, opts ...grpc.CallOption) (*CreateDependencyLocks_Response, error) { - out := new(CreateDependencyLocks_Response) - err := c.cc.Invoke(ctx, Dependencies_CreateDependencyLocks_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CloseDependencyLocks(ctx context.Context, in *CloseDependencyLocks_Request, opts ...grpc.CallOption) (*CloseDependencyLocks_Response, error) { - out := new(CloseDependencyLocks_Response) - err := c.cc.Invoke(ctx, Dependencies_CloseDependencyLocks_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetLockedProviderDependencies(ctx context.Context, in *GetLockedProviderDependencies_Request, opts ...grpc.CallOption) (*GetLockedProviderDependencies_Response, error) { - out := new(GetLockedProviderDependencies_Response) - err := c.cc.Invoke(ctx, Dependencies_GetLockedProviderDependencies_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) BuildProviderPluginCache(ctx context.Context, in *BuildProviderPluginCache_Request, opts ...grpc.CallOption) (Dependencies_BuildProviderPluginCacheClient, error) { - stream, err := c.cc.NewStream(ctx, &Dependencies_ServiceDesc.Streams[0], Dependencies_BuildProviderPluginCache_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &dependenciesBuildProviderPluginCacheClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Dependencies_BuildProviderPluginCacheClient interface { - Recv() (*BuildProviderPluginCache_Event, error) - grpc.ClientStream -} - -type dependenciesBuildProviderPluginCacheClient struct { - grpc.ClientStream -} - -func (x *dependenciesBuildProviderPluginCacheClient) Recv() (*BuildProviderPluginCache_Event, error) { - m := new(BuildProviderPluginCache_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *dependenciesClient) OpenProviderPluginCache(ctx context.Context, in *OpenProviderPluginCache_Request, opts ...grpc.CallOption) (*OpenProviderPluginCache_Response, error) { - out := new(OpenProviderPluginCache_Response) - err := c.cc.Invoke(ctx, Dependencies_OpenProviderPluginCache_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) CloseProviderPluginCache(ctx context.Context, in *CloseProviderPluginCache_Request, opts ...grpc.CallOption) (*CloseProviderPluginCache_Response, error) { - out := new(CloseProviderPluginCache_Response) - err := c.cc.Invoke(ctx, Dependencies_CloseProviderPluginCache_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetCachedProviders(ctx context.Context, in *GetCachedProviders_Request, opts ...grpc.CallOption) (*GetCachedProviders_Response, error) { - out := new(GetCachedProviders_Response) - err := c.cc.Invoke(ctx, Dependencies_GetCachedProviders_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetBuiltInProviders(ctx context.Context, in *GetBuiltInProviders_Request, opts ...grpc.CallOption) (*GetBuiltInProviders_Response, error) { - out := new(GetBuiltInProviders_Response) - err := c.cc.Invoke(ctx, Dependencies_GetBuiltInProviders_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { - out := new(GetProviderSchema_Response) - err := c.cc.Invoke(ctx, Dependencies_GetProviderSchema_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// DependenciesServer is the server API for Dependencies service. -// All implementations should embed UnimplementedDependenciesServer -// for forward compatibility -type DependenciesServer interface { - // Opens a source bundle that was already extracted into the filesystem - // somewhere, returning an opaque source bundle handle that can be used for - // subsequent operations. - OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) - // Closes a previously-opened source bundle, invalidating the given handle - // and therefore making it safe to delete or modify the bundle directory - // on disk. - CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) - // Reads and parses an existing dependency lock file from the filesystem, - // returning a dependency locks handle. - // - // This function parses a user-provided source file, and so invalid content - // in that file is treated as diagnostics in a successful response rather - // than as an RPC error. Callers must check whether the dependency locks - // handle in the response is set (non-zero) before using it, and treat - // an unset handle as indicating a user error which is described in the - // accompanying diagnostics. Diagnostics can also be returned along with - // a valid handle, e.g. if there are non-blocking warning diagnostics. - OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) - // Creates an in-memory-only dependency locks handle with a fixed set of - // dependency selections provided as arguments. - CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) - CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) - // Returns information about the provider version selections in a - // dependency locks object. - GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) - // Populates a new provider plugin cache directory in the local filesystem - // based on the provider version selections in a given dependency locks - // object. - // - // This particular RPC can only install already-selected provider packages - // recorded in a dependency locks object; it does not support "upgrading" - // provider selections to newer versions as a CLI user would do with - // "terraform init -upgrade", because there would be no way to then - // commit the updated locks to disk as a lock file. - BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error - // Opens an existing local filesystem directory as a provider plugin cache - // directory, returning a plugin cache handle that can be used with other - // RPC operations. - OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) - CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) - // Returns information about the specific provider packages that are - // available in the given provider plugin cache. - GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) - // Returns information about the built-in providers that are compiled in - // to this Terraform Core server. - GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) - // Returns a description of the schema for a particular provider in a - // given provider plugin cache, or of a particular built-in provider - // known to this version of Terraform Core. - // - // WARNING: This operation requires executing the selected provider plugin, - // which therefore allows it to run arbitrary code as a child process of - // this Terraform Core server, with access to all of the same resources. - // This should typically be used only with providers explicitly selected - // in a dependency lock file, so users can control what external code - // has the potential to run in a context that probably has access to - // private source code and other sensitive information. - GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) -} - -// UnimplementedDependenciesServer should be embedded to have forward compatible implementations. -type UnimplementedDependenciesServer struct { -} - -func (UnimplementedDependenciesServer) OpenSourceBundle(context.Context, *OpenSourceBundle_Request) (*OpenSourceBundle_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenSourceBundle not implemented") -} -func (UnimplementedDependenciesServer) CloseSourceBundle(context.Context, *CloseSourceBundle_Request) (*CloseSourceBundle_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseSourceBundle not implemented") -} -func (UnimplementedDependenciesServer) OpenDependencyLockFile(context.Context, *OpenDependencyLockFile_Request) (*OpenDependencyLockFile_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenDependencyLockFile not implemented") -} -func (UnimplementedDependenciesServer) CreateDependencyLocks(context.Context, *CreateDependencyLocks_Request) (*CreateDependencyLocks_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateDependencyLocks not implemented") -} -func (UnimplementedDependenciesServer) CloseDependencyLocks(context.Context, *CloseDependencyLocks_Request) (*CloseDependencyLocks_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseDependencyLocks not implemented") -} -func (UnimplementedDependenciesServer) GetLockedProviderDependencies(context.Context, *GetLockedProviderDependencies_Request) (*GetLockedProviderDependencies_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetLockedProviderDependencies not implemented") -} -func (UnimplementedDependenciesServer) BuildProviderPluginCache(*BuildProviderPluginCache_Request, Dependencies_BuildProviderPluginCacheServer) error { - return status.Errorf(codes.Unimplemented, "method BuildProviderPluginCache not implemented") -} -func (UnimplementedDependenciesServer) OpenProviderPluginCache(context.Context, *OpenProviderPluginCache_Request) (*OpenProviderPluginCache_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenProviderPluginCache not implemented") -} -func (UnimplementedDependenciesServer) CloseProviderPluginCache(context.Context, *CloseProviderPluginCache_Request) (*CloseProviderPluginCache_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseProviderPluginCache not implemented") -} -func (UnimplementedDependenciesServer) GetCachedProviders(context.Context, *GetCachedProviders_Request) (*GetCachedProviders_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCachedProviders not implemented") -} -func (UnimplementedDependenciesServer) GetBuiltInProviders(context.Context, *GetBuiltInProviders_Request) (*GetBuiltInProviders_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBuiltInProviders not implemented") -} -func (UnimplementedDependenciesServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") -} - -// UnsafeDependenciesServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to DependenciesServer will -// result in compilation errors. -type UnsafeDependenciesServer interface { - mustEmbedUnimplementedDependenciesServer() -} - -func RegisterDependenciesServer(s grpc.ServiceRegistrar, srv DependenciesServer) { - s.RegisterService(&Dependencies_ServiceDesc, srv) -} - -func _Dependencies_OpenSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenSourceBundle_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).OpenSourceBundle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_OpenSourceBundle_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).OpenSourceBundle(ctx, req.(*OpenSourceBundle_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CloseSourceBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseSourceBundle_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CloseSourceBundle(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_CloseSourceBundle_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CloseSourceBundle(ctx, req.(*CloseSourceBundle_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_OpenDependencyLockFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenDependencyLockFile_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).OpenDependencyLockFile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_OpenDependencyLockFile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).OpenDependencyLockFile(ctx, req.(*OpenDependencyLockFile_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CreateDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateDependencyLocks_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CreateDependencyLocks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_CreateDependencyLocks_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CreateDependencyLocks(ctx, req.(*CreateDependencyLocks_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CloseDependencyLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseDependencyLocks_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CloseDependencyLocks(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_CloseDependencyLocks_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CloseDependencyLocks(ctx, req.(*CloseDependencyLocks_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetLockedProviderDependencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetLockedProviderDependencies_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_GetLockedProviderDependencies_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetLockedProviderDependencies(ctx, req.(*GetLockedProviderDependencies_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_BuildProviderPluginCache_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(BuildProviderPluginCache_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DependenciesServer).BuildProviderPluginCache(m, &dependenciesBuildProviderPluginCacheServer{stream}) -} - -type Dependencies_BuildProviderPluginCacheServer interface { - Send(*BuildProviderPluginCache_Event) error - grpc.ServerStream -} - -type dependenciesBuildProviderPluginCacheServer struct { - grpc.ServerStream -} - -func (x *dependenciesBuildProviderPluginCacheServer) Send(m *BuildProviderPluginCache_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Dependencies_OpenProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenProviderPluginCache_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).OpenProviderPluginCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_OpenProviderPluginCache_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).OpenProviderPluginCache(ctx, req.(*OpenProviderPluginCache_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_CloseProviderPluginCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseProviderPluginCache_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).CloseProviderPluginCache(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_CloseProviderPluginCache_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).CloseProviderPluginCache(ctx, req.(*CloseProviderPluginCache_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetCachedProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetCachedProviders_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetCachedProviders(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_GetCachedProviders_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetCachedProviders(ctx, req.(*GetCachedProviders_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetBuiltInProviders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetBuiltInProviders_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetBuiltInProviders(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_GetBuiltInProviders_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetBuiltInProviders(ctx, req.(*GetBuiltInProviders_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Dependencies_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServer).GetProviderSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Dependencies_GetProviderSchema_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -// Dependencies_ServiceDesc is the grpc.ServiceDesc for Dependencies service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Dependencies_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.dependencies.Dependencies", - HandlerType: (*DependenciesServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "OpenSourceBundle", - Handler: _Dependencies_OpenSourceBundle_Handler, - }, - { - MethodName: "CloseSourceBundle", - Handler: _Dependencies_CloseSourceBundle_Handler, - }, - { - MethodName: "OpenDependencyLockFile", - Handler: _Dependencies_OpenDependencyLockFile_Handler, - }, - { - MethodName: "CreateDependencyLocks", - Handler: _Dependencies_CreateDependencyLocks_Handler, - }, - { - MethodName: "CloseDependencyLocks", - Handler: _Dependencies_CloseDependencyLocks_Handler, - }, - { - MethodName: "GetLockedProviderDependencies", - Handler: _Dependencies_GetLockedProviderDependencies_Handler, - }, - { - MethodName: "OpenProviderPluginCache", - Handler: _Dependencies_OpenProviderPluginCache_Handler, - }, - { - MethodName: "CloseProviderPluginCache", - Handler: _Dependencies_CloseProviderPluginCache_Handler, - }, - { - MethodName: "GetCachedProviders", - Handler: _Dependencies_GetCachedProviders_Handler, - }, - { - MethodName: "GetBuiltInProviders", - Handler: _Dependencies_GetBuiltInProviders_Handler, - }, - { - MethodName: "GetProviderSchema", - Handler: _Dependencies_GetProviderSchema_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "BuildProviderPluginCache", - Handler: _Dependencies_BuildProviderPluginCache_Handler, - ServerStreams: true, - }, - }, - Metadata: "dependencies.proto", -} diff --git a/internal/rpcapi/terraform1/packages/packages.pb.go b/internal/rpcapi/terraform1/packages/packages.pb.go index fcd3720550b6..717afb662e4b 100644 --- a/internal/rpcapi/terraform1/packages/packages.pb.go +++ b/internal/rpcapi/terraform1/packages/packages.pb.go @@ -10,7 +10,11 @@ package packages import ( + context "context" terraform1 "github.com/hashicorp/terraform/internal/rpcapi/terraform1" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -918,3 +922,227 @@ func file_packages_proto_init() { file_packages_proto_goTypes = nil file_packages_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// PackagesClient is the client API for Packages service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type PackagesClient interface { + ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) + FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) + ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) + ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) + FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) +} + +type packagesClient struct { + cc grpc.ClientConnInterface +} + +func NewPackagesClient(cc grpc.ClientConnInterface) PackagesClient { + return &packagesClient{cc} +} + +func (c *packagesClient) ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) { + out := new(ProviderPackageVersions_Response) + err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/ProviderPackageVersions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) { + out := new(FetchProviderPackage_Response) + err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/FetchProviderPackage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) { + out := new(ModulePackageVersions_Response) + err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/ModulePackageVersions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) { + out := new(ModulePackageSourceAddr_Response) + err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/ModulePackageSourceAddr", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *packagesClient) FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) { + out := new(FetchModulePackage_Response) + err := c.cc.Invoke(ctx, "/terraform1.packages.Packages/FetchModulePackage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PackagesServer is the server API for Packages service. +type PackagesServer interface { + ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) + FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) + ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) + ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) + FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) +} + +// UnimplementedPackagesServer can be embedded to have forward compatible implementations. +type UnimplementedPackagesServer struct { +} + +func (*UnimplementedPackagesServer) ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProviderPackageVersions not implemented") +} +func (*UnimplementedPackagesServer) FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchProviderPackage not implemented") +} +func (*UnimplementedPackagesServer) ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModulePackageVersions not implemented") +} +func (*UnimplementedPackagesServer) ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModulePackageSourceAddr not implemented") +} +func (*UnimplementedPackagesServer) FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchModulePackage not implemented") +} + +func RegisterPackagesServer(s *grpc.Server, srv PackagesServer) { + s.RegisterService(&_Packages_serviceDesc, srv) +} + +func _Packages_ProviderPackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ProviderPackageVersions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).ProviderPackageVersions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.packages.Packages/ProviderPackageVersions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).ProviderPackageVersions(ctx, req.(*ProviderPackageVersions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_FetchProviderPackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchProviderPackage_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).FetchProviderPackage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.packages.Packages/FetchProviderPackage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).FetchProviderPackage(ctx, req.(*FetchProviderPackage_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_ModulePackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ModulePackageVersions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).ModulePackageVersions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.packages.Packages/ModulePackageVersions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).ModulePackageVersions(ctx, req.(*ModulePackageVersions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_ModulePackageSourceAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ModulePackageSourceAddr_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).ModulePackageSourceAddr(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.packages.Packages/ModulePackageSourceAddr", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).ModulePackageSourceAddr(ctx, req.(*ModulePackageSourceAddr_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Packages_FetchModulePackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchModulePackage_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PackagesServer).FetchModulePackage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.packages.Packages/FetchModulePackage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PackagesServer).FetchModulePackage(ctx, req.(*FetchModulePackage_Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Packages_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.packages.Packages", + HandlerType: (*PackagesServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ProviderPackageVersions", + Handler: _Packages_ProviderPackageVersions_Handler, + }, + { + MethodName: "FetchProviderPackage", + Handler: _Packages_FetchProviderPackage_Handler, + }, + { + MethodName: "ModulePackageVersions", + Handler: _Packages_ModulePackageVersions_Handler, + }, + { + MethodName: "ModulePackageSourceAddr", + Handler: _Packages_ModulePackageSourceAddr_Handler, + }, + { + MethodName: "FetchModulePackage", + Handler: _Packages_FetchModulePackage_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "packages.proto", +} diff --git a/internal/rpcapi/terraform1/packages/packages_grpc.pb.go b/internal/rpcapi/terraform1/packages/packages_grpc.pb.go deleted file mode 100644 index 0842a384df59..000000000000 --- a/internal/rpcapi/terraform1/packages/packages_grpc.pb.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: packages.proto - -package packages - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Packages_ProviderPackageVersions_FullMethodName = "/terraform1.packages.Packages/ProviderPackageVersions" - Packages_FetchProviderPackage_FullMethodName = "/terraform1.packages.Packages/FetchProviderPackage" - Packages_ModulePackageVersions_FullMethodName = "/terraform1.packages.Packages/ModulePackageVersions" - Packages_ModulePackageSourceAddr_FullMethodName = "/terraform1.packages.Packages/ModulePackageSourceAddr" - Packages_FetchModulePackage_FullMethodName = "/terraform1.packages.Packages/FetchModulePackage" -) - -// PackagesClient is the client API for Packages service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type PackagesClient interface { - ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) - FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) - ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) - ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) - FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) -} - -type packagesClient struct { - cc grpc.ClientConnInterface -} - -func NewPackagesClient(cc grpc.ClientConnInterface) PackagesClient { - return &packagesClient{cc} -} - -func (c *packagesClient) ProviderPackageVersions(ctx context.Context, in *ProviderPackageVersions_Request, opts ...grpc.CallOption) (*ProviderPackageVersions_Response, error) { - out := new(ProviderPackageVersions_Response) - err := c.cc.Invoke(ctx, Packages_ProviderPackageVersions_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) FetchProviderPackage(ctx context.Context, in *FetchProviderPackage_Request, opts ...grpc.CallOption) (*FetchProviderPackage_Response, error) { - out := new(FetchProviderPackage_Response) - err := c.cc.Invoke(ctx, Packages_FetchProviderPackage_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) ModulePackageVersions(ctx context.Context, in *ModulePackageVersions_Request, opts ...grpc.CallOption) (*ModulePackageVersions_Response, error) { - out := new(ModulePackageVersions_Response) - err := c.cc.Invoke(ctx, Packages_ModulePackageVersions_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) ModulePackageSourceAddr(ctx context.Context, in *ModulePackageSourceAddr_Request, opts ...grpc.CallOption) (*ModulePackageSourceAddr_Response, error) { - out := new(ModulePackageSourceAddr_Response) - err := c.cc.Invoke(ctx, Packages_ModulePackageSourceAddr_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *packagesClient) FetchModulePackage(ctx context.Context, in *FetchModulePackage_Request, opts ...grpc.CallOption) (*FetchModulePackage_Response, error) { - out := new(FetchModulePackage_Response) - err := c.cc.Invoke(ctx, Packages_FetchModulePackage_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PackagesServer is the server API for Packages service. -// All implementations should embed UnimplementedPackagesServer -// for forward compatibility -type PackagesServer interface { - ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) - FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) - ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) - ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) - FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) -} - -// UnimplementedPackagesServer should be embedded to have forward compatible implementations. -type UnimplementedPackagesServer struct { -} - -func (UnimplementedPackagesServer) ProviderPackageVersions(context.Context, *ProviderPackageVersions_Request) (*ProviderPackageVersions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ProviderPackageVersions not implemented") -} -func (UnimplementedPackagesServer) FetchProviderPackage(context.Context, *FetchProviderPackage_Request) (*FetchProviderPackage_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchProviderPackage not implemented") -} -func (UnimplementedPackagesServer) ModulePackageVersions(context.Context, *ModulePackageVersions_Request) (*ModulePackageVersions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ModulePackageVersions not implemented") -} -func (UnimplementedPackagesServer) ModulePackageSourceAddr(context.Context, *ModulePackageSourceAddr_Request) (*ModulePackageSourceAddr_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ModulePackageSourceAddr not implemented") -} -func (UnimplementedPackagesServer) FetchModulePackage(context.Context, *FetchModulePackage_Request) (*FetchModulePackage_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method FetchModulePackage not implemented") -} - -// UnsafePackagesServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PackagesServer will -// result in compilation errors. -type UnsafePackagesServer interface { - mustEmbedUnimplementedPackagesServer() -} - -func RegisterPackagesServer(s grpc.ServiceRegistrar, srv PackagesServer) { - s.RegisterService(&Packages_ServiceDesc, srv) -} - -func _Packages_ProviderPackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ProviderPackageVersions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).ProviderPackageVersions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Packages_ProviderPackageVersions_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).ProviderPackageVersions(ctx, req.(*ProviderPackageVersions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_FetchProviderPackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchProviderPackage_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).FetchProviderPackage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Packages_FetchProviderPackage_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).FetchProviderPackage(ctx, req.(*FetchProviderPackage_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_ModulePackageVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ModulePackageVersions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).ModulePackageVersions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Packages_ModulePackageVersions_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).ModulePackageVersions(ctx, req.(*ModulePackageVersions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_ModulePackageSourceAddr_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ModulePackageSourceAddr_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).ModulePackageSourceAddr(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Packages_ModulePackageSourceAddr_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).ModulePackageSourceAddr(ctx, req.(*ModulePackageSourceAddr_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Packages_FetchModulePackage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FetchModulePackage_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PackagesServer).FetchModulePackage(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Packages_FetchModulePackage_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PackagesServer).FetchModulePackage(ctx, req.(*FetchModulePackage_Request)) - } - return interceptor(ctx, in, info, handler) -} - -// Packages_ServiceDesc is the grpc.ServiceDesc for Packages service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Packages_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.packages.Packages", - HandlerType: (*PackagesServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ProviderPackageVersions", - Handler: _Packages_ProviderPackageVersions_Handler, - }, - { - MethodName: "FetchProviderPackage", - Handler: _Packages_FetchProviderPackage_Handler, - }, - { - MethodName: "ModulePackageVersions", - Handler: _Packages_ModulePackageVersions_Handler, - }, - { - MethodName: "ModulePackageSourceAddr", - Handler: _Packages_ModulePackageSourceAddr_Handler, - }, - { - MethodName: "FetchModulePackage", - Handler: _Packages_FetchModulePackage_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "packages.proto", -} diff --git a/internal/rpcapi/terraform1/setup/setup.pb.go b/internal/rpcapi/terraform1/setup/setup.pb.go index 0500aa9f42e3..03a2d115f36f 100644 --- a/internal/rpcapi/terraform1/setup/setup.pb.go +++ b/internal/rpcapi/terraform1/setup/setup.pb.go @@ -10,6 +10,10 @@ package setup import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -525,3 +529,133 @@ func file_setup_proto_init() { file_setup_proto_goTypes = nil file_setup_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// SetupClient is the client API for Setup service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SetupClient interface { + // Clients must call Handshake before any other function of any other + // service, to complete the capability negotiation step that may + // then affect the behaviors of subsequent operations. + // + // This function can be called only once per RPC server. + Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) + // At any time after handshaking, clients may call Stop to initiate a + // graceful shutdown of the server. + Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) +} + +type setupClient struct { + cc grpc.ClientConnInterface +} + +func NewSetupClient(cc grpc.ClientConnInterface) SetupClient { + return &setupClient{cc} +} + +func (c *setupClient) Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) { + out := new(Handshake_Response) + err := c.cc.Invoke(ctx, "/terraform1.setup.Setup/Handshake", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *setupClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { + out := new(Stop_Response) + err := c.cc.Invoke(ctx, "/terraform1.setup.Setup/Stop", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SetupServer is the server API for Setup service. +type SetupServer interface { + // Clients must call Handshake before any other function of any other + // service, to complete the capability negotiation step that may + // then affect the behaviors of subsequent operations. + // + // This function can be called only once per RPC server. + Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) + // At any time after handshaking, clients may call Stop to initiate a + // graceful shutdown of the server. + Stop(context.Context, *Stop_Request) (*Stop_Response, error) +} + +// UnimplementedSetupServer can be embedded to have forward compatible implementations. +type UnimplementedSetupServer struct { +} + +func (*UnimplementedSetupServer) Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Handshake not implemented") +} +func (*UnimplementedSetupServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + +func RegisterSetupServer(s *grpc.Server, srv SetupServer) { + s.RegisterService(&_Setup_serviceDesc, srv) +} + +func _Setup_Handshake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Handshake_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SetupServer).Handshake(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.setup.Setup/Handshake", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SetupServer).Handshake(ctx, req.(*Handshake_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Setup_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Stop_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SetupServer).Stop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.setup.Setup/Stop", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SetupServer).Stop(ctx, req.(*Stop_Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Setup_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.setup.Setup", + HandlerType: (*SetupServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Handshake", + Handler: _Setup_Handshake_Handler, + }, + { + MethodName: "Stop", + Handler: _Setup_Stop_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "setup.proto", +} diff --git a/internal/rpcapi/terraform1/setup/setup_grpc.pb.go b/internal/rpcapi/terraform1/setup/setup_grpc.pb.go deleted file mode 100644 index e290d6056df7..000000000000 --- a/internal/rpcapi/terraform1/setup/setup_grpc.pb.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: setup.proto - -package setup - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Setup_Handshake_FullMethodName = "/terraform1.setup.Setup/Handshake" - Setup_Stop_FullMethodName = "/terraform1.setup.Setup/Stop" -) - -// SetupClient is the client API for Setup service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type SetupClient interface { - // Clients must call Handshake before any other function of any other - // service, to complete the capability negotiation step that may - // then affect the behaviors of subsequent operations. - // - // This function can be called only once per RPC server. - Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) - // At any time after handshaking, clients may call Stop to initiate a - // graceful shutdown of the server. - Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) -} - -type setupClient struct { - cc grpc.ClientConnInterface -} - -func NewSetupClient(cc grpc.ClientConnInterface) SetupClient { - return &setupClient{cc} -} - -func (c *setupClient) Handshake(ctx context.Context, in *Handshake_Request, opts ...grpc.CallOption) (*Handshake_Response, error) { - out := new(Handshake_Response) - err := c.cc.Invoke(ctx, Setup_Handshake_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *setupClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { - out := new(Stop_Response) - err := c.cc.Invoke(ctx, Setup_Stop_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// SetupServer is the server API for Setup service. -// All implementations should embed UnimplementedSetupServer -// for forward compatibility -type SetupServer interface { - // Clients must call Handshake before any other function of any other - // service, to complete the capability negotiation step that may - // then affect the behaviors of subsequent operations. - // - // This function can be called only once per RPC server. - Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) - // At any time after handshaking, clients may call Stop to initiate a - // graceful shutdown of the server. - Stop(context.Context, *Stop_Request) (*Stop_Response, error) -} - -// UnimplementedSetupServer should be embedded to have forward compatible implementations. -type UnimplementedSetupServer struct { -} - -func (UnimplementedSetupServer) Handshake(context.Context, *Handshake_Request) (*Handshake_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Handshake not implemented") -} -func (UnimplementedSetupServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") -} - -// UnsafeSetupServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to SetupServer will -// result in compilation errors. -type UnsafeSetupServer interface { - mustEmbedUnimplementedSetupServer() -} - -func RegisterSetupServer(s grpc.ServiceRegistrar, srv SetupServer) { - s.RegisterService(&Setup_ServiceDesc, srv) -} - -func _Setup_Handshake_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Handshake_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SetupServer).Handshake(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Setup_Handshake_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SetupServer).Handshake(ctx, req.(*Handshake_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Setup_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Stop_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SetupServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Setup_Stop_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SetupServer).Stop(ctx, req.(*Stop_Request)) - } - return interceptor(ctx, in, info, handler) -} - -// Setup_ServiceDesc is the grpc.ServiceDesc for Setup service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Setup_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.setup.Setup", - HandlerType: (*SetupServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Handshake", - Handler: _Setup_Handshake_Handler, - }, - { - MethodName: "Stop", - Handler: _Setup_Stop_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "setup.proto", -} diff --git a/internal/rpcapi/terraform1/stacks/stacks.pb.go b/internal/rpcapi/terraform1/stacks/stacks.pb.go index 8ec49f6ace16..3293d9def244 100644 --- a/internal/rpcapi/terraform1/stacks/stacks.pb.go +++ b/internal/rpcapi/terraform1/stacks/stacks.pb.go @@ -10,7 +10,11 @@ package stacks import ( + context "context" terraform1 "github.com/hashicorp/terraform/internal/rpcapi/terraform1" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" anypb "google.golang.org/protobuf/types/known/anypb" @@ -7226,3 +7230,831 @@ func file_stacks_proto_init() { file_stacks_proto_goTypes = nil file_stacks_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// StacksClient is the client API for Stacks service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type StacksClient interface { + // Load and perform initial static validation of a stack configuration + // in a previously-opened source bundle. If successful, returns a + // stack configuration handle that can be used with other operations. + OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) + // Close a previously-opened stack configuration using its handle. + CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) + // Validate an open stack configuration. + ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) + // Analyze a stack configuration to find all of the components it declares. + // This is static analysis only, so it cannot produce dynamic information + // such as the number of instances of each component. + FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) + // Load a stack state by sending a stream of raw state objects that were + // streamed from a previous ApplyStackChanges response. + OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) + // Close a stack state handle, discarding the associated state. + CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) + // Calculate a desired state from the given configuration and compare it + // with the current state to propose a set of changes to converge the + // current state with the desired state, at least in part. + PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) + // Load a previously-created plan by sending a stream of raw change objects + // that were streamed from a previous PlanStackChanges response. + OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) + // Close a saved plan handle, discarding the associated saved plan. + ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) + // Execute the changes proposed by an earlier call to PlanStackChanges. + ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) + // OpenStackInspector creates a stack inspector handle that can be used + // with subsequent calls to the "Inspect"-prefixed functions. + OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) + // InspectExpressionResult evaluates an arbitrary expression in the context + // of a stack inspector handle. + InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) + // Open a previously-saved Terraform state, returning a handle that can be + // used with other operations. This is distinct from OpenState because it + // means core state rather than stack state. + OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) + // Close a previously-opened Terraform state using its handle. + CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) + // MigrateTerraformState migrates a Terraform state into Stacks state using + // a mapping of addresses. + MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) + // ListResourceIdentities lists the identities of all resources in a stack. + ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) +} + +type stacksClient struct { + cc grpc.ClientConnInterface +} + +func NewStacksClient(cc grpc.ClientConnInterface) StacksClient { + return &stacksClient{cc} +} + +func (c *stacksClient) OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) { + out := new(OpenStackConfiguration_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/OpenStackConfiguration", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) { + out := new(CloseStackConfiguration_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/CloseStackConfiguration", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) { + out := new(ValidateStackConfiguration_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/ValidateStackConfiguration", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) { + out := new(FindStackConfigurationComponents_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/FindStackConfigurationComponents", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) { + stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[0], "/terraform1.stacks.Stacks/OpenState", opts...) + if err != nil { + return nil, err + } + x := &stacksOpenStateClient{stream} + return x, nil +} + +type Stacks_OpenStateClient interface { + Send(*OpenStackState_RequestItem) error + CloseAndRecv() (*OpenStackState_Response, error) + grpc.ClientStream +} + +type stacksOpenStateClient struct { + grpc.ClientStream +} + +func (x *stacksOpenStateClient) Send(m *OpenStackState_RequestItem) error { + return x.ClientStream.SendMsg(m) +} + +func (x *stacksOpenStateClient) CloseAndRecv() (*OpenStackState_Response, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(OpenStackState_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) { + out := new(CloseStackState_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/CloseState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) { + stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[1], "/terraform1.stacks.Stacks/PlanStackChanges", opts...) + if err != nil { + return nil, err + } + x := &stacksPlanStackChangesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Stacks_PlanStackChangesClient interface { + Recv() (*PlanStackChanges_Event, error) + grpc.ClientStream +} + +type stacksPlanStackChangesClient struct { + grpc.ClientStream +} + +func (x *stacksPlanStackChangesClient) Recv() (*PlanStackChanges_Event, error) { + m := new(PlanStackChanges_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) { + stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[2], "/terraform1.stacks.Stacks/OpenPlan", opts...) + if err != nil { + return nil, err + } + x := &stacksOpenPlanClient{stream} + return x, nil +} + +type Stacks_OpenPlanClient interface { + Send(*OpenStackPlan_RequestItem) error + CloseAndRecv() (*OpenStackPlan_Response, error) + grpc.ClientStream +} + +type stacksOpenPlanClient struct { + grpc.ClientStream +} + +func (x *stacksOpenPlanClient) Send(m *OpenStackPlan_RequestItem) error { + return x.ClientStream.SendMsg(m) +} + +func (x *stacksOpenPlanClient) CloseAndRecv() (*OpenStackPlan_Response, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(OpenStackPlan_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) { + out := new(CloseStackPlan_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/ClosePlan", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) { + stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[3], "/terraform1.stacks.Stacks/ApplyStackChanges", opts...) + if err != nil { + return nil, err + } + x := &stacksApplyStackChangesClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Stacks_ApplyStackChangesClient interface { + Recv() (*ApplyStackChanges_Event, error) + grpc.ClientStream +} + +type stacksApplyStackChangesClient struct { + grpc.ClientStream +} + +func (x *stacksApplyStackChangesClient) Recv() (*ApplyStackChanges_Event, error) { + m := new(ApplyStackChanges_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) { + out := new(OpenStackInspector_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/OpenStackInspector", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) { + out := new(InspectExpressionResult_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/InspectExpressionResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) { + out := new(OpenTerraformState_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/OpenTerraformState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) { + out := new(CloseTerraformState_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/CloseTerraformState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *stacksClient) MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) { + stream, err := c.cc.NewStream(ctx, &_Stacks_serviceDesc.Streams[4], "/terraform1.stacks.Stacks/MigrateTerraformState", opts...) + if err != nil { + return nil, err + } + x := &stacksMigrateTerraformStateClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Stacks_MigrateTerraformStateClient interface { + Recv() (*MigrateTerraformState_Event, error) + grpc.ClientStream +} + +type stacksMigrateTerraformStateClient struct { + grpc.ClientStream +} + +func (x *stacksMigrateTerraformStateClient) Recv() (*MigrateTerraformState_Event, error) { + m := new(MigrateTerraformState_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *stacksClient) ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) { + out := new(ListResourceIdentities_Response) + err := c.cc.Invoke(ctx, "/terraform1.stacks.Stacks/ListResourceIdentities", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StacksServer is the server API for Stacks service. +type StacksServer interface { + // Load and perform initial static validation of a stack configuration + // in a previously-opened source bundle. If successful, returns a + // stack configuration handle that can be used with other operations. + OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) + // Close a previously-opened stack configuration using its handle. + CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) + // Validate an open stack configuration. + ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) + // Analyze a stack configuration to find all of the components it declares. + // This is static analysis only, so it cannot produce dynamic information + // such as the number of instances of each component. + FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) + // Load a stack state by sending a stream of raw state objects that were + // streamed from a previous ApplyStackChanges response. + OpenState(Stacks_OpenStateServer) error + // Close a stack state handle, discarding the associated state. + CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) + // Calculate a desired state from the given configuration and compare it + // with the current state to propose a set of changes to converge the + // current state with the desired state, at least in part. + PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error + // Load a previously-created plan by sending a stream of raw change objects + // that were streamed from a previous PlanStackChanges response. + OpenPlan(Stacks_OpenPlanServer) error + // Close a saved plan handle, discarding the associated saved plan. + ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) + // Execute the changes proposed by an earlier call to PlanStackChanges. + ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error + // OpenStackInspector creates a stack inspector handle that can be used + // with subsequent calls to the "Inspect"-prefixed functions. + OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) + // InspectExpressionResult evaluates an arbitrary expression in the context + // of a stack inspector handle. + InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) + // Open a previously-saved Terraform state, returning a handle that can be + // used with other operations. This is distinct from OpenState because it + // means core state rather than stack state. + OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) + // Close a previously-opened Terraform state using its handle. + CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) + // MigrateTerraformState migrates a Terraform state into Stacks state using + // a mapping of addresses. + MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error + // ListResourceIdentities lists the identities of all resources in a stack. + ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) +} + +// UnimplementedStacksServer can be embedded to have forward compatible implementations. +type UnimplementedStacksServer struct { +} + +func (*UnimplementedStacksServer) OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenStackConfiguration not implemented") +} +func (*UnimplementedStacksServer) CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseStackConfiguration not implemented") +} +func (*UnimplementedStacksServer) ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateStackConfiguration not implemented") +} +func (*UnimplementedStacksServer) FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindStackConfigurationComponents not implemented") +} +func (*UnimplementedStacksServer) OpenState(Stacks_OpenStateServer) error { + return status.Errorf(codes.Unimplemented, "method OpenState not implemented") +} +func (*UnimplementedStacksServer) CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseState not implemented") +} +func (*UnimplementedStacksServer) PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error { + return status.Errorf(codes.Unimplemented, "method PlanStackChanges not implemented") +} +func (*UnimplementedStacksServer) OpenPlan(Stacks_OpenPlanServer) error { + return status.Errorf(codes.Unimplemented, "method OpenPlan not implemented") +} +func (*UnimplementedStacksServer) ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClosePlan not implemented") +} +func (*UnimplementedStacksServer) ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error { + return status.Errorf(codes.Unimplemented, "method ApplyStackChanges not implemented") +} +func (*UnimplementedStacksServer) OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenStackInspector not implemented") +} +func (*UnimplementedStacksServer) InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method InspectExpressionResult not implemented") +} +func (*UnimplementedStacksServer) OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenTerraformState not implemented") +} +func (*UnimplementedStacksServer) CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseTerraformState not implemented") +} +func (*UnimplementedStacksServer) MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error { + return status.Errorf(codes.Unimplemented, "method MigrateTerraformState not implemented") +} +func (*UnimplementedStacksServer) ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListResourceIdentities not implemented") +} + +func RegisterStacksServer(s *grpc.Server, srv StacksServer) { + s.RegisterService(&_Stacks_serviceDesc, srv) +} + +func _Stacks_OpenStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenStackConfiguration_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).OpenStackConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/OpenStackConfiguration", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).OpenStackConfiguration(ctx, req.(*OpenStackConfiguration_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_CloseStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStackConfiguration_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).CloseStackConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/CloseStackConfiguration", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).CloseStackConfiguration(ctx, req.(*CloseStackConfiguration_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_ValidateStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateStackConfiguration_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).ValidateStackConfiguration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/ValidateStackConfiguration", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).ValidateStackConfiguration(ctx, req.(*ValidateStackConfiguration_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_FindStackConfigurationComponents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindStackConfigurationComponents_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).FindStackConfigurationComponents(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/FindStackConfigurationComponents", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).FindStackConfigurationComponents(ctx, req.(*FindStackConfigurationComponents_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_OpenState_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StacksServer).OpenState(&stacksOpenStateServer{stream}) +} + +type Stacks_OpenStateServer interface { + SendAndClose(*OpenStackState_Response) error + Recv() (*OpenStackState_RequestItem, error) + grpc.ServerStream +} + +type stacksOpenStateServer struct { + grpc.ServerStream +} + +func (x *stacksOpenStateServer) SendAndClose(m *OpenStackState_Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *stacksOpenStateServer) Recv() (*OpenStackState_RequestItem, error) { + m := new(OpenStackState_RequestItem) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Stacks_CloseState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStackState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).CloseState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/CloseState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).CloseState(ctx, req.(*CloseStackState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_PlanStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(PlanStackChanges_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StacksServer).PlanStackChanges(m, &stacksPlanStackChangesServer{stream}) +} + +type Stacks_PlanStackChangesServer interface { + Send(*PlanStackChanges_Event) error + grpc.ServerStream +} + +type stacksPlanStackChangesServer struct { + grpc.ServerStream +} + +func (x *stacksPlanStackChangesServer) Send(m *PlanStackChanges_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Stacks_OpenPlan_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(StacksServer).OpenPlan(&stacksOpenPlanServer{stream}) +} + +type Stacks_OpenPlanServer interface { + SendAndClose(*OpenStackPlan_Response) error + Recv() (*OpenStackPlan_RequestItem, error) + grpc.ServerStream +} + +type stacksOpenPlanServer struct { + grpc.ServerStream +} + +func (x *stacksOpenPlanServer) SendAndClose(m *OpenStackPlan_Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *stacksOpenPlanServer) Recv() (*OpenStackPlan_RequestItem, error) { + m := new(OpenStackPlan_RequestItem) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _Stacks_ClosePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseStackPlan_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).ClosePlan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/ClosePlan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).ClosePlan(ctx, req.(*CloseStackPlan_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_ApplyStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ApplyStackChanges_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StacksServer).ApplyStackChanges(m, &stacksApplyStackChangesServer{stream}) +} + +type Stacks_ApplyStackChangesServer interface { + Send(*ApplyStackChanges_Event) error + grpc.ServerStream +} + +type stacksApplyStackChangesServer struct { + grpc.ServerStream +} + +func (x *stacksApplyStackChangesServer) Send(m *ApplyStackChanges_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Stacks_OpenStackInspector_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenStackInspector_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).OpenStackInspector(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/OpenStackInspector", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).OpenStackInspector(ctx, req.(*OpenStackInspector_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_InspectExpressionResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InspectExpressionResult_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).InspectExpressionResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/InspectExpressionResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).InspectExpressionResult(ctx, req.(*InspectExpressionResult_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_OpenTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenTerraformState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).OpenTerraformState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/OpenTerraformState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).OpenTerraformState(ctx, req.(*OpenTerraformState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_CloseTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseTerraformState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).CloseTerraformState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/CloseTerraformState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).CloseTerraformState(ctx, req.(*CloseTerraformState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Stacks_MigrateTerraformState_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(MigrateTerraformState_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(StacksServer).MigrateTerraformState(m, &stacksMigrateTerraformStateServer{stream}) +} + +type Stacks_MigrateTerraformStateServer interface { + Send(*MigrateTerraformState_Event) error + grpc.ServerStream +} + +type stacksMigrateTerraformStateServer struct { + grpc.ServerStream +} + +func (x *stacksMigrateTerraformStateServer) Send(m *MigrateTerraformState_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Stacks_ListResourceIdentities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListResourceIdentities_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StacksServer).ListResourceIdentities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terraform1.stacks.Stacks/ListResourceIdentities", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StacksServer).ListResourceIdentities(ctx, req.(*ListResourceIdentities_Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Stacks_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terraform1.stacks.Stacks", + HandlerType: (*StacksServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "OpenStackConfiguration", + Handler: _Stacks_OpenStackConfiguration_Handler, + }, + { + MethodName: "CloseStackConfiguration", + Handler: _Stacks_CloseStackConfiguration_Handler, + }, + { + MethodName: "ValidateStackConfiguration", + Handler: _Stacks_ValidateStackConfiguration_Handler, + }, + { + MethodName: "FindStackConfigurationComponents", + Handler: _Stacks_FindStackConfigurationComponents_Handler, + }, + { + MethodName: "CloseState", + Handler: _Stacks_CloseState_Handler, + }, + { + MethodName: "ClosePlan", + Handler: _Stacks_ClosePlan_Handler, + }, + { + MethodName: "OpenStackInspector", + Handler: _Stacks_OpenStackInspector_Handler, + }, + { + MethodName: "InspectExpressionResult", + Handler: _Stacks_InspectExpressionResult_Handler, + }, + { + MethodName: "OpenTerraformState", + Handler: _Stacks_OpenTerraformState_Handler, + }, + { + MethodName: "CloseTerraformState", + Handler: _Stacks_CloseTerraformState_Handler, + }, + { + MethodName: "ListResourceIdentities", + Handler: _Stacks_ListResourceIdentities_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "OpenState", + Handler: _Stacks_OpenState_Handler, + ClientStreams: true, + }, + { + StreamName: "PlanStackChanges", + Handler: _Stacks_PlanStackChanges_Handler, + ServerStreams: true, + }, + { + StreamName: "OpenPlan", + Handler: _Stacks_OpenPlan_Handler, + ClientStreams: true, + }, + { + StreamName: "ApplyStackChanges", + Handler: _Stacks_ApplyStackChanges_Handler, + ServerStreams: true, + }, + { + StreamName: "MigrateTerraformState", + Handler: _Stacks_MigrateTerraformState_Handler, + ServerStreams: true, + }, + }, + Metadata: "stacks.proto", +} diff --git a/internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go b/internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go deleted file mode 100644 index 914efcb61543..000000000000 --- a/internal/rpcapi/terraform1/stacks/stacks_grpc.pb.go +++ /dev/null @@ -1,873 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: stacks.proto - -package stacks - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Stacks_OpenStackConfiguration_FullMethodName = "/terraform1.stacks.Stacks/OpenStackConfiguration" - Stacks_CloseStackConfiguration_FullMethodName = "/terraform1.stacks.Stacks/CloseStackConfiguration" - Stacks_ValidateStackConfiguration_FullMethodName = "/terraform1.stacks.Stacks/ValidateStackConfiguration" - Stacks_FindStackConfigurationComponents_FullMethodName = "/terraform1.stacks.Stacks/FindStackConfigurationComponents" - Stacks_OpenState_FullMethodName = "/terraform1.stacks.Stacks/OpenState" - Stacks_CloseState_FullMethodName = "/terraform1.stacks.Stacks/CloseState" - Stacks_PlanStackChanges_FullMethodName = "/terraform1.stacks.Stacks/PlanStackChanges" - Stacks_OpenPlan_FullMethodName = "/terraform1.stacks.Stacks/OpenPlan" - Stacks_ClosePlan_FullMethodName = "/terraform1.stacks.Stacks/ClosePlan" - Stacks_ApplyStackChanges_FullMethodName = "/terraform1.stacks.Stacks/ApplyStackChanges" - Stacks_OpenStackInspector_FullMethodName = "/terraform1.stacks.Stacks/OpenStackInspector" - Stacks_InspectExpressionResult_FullMethodName = "/terraform1.stacks.Stacks/InspectExpressionResult" - Stacks_OpenTerraformState_FullMethodName = "/terraform1.stacks.Stacks/OpenTerraformState" - Stacks_CloseTerraformState_FullMethodName = "/terraform1.stacks.Stacks/CloseTerraformState" - Stacks_MigrateTerraformState_FullMethodName = "/terraform1.stacks.Stacks/MigrateTerraformState" - Stacks_ListResourceIdentities_FullMethodName = "/terraform1.stacks.Stacks/ListResourceIdentities" -) - -// StacksClient is the client API for Stacks service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type StacksClient interface { - // Load and perform initial static validation of a stack configuration - // in a previously-opened source bundle. If successful, returns a - // stack configuration handle that can be used with other operations. - OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) - // Close a previously-opened stack configuration using its handle. - CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) - // Validate an open stack configuration. - ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) - // Analyze a stack configuration to find all of the components it declares. - // This is static analysis only, so it cannot produce dynamic information - // such as the number of instances of each component. - FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) - // Load a stack state by sending a stream of raw state objects that were - // streamed from a previous ApplyStackChanges response. - OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) - // Close a stack state handle, discarding the associated state. - CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) - // Calculate a desired state from the given configuration and compare it - // with the current state to propose a set of changes to converge the - // current state with the desired state, at least in part. - PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) - // Load a previously-created plan by sending a stream of raw change objects - // that were streamed from a previous PlanStackChanges response. - OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) - // Close a saved plan handle, discarding the associated saved plan. - ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) - // Execute the changes proposed by an earlier call to PlanStackChanges. - ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) - // OpenStackInspector creates a stack inspector handle that can be used - // with subsequent calls to the "Inspect"-prefixed functions. - OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) - // InspectExpressionResult evaluates an arbitrary expression in the context - // of a stack inspector handle. - InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) - // Open a previously-saved Terraform state, returning a handle that can be - // used with other operations. This is distinct from OpenState because it - // means core state rather than stack state. - OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) - // Close a previously-opened Terraform state using its handle. - CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) - // MigrateTerraformState migrates a Terraform state into Stacks state using - // a mapping of addresses. - MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) - // ListResourceIdentities lists the identities of all resources in a stack. - ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) -} - -type stacksClient struct { - cc grpc.ClientConnInterface -} - -func NewStacksClient(cc grpc.ClientConnInterface) StacksClient { - return &stacksClient{cc} -} - -func (c *stacksClient) OpenStackConfiguration(ctx context.Context, in *OpenStackConfiguration_Request, opts ...grpc.CallOption) (*OpenStackConfiguration_Response, error) { - out := new(OpenStackConfiguration_Response) - err := c.cc.Invoke(ctx, Stacks_OpenStackConfiguration_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) CloseStackConfiguration(ctx context.Context, in *CloseStackConfiguration_Request, opts ...grpc.CallOption) (*CloseStackConfiguration_Response, error) { - out := new(CloseStackConfiguration_Response) - err := c.cc.Invoke(ctx, Stacks_CloseStackConfiguration_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) ValidateStackConfiguration(ctx context.Context, in *ValidateStackConfiguration_Request, opts ...grpc.CallOption) (*ValidateStackConfiguration_Response, error) { - out := new(ValidateStackConfiguration_Response) - err := c.cc.Invoke(ctx, Stacks_ValidateStackConfiguration_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) FindStackConfigurationComponents(ctx context.Context, in *FindStackConfigurationComponents_Request, opts ...grpc.CallOption) (*FindStackConfigurationComponents_Response, error) { - out := new(FindStackConfigurationComponents_Response) - err := c.cc.Invoke(ctx, Stacks_FindStackConfigurationComponents_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) OpenState(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenStateClient, error) { - stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[0], Stacks_OpenState_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &stacksOpenStateClient{stream} - return x, nil -} - -type Stacks_OpenStateClient interface { - Send(*OpenStackState_RequestItem) error - CloseAndRecv() (*OpenStackState_Response, error) - grpc.ClientStream -} - -type stacksOpenStateClient struct { - grpc.ClientStream -} - -func (x *stacksOpenStateClient) Send(m *OpenStackState_RequestItem) error { - return x.ClientStream.SendMsg(m) -} - -func (x *stacksOpenStateClient) CloseAndRecv() (*OpenStackState_Response, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(OpenStackState_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) CloseState(ctx context.Context, in *CloseStackState_Request, opts ...grpc.CallOption) (*CloseStackState_Response, error) { - out := new(CloseStackState_Response) - err := c.cc.Invoke(ctx, Stacks_CloseState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) PlanStackChanges(ctx context.Context, in *PlanStackChanges_Request, opts ...grpc.CallOption) (Stacks_PlanStackChangesClient, error) { - stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[1], Stacks_PlanStackChanges_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &stacksPlanStackChangesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Stacks_PlanStackChangesClient interface { - Recv() (*PlanStackChanges_Event, error) - grpc.ClientStream -} - -type stacksPlanStackChangesClient struct { - grpc.ClientStream -} - -func (x *stacksPlanStackChangesClient) Recv() (*PlanStackChanges_Event, error) { - m := new(PlanStackChanges_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) OpenPlan(ctx context.Context, opts ...grpc.CallOption) (Stacks_OpenPlanClient, error) { - stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[2], Stacks_OpenPlan_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &stacksOpenPlanClient{stream} - return x, nil -} - -type Stacks_OpenPlanClient interface { - Send(*OpenStackPlan_RequestItem) error - CloseAndRecv() (*OpenStackPlan_Response, error) - grpc.ClientStream -} - -type stacksOpenPlanClient struct { - grpc.ClientStream -} - -func (x *stacksOpenPlanClient) Send(m *OpenStackPlan_RequestItem) error { - return x.ClientStream.SendMsg(m) -} - -func (x *stacksOpenPlanClient) CloseAndRecv() (*OpenStackPlan_Response, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(OpenStackPlan_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) ClosePlan(ctx context.Context, in *CloseStackPlan_Request, opts ...grpc.CallOption) (*CloseStackPlan_Response, error) { - out := new(CloseStackPlan_Response) - err := c.cc.Invoke(ctx, Stacks_ClosePlan_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) ApplyStackChanges(ctx context.Context, in *ApplyStackChanges_Request, opts ...grpc.CallOption) (Stacks_ApplyStackChangesClient, error) { - stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[3], Stacks_ApplyStackChanges_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &stacksApplyStackChangesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Stacks_ApplyStackChangesClient interface { - Recv() (*ApplyStackChanges_Event, error) - grpc.ClientStream -} - -type stacksApplyStackChangesClient struct { - grpc.ClientStream -} - -func (x *stacksApplyStackChangesClient) Recv() (*ApplyStackChanges_Event, error) { - m := new(ApplyStackChanges_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) OpenStackInspector(ctx context.Context, in *OpenStackInspector_Request, opts ...grpc.CallOption) (*OpenStackInspector_Response, error) { - out := new(OpenStackInspector_Response) - err := c.cc.Invoke(ctx, Stacks_OpenStackInspector_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) InspectExpressionResult(ctx context.Context, in *InspectExpressionResult_Request, opts ...grpc.CallOption) (*InspectExpressionResult_Response, error) { - out := new(InspectExpressionResult_Response) - err := c.cc.Invoke(ctx, Stacks_InspectExpressionResult_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) OpenTerraformState(ctx context.Context, in *OpenTerraformState_Request, opts ...grpc.CallOption) (*OpenTerraformState_Response, error) { - out := new(OpenTerraformState_Response) - err := c.cc.Invoke(ctx, Stacks_OpenTerraformState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) CloseTerraformState(ctx context.Context, in *CloseTerraformState_Request, opts ...grpc.CallOption) (*CloseTerraformState_Response, error) { - out := new(CloseTerraformState_Response) - err := c.cc.Invoke(ctx, Stacks_CloseTerraformState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *stacksClient) MigrateTerraformState(ctx context.Context, in *MigrateTerraformState_Request, opts ...grpc.CallOption) (Stacks_MigrateTerraformStateClient, error) { - stream, err := c.cc.NewStream(ctx, &Stacks_ServiceDesc.Streams[4], Stacks_MigrateTerraformState_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &stacksMigrateTerraformStateClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Stacks_MigrateTerraformStateClient interface { - Recv() (*MigrateTerraformState_Event, error) - grpc.ClientStream -} - -type stacksMigrateTerraformStateClient struct { - grpc.ClientStream -} - -func (x *stacksMigrateTerraformStateClient) Recv() (*MigrateTerraformState_Event, error) { - m := new(MigrateTerraformState_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *stacksClient) ListResourceIdentities(ctx context.Context, in *ListResourceIdentities_Request, opts ...grpc.CallOption) (*ListResourceIdentities_Response, error) { - out := new(ListResourceIdentities_Response) - err := c.cc.Invoke(ctx, Stacks_ListResourceIdentities_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// StacksServer is the server API for Stacks service. -// All implementations should embed UnimplementedStacksServer -// for forward compatibility -type StacksServer interface { - // Load and perform initial static validation of a stack configuration - // in a previously-opened source bundle. If successful, returns a - // stack configuration handle that can be used with other operations. - OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) - // Close a previously-opened stack configuration using its handle. - CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) - // Validate an open stack configuration. - ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) - // Analyze a stack configuration to find all of the components it declares. - // This is static analysis only, so it cannot produce dynamic information - // such as the number of instances of each component. - FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) - // Load a stack state by sending a stream of raw state objects that were - // streamed from a previous ApplyStackChanges response. - OpenState(Stacks_OpenStateServer) error - // Close a stack state handle, discarding the associated state. - CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) - // Calculate a desired state from the given configuration and compare it - // with the current state to propose a set of changes to converge the - // current state with the desired state, at least in part. - PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error - // Load a previously-created plan by sending a stream of raw change objects - // that were streamed from a previous PlanStackChanges response. - OpenPlan(Stacks_OpenPlanServer) error - // Close a saved plan handle, discarding the associated saved plan. - ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) - // Execute the changes proposed by an earlier call to PlanStackChanges. - ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error - // OpenStackInspector creates a stack inspector handle that can be used - // with subsequent calls to the "Inspect"-prefixed functions. - OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) - // InspectExpressionResult evaluates an arbitrary expression in the context - // of a stack inspector handle. - InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) - // Open a previously-saved Terraform state, returning a handle that can be - // used with other operations. This is distinct from OpenState because it - // means core state rather than stack state. - OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) - // Close a previously-opened Terraform state using its handle. - CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) - // MigrateTerraformState migrates a Terraform state into Stacks state using - // a mapping of addresses. - MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error - // ListResourceIdentities lists the identities of all resources in a stack. - ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) -} - -// UnimplementedStacksServer should be embedded to have forward compatible implementations. -type UnimplementedStacksServer struct { -} - -func (UnimplementedStacksServer) OpenStackConfiguration(context.Context, *OpenStackConfiguration_Request) (*OpenStackConfiguration_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenStackConfiguration not implemented") -} -func (UnimplementedStacksServer) CloseStackConfiguration(context.Context, *CloseStackConfiguration_Request) (*CloseStackConfiguration_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseStackConfiguration not implemented") -} -func (UnimplementedStacksServer) ValidateStackConfiguration(context.Context, *ValidateStackConfiguration_Request) (*ValidateStackConfiguration_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateStackConfiguration not implemented") -} -func (UnimplementedStacksServer) FindStackConfigurationComponents(context.Context, *FindStackConfigurationComponents_Request) (*FindStackConfigurationComponents_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method FindStackConfigurationComponents not implemented") -} -func (UnimplementedStacksServer) OpenState(Stacks_OpenStateServer) error { - return status.Errorf(codes.Unimplemented, "method OpenState not implemented") -} -func (UnimplementedStacksServer) CloseState(context.Context, *CloseStackState_Request) (*CloseStackState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseState not implemented") -} -func (UnimplementedStacksServer) PlanStackChanges(*PlanStackChanges_Request, Stacks_PlanStackChangesServer) error { - return status.Errorf(codes.Unimplemented, "method PlanStackChanges not implemented") -} -func (UnimplementedStacksServer) OpenPlan(Stacks_OpenPlanServer) error { - return status.Errorf(codes.Unimplemented, "method OpenPlan not implemented") -} -func (UnimplementedStacksServer) ClosePlan(context.Context, *CloseStackPlan_Request) (*CloseStackPlan_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClosePlan not implemented") -} -func (UnimplementedStacksServer) ApplyStackChanges(*ApplyStackChanges_Request, Stacks_ApplyStackChangesServer) error { - return status.Errorf(codes.Unimplemented, "method ApplyStackChanges not implemented") -} -func (UnimplementedStacksServer) OpenStackInspector(context.Context, *OpenStackInspector_Request) (*OpenStackInspector_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenStackInspector not implemented") -} -func (UnimplementedStacksServer) InspectExpressionResult(context.Context, *InspectExpressionResult_Request) (*InspectExpressionResult_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method InspectExpressionResult not implemented") -} -func (UnimplementedStacksServer) OpenTerraformState(context.Context, *OpenTerraformState_Request) (*OpenTerraformState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenTerraformState not implemented") -} -func (UnimplementedStacksServer) CloseTerraformState(context.Context, *CloseTerraformState_Request) (*CloseTerraformState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseTerraformState not implemented") -} -func (UnimplementedStacksServer) MigrateTerraformState(*MigrateTerraformState_Request, Stacks_MigrateTerraformStateServer) error { - return status.Errorf(codes.Unimplemented, "method MigrateTerraformState not implemented") -} -func (UnimplementedStacksServer) ListResourceIdentities(context.Context, *ListResourceIdentities_Request) (*ListResourceIdentities_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListResourceIdentities not implemented") -} - -// UnsafeStacksServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to StacksServer will -// result in compilation errors. -type UnsafeStacksServer interface { - mustEmbedUnimplementedStacksServer() -} - -func RegisterStacksServer(s grpc.ServiceRegistrar, srv StacksServer) { - s.RegisterService(&Stacks_ServiceDesc, srv) -} - -func _Stacks_OpenStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenStackConfiguration_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).OpenStackConfiguration(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_OpenStackConfiguration_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).OpenStackConfiguration(ctx, req.(*OpenStackConfiguration_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_CloseStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStackConfiguration_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).CloseStackConfiguration(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_CloseStackConfiguration_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).CloseStackConfiguration(ctx, req.(*CloseStackConfiguration_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_ValidateStackConfiguration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateStackConfiguration_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).ValidateStackConfiguration(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_ValidateStackConfiguration_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).ValidateStackConfiguration(ctx, req.(*ValidateStackConfiguration_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_FindStackConfigurationComponents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FindStackConfigurationComponents_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).FindStackConfigurationComponents(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_FindStackConfigurationComponents_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).FindStackConfigurationComponents(ctx, req.(*FindStackConfigurationComponents_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_OpenState_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(StacksServer).OpenState(&stacksOpenStateServer{stream}) -} - -type Stacks_OpenStateServer interface { - SendAndClose(*OpenStackState_Response) error - Recv() (*OpenStackState_RequestItem, error) - grpc.ServerStream -} - -type stacksOpenStateServer struct { - grpc.ServerStream -} - -func (x *stacksOpenStateServer) SendAndClose(m *OpenStackState_Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *stacksOpenStateServer) Recv() (*OpenStackState_RequestItem, error) { - m := new(OpenStackState_RequestItem) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Stacks_CloseState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStackState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).CloseState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_CloseState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).CloseState(ctx, req.(*CloseStackState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_PlanStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(PlanStackChanges_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(StacksServer).PlanStackChanges(m, &stacksPlanStackChangesServer{stream}) -} - -type Stacks_PlanStackChangesServer interface { - Send(*PlanStackChanges_Event) error - grpc.ServerStream -} - -type stacksPlanStackChangesServer struct { - grpc.ServerStream -} - -func (x *stacksPlanStackChangesServer) Send(m *PlanStackChanges_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Stacks_OpenPlan_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(StacksServer).OpenPlan(&stacksOpenPlanServer{stream}) -} - -type Stacks_OpenPlanServer interface { - SendAndClose(*OpenStackPlan_Response) error - Recv() (*OpenStackPlan_RequestItem, error) - grpc.ServerStream -} - -type stacksOpenPlanServer struct { - grpc.ServerStream -} - -func (x *stacksOpenPlanServer) SendAndClose(m *OpenStackPlan_Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *stacksOpenPlanServer) Recv() (*OpenStackPlan_RequestItem, error) { - m := new(OpenStackPlan_RequestItem) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Stacks_ClosePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseStackPlan_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).ClosePlan(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_ClosePlan_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).ClosePlan(ctx, req.(*CloseStackPlan_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_ApplyStackChanges_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ApplyStackChanges_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(StacksServer).ApplyStackChanges(m, &stacksApplyStackChangesServer{stream}) -} - -type Stacks_ApplyStackChangesServer interface { - Send(*ApplyStackChanges_Event) error - grpc.ServerStream -} - -type stacksApplyStackChangesServer struct { - grpc.ServerStream -} - -func (x *stacksApplyStackChangesServer) Send(m *ApplyStackChanges_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Stacks_OpenStackInspector_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenStackInspector_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).OpenStackInspector(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_OpenStackInspector_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).OpenStackInspector(ctx, req.(*OpenStackInspector_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_InspectExpressionResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(InspectExpressionResult_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).InspectExpressionResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_InspectExpressionResult_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).InspectExpressionResult(ctx, req.(*InspectExpressionResult_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_OpenTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenTerraformState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).OpenTerraformState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_OpenTerraformState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).OpenTerraformState(ctx, req.(*OpenTerraformState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_CloseTerraformState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseTerraformState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).CloseTerraformState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_CloseTerraformState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).CloseTerraformState(ctx, req.(*CloseTerraformState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Stacks_MigrateTerraformState_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(MigrateTerraformState_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(StacksServer).MigrateTerraformState(m, &stacksMigrateTerraformStateServer{stream}) -} - -type Stacks_MigrateTerraformStateServer interface { - Send(*MigrateTerraformState_Event) error - grpc.ServerStream -} - -type stacksMigrateTerraformStateServer struct { - grpc.ServerStream -} - -func (x *stacksMigrateTerraformStateServer) Send(m *MigrateTerraformState_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Stacks_ListResourceIdentities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListResourceIdentities_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StacksServer).ListResourceIdentities(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Stacks_ListResourceIdentities_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StacksServer).ListResourceIdentities(ctx, req.(*ListResourceIdentities_Request)) - } - return interceptor(ctx, in, info, handler) -} - -// Stacks_ServiceDesc is the grpc.ServiceDesc for Stacks service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Stacks_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "terraform1.stacks.Stacks", - HandlerType: (*StacksServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "OpenStackConfiguration", - Handler: _Stacks_OpenStackConfiguration_Handler, - }, - { - MethodName: "CloseStackConfiguration", - Handler: _Stacks_CloseStackConfiguration_Handler, - }, - { - MethodName: "ValidateStackConfiguration", - Handler: _Stacks_ValidateStackConfiguration_Handler, - }, - { - MethodName: "FindStackConfigurationComponents", - Handler: _Stacks_FindStackConfigurationComponents_Handler, - }, - { - MethodName: "CloseState", - Handler: _Stacks_CloseState_Handler, - }, - { - MethodName: "ClosePlan", - Handler: _Stacks_ClosePlan_Handler, - }, - { - MethodName: "OpenStackInspector", - Handler: _Stacks_OpenStackInspector_Handler, - }, - { - MethodName: "InspectExpressionResult", - Handler: _Stacks_InspectExpressionResult_Handler, - }, - { - MethodName: "OpenTerraformState", - Handler: _Stacks_OpenTerraformState_Handler, - }, - { - MethodName: "CloseTerraformState", - Handler: _Stacks_CloseTerraformState_Handler, - }, - { - MethodName: "ListResourceIdentities", - Handler: _Stacks_ListResourceIdentities_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "OpenState", - Handler: _Stacks_OpenState_Handler, - ClientStreams: true, - }, - { - StreamName: "PlanStackChanges", - Handler: _Stacks_PlanStackChanges_Handler, - ServerStreams: true, - }, - { - StreamName: "OpenPlan", - Handler: _Stacks_OpenPlan_Handler, - ClientStreams: true, - }, - { - StreamName: "ApplyStackChanges", - Handler: _Stacks_ApplyStackChanges_Handler, - ServerStreams: true, - }, - { - StreamName: "MigrateTerraformState", - Handler: _Stacks_MigrateTerraformState_Handler, - ServerStreams: true, - }, - }, - Metadata: "stacks.proto", -} diff --git a/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go b/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go index 0184bedcd64a..e351b421cad0 100644 --- a/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go +++ b/internal/stacks/stackruntime/internal/stackeval/stubs/errored.go @@ -276,34 +276,6 @@ func (p *erroredProvider) ConfigureStateStore(providers.ConfigureStateStoreReque } } -// ReadStateBytes implements providers.Interface. -func (p *erroredProvider) ReadStateBytes(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - var diags tfdiags.Diagnostics - diags = diags.Append(tfdiags.AttributeValue( - tfdiags.Error, - "Provider configuration is invalid", - "Cannot read state managed by this state store because its associated provider configuration is invalid.", - nil, // nil attribute path means the overall configuration block - )) - return providers.ReadStateBytesResponse{ - Diagnostics: diags, - } -} - -// WriteStateBytes implements providers.Interface. -func (p *erroredProvider) WriteStateBytes(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - var diags tfdiags.Diagnostics - diags = diags.Append(tfdiags.AttributeValue( - tfdiags.Error, - "Provider configuration is invalid", - "Cannot write state managed by this state store because its associated provider configuration is invalid.", - nil, // nil attribute path means the overall configuration block - )) - return providers.WriteStateBytesResponse{ - Diagnostics: diags, - } -} - // GetStates implements providers.Interface. func (p *erroredProvider) GetStates(providers.GetStatesRequest) providers.GetStatesResponse { var diags tfdiags.Diagnostics diff --git a/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go b/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go index 4235f1743d71..d4dd73c4e05e 100644 --- a/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go +++ b/internal/stacks/stackruntime/internal/stackeval/stubs/offline.go @@ -293,34 +293,6 @@ func (o *offlineProvider) ConfigureStateStore(providers.ConfigureStateStoreReque } } -// ReadStateBytes implements providers.Interface. -func (o *offlineProvider) ReadStateBytes(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - var diags tfdiags.Diagnostics - diags = diags.Append(tfdiags.AttributeValue( - tfdiags.Error, - "Called ReadStateBytes on an unconfigured provider", - "Cannot read from state store because this provider is not configured. This is a bug in Terraform - please report it.", - nil, // nil attribute path means the overall configuration block - )) - return providers.ReadStateBytesResponse{ - Diagnostics: diags, - } -} - -// WriteStateBytes implements providers.Interface. -func (o *offlineProvider) WriteStateBytes(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - var diags tfdiags.Diagnostics - diags = diags.Append(tfdiags.AttributeValue( - tfdiags.Error, - "Called WriteStateBytes on an unconfigured provider", - "Cannot write to state store because this provider is not configured. This is a bug in Terraform - please report it.", - nil, // nil attribute path means the overall configuration block - )) - return providers.WriteStateBytesResponse{ - Diagnostics: diags, - } -} - // GetStates implements providers.Interface. func (o *offlineProvider) GetStates(providers.GetStatesRequest) providers.GetStatesResponse { var diags tfdiags.Diagnostics diff --git a/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go b/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go index 42995611836a..34f6c763b81e 100644 --- a/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go +++ b/internal/stacks/stackruntime/internal/stackeval/stubs/unknown.go @@ -341,34 +341,6 @@ func (u *unknownProvider) ConfigureStateStore(providers.ConfigureStateStoreReque } } -// ReadStateBytes implements providers.Interface. -func (u *unknownProvider) ReadStateBytes(providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { - var diags tfdiags.Diagnostics - diags = diags.Append(tfdiags.AttributeValue( - tfdiags.Error, - "Provider configuration is unknown", - "Cannot read from this state store because its associated provider configuration is unknown.", - nil, // nil attribute path means the overall configuration block - )) - return providers.ReadStateBytesResponse{ - Diagnostics: diags, - } -} - -// WriteStateBytes implements providers.Interface. -func (u *unknownProvider) WriteStateBytes(providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { - var diags tfdiags.Diagnostics - diags = diags.Append(tfdiags.AttributeValue( - tfdiags.Error, - "Provider configuration is unknown", - "Cannot write to this state store because its associated provider configuration is unknown.", - nil, // nil attribute path means the overall configuration block - )) - return providers.WriteStateBytesResponse{ - Diagnostics: diags, - } -} - // GetStates implements providers.Interface. func (u *unknownProvider) GetStates(providers.GetStatesRequest) providers.GetStatesResponse { var diags tfdiags.Diagnostics diff --git a/internal/stacksplugin/stacksproto1/stacksproto1.pb.go b/internal/stacksplugin/stacksproto1/stacksproto1.pb.go index 786b85c6f50f..88f2717fa3f0 100644 --- a/internal/stacksplugin/stacksproto1/stacksproto1.pb.go +++ b/internal/stacksplugin/stacksproto1/stacksproto1.pb.go @@ -10,6 +10,10 @@ package stacksproto1 import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -267,3 +271,112 @@ func file_stacksproto1_proto_init() { file_stacksproto1_proto_goTypes = nil file_stacksproto1_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// CommandServiceClient is the client API for CommandService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type CommandServiceClient interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) +} + +type commandServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { + return &commandServiceClient{cc} +} + +func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { + stream, err := c.cc.NewStream(ctx, &_CommandService_serviceDesc.Streams[0], "/stacksproto1.CommandService/Execute", opts...) + if err != nil { + return nil, err + } + x := &commandServiceExecuteClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type CommandService_ExecuteClient interface { + Recv() (*CommandResponse, error) + grpc.ClientStream +} + +type commandServiceExecuteClient struct { + grpc.ClientStream +} + +func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { + m := new(CommandResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// CommandServiceServer is the server API for CommandService service. +type CommandServiceServer interface { + // Execute runs a specific command with the provided flags and returns the result. + Execute(*CommandRequest, CommandService_ExecuteServer) error +} + +// UnimplementedCommandServiceServer can be embedded to have forward compatible implementations. +type UnimplementedCommandServiceServer struct { +} + +func (*UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { + return status.Errorf(codes.Unimplemented, "method Execute not implemented") +} + +func RegisterCommandServiceServer(s *grpc.Server, srv CommandServiceServer) { + s.RegisterService(&_CommandService_serviceDesc, srv) +} + +func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(CommandRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) +} + +type CommandService_ExecuteServer interface { + Send(*CommandResponse) error + grpc.ServerStream +} + +type commandServiceExecuteServer struct { + grpc.ServerStream +} + +func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { + return x.ServerStream.SendMsg(m) +} + +var _CommandService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "stacksproto1.CommandService", + HandlerType: (*CommandServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Execute", + Handler: _CommandService_Execute_Handler, + ServerStreams: true, + }, + }, + Metadata: "stacksproto1.proto", +} diff --git a/internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go b/internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go deleted file mode 100644 index 9996d19e0e3e..000000000000 --- a/internal/stacksplugin/stacksproto1/stacksproto1_grpc.pb.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: BUSL-1.1 - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: stacksproto1.proto - -package stacksproto1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - CommandService_Execute_FullMethodName = "/stacksproto1.CommandService/Execute" -) - -// CommandServiceClient is the client API for CommandService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type CommandServiceClient interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) -} - -type commandServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewCommandServiceClient(cc grpc.ClientConnInterface) CommandServiceClient { - return &commandServiceClient{cc} -} - -func (c *commandServiceClient) Execute(ctx context.Context, in *CommandRequest, opts ...grpc.CallOption) (CommandService_ExecuteClient, error) { - stream, err := c.cc.NewStream(ctx, &CommandService_ServiceDesc.Streams[0], CommandService_Execute_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &commandServiceExecuteClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type CommandService_ExecuteClient interface { - Recv() (*CommandResponse, error) - grpc.ClientStream -} - -type commandServiceExecuteClient struct { - grpc.ClientStream -} - -func (x *commandServiceExecuteClient) Recv() (*CommandResponse, error) { - m := new(CommandResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// CommandServiceServer is the server API for CommandService service. -// All implementations should embed UnimplementedCommandServiceServer -// for forward compatibility -type CommandServiceServer interface { - // Execute runs a specific command with the provided flags and returns the result. - Execute(*CommandRequest, CommandService_ExecuteServer) error -} - -// UnimplementedCommandServiceServer should be embedded to have forward compatible implementations. -type UnimplementedCommandServiceServer struct { -} - -func (UnimplementedCommandServiceServer) Execute(*CommandRequest, CommandService_ExecuteServer) error { - return status.Errorf(codes.Unimplemented, "method Execute not implemented") -} - -// UnsafeCommandServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CommandServiceServer will -// result in compilation errors. -type UnsafeCommandServiceServer interface { - mustEmbedUnimplementedCommandServiceServer() -} - -func RegisterCommandServiceServer(s grpc.ServiceRegistrar, srv CommandServiceServer) { - s.RegisterService(&CommandService_ServiceDesc, srv) -} - -func _CommandService_Execute_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(CommandRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(CommandServiceServer).Execute(m, &commandServiceExecuteServer{stream}) -} - -type CommandService_ExecuteServer interface { - Send(*CommandResponse) error - grpc.ServerStream -} - -type commandServiceExecuteServer struct { - grpc.ServerStream -} - -func (x *commandServiceExecuteServer) Send(m *CommandResponse) error { - return x.ServerStream.SendMsg(m) -} - -// CommandService_ServiceDesc is the grpc.ServiceDesc for CommandService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var CommandService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "stacksproto1.CommandService", - HandlerType: (*CommandServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Execute", - Handler: _CommandService_Execute_Handler, - ServerStreams: true, - }, - }, - Metadata: "stacksproto1.proto", -} diff --git a/internal/terraform/context_apply_action_test.go b/internal/terraform/context_apply_action_test.go index ee15c7a3c887..454e7d2f04bd 100644 --- a/internal/terraform/context_apply_action_test.go +++ b/internal/terraform/context_apply_action_test.go @@ -1852,46 +1852,6 @@ resource "test_object" "a" { }, expectInvokeActionCalled: true, }, - "referencing triggering resource in after_* condition": { - module: map[string]string{ - "main.tf": ` -action "action_example" "hello" { - config { - attr = "hello" - } -} -action "action_example" "world" { - config { - attr = "world" - } -} -resource "test_object" "a" { - name = "foo" - lifecycle { - action_trigger { - events = [after_create] - condition = test_object.a.name == "foo" - actions = [action.action_example.hello] - } - action_trigger { - events = [after_update] - condition = test_object.a.name == "bar" - actions = [action.action_example.world] - } - } -} -`, - }, - expectInvokeActionCalled: true, - expectInvokeActionCalls: []providers.InvokeActionRequest{ - { - ActionType: "action_example", - PlannedActionData: cty.ObjectVal(map[string]cty.Value{ - "attr": cty.StringVal("hello"), - }), - }, - }, - }, "multiple events triggering in same action trigger": { module: map[string]string{ "main.tf": ` diff --git a/internal/terraform/context_plan_actions_test.go b/internal/terraform/context_plan_actions_test.go index 2dfd0854c196..9cfd603da8a3 100644 --- a/internal/terraform/context_plan_actions_test.go +++ b/internal/terraform/context_plan_actions_test.go @@ -2954,73 +2954,6 @@ resource "test_object" "a" { }, }, - "referencing triggering resource in before_* condition": { - module: map[string]string{ - "main.tf": ` -action "test_action" "hello" {} -action "test_action" "world" {} -resource "test_object" "a" { - name = "foo" - lifecycle { - action_trigger { - events = [before_create] - condition = test_object.a.name == "foo" - actions = [action.test_action.hello] - } - action_trigger { - events = [before_update] - condition = test_object.a.name == "bar" - actions = [action.test_action.world] - } - } -} -`, - }, - expectPlanActionCalled: true, - - assertPlanDiagnostics: func(t *testing.T, diags tfdiags.Diagnostics) { - if !diags.HasErrors() { - t.Errorf("expected errors, got none") - } - - err := diags.Err().Error() - if !strings.Contains(err, "Cycle:") || !strings.Contains(err, "action.test_action.hello") || !strings.Contains(err, "test_object.a") { - t.Fatalf("Expected '[Error] Cycle: action.test_action.hello (instance), test_object.a', got '%s'", err) - } - }, - }, - - "referencing triggering resource in after_* condition": { - module: map[string]string{ - "main.tf": ` -action "test_action" "hello" {} -action "test_action" "world" {} -resource "test_object" "a" { - name = "foo" - lifecycle { - action_trigger { - events = [after_create] - condition = test_object.a.name == "foo" - actions = [action.test_action.hello] - } - action_trigger { - events = [after_update] - condition = test_object.a.name == "bar" - actions = [action.test_action.world] - } - } -} -`, - }, - expectPlanActionCalled: true, - - assertPlan: func(t *testing.T, p *plans.Plan) { - if len(p.Changes.ActionInvocations) != 1 { - t.Errorf("expected 1 action invocation, got %d", len(p.Changes.ActionInvocations)) - } - }, - }, - "using each in before_* condition": { module: map[string]string{ "main.tf": ` diff --git a/internal/terraform/context_plan_query_test.go b/internal/terraform/context_plan_query_test.go index 9c2b9e14696c..75b016003fe1 100644 --- a/internal/terraform/context_plan_query_test.go +++ b/internal/terraform/context_plan_query_test.go @@ -30,7 +30,10 @@ func TestContext2Plan_queryList(t *testing.T) { instanceTypes := []string{"ami-123456", "ami-654321", "ami-789012"} madeUp := []cty.Value{} for i := range len(instanceTypes) { - madeUp = append(madeUp, cty.ObjectVal(map[string]cty.Value{"instance_type": cty.StringVal(instanceTypes[i])})) + madeUp = append(madeUp, cty.ObjectVal(map[string]cty.Value{ + "instance_type": cty.StringVal(instanceTypes[i]), + "id": cty.StringVal(fmt.Sprint(i)), + })) } ids := []cty.Value{} @@ -1004,6 +1007,10 @@ func getListProviderSchemaResp() *providers.GetProviderSchemaResponse { Computed: true, Optional: true, }, + "id": { + Type: cty.String, + Computed: true, + }, }, }, "test_child_resource": { diff --git a/internal/terraform/node_resource_plan_instance.go b/internal/terraform/node_resource_plan_instance.go index e4fd8e059d7e..4dec19172fa1 100644 --- a/internal/terraform/node_resource_plan_instance.go +++ b/internal/terraform/node_resource_plan_instance.go @@ -977,10 +977,17 @@ func (n *NodePlannableResourceInstance) generateResourceConfig(ctx EvalContext, if diags.HasErrors() { return cty.DynamicVal, diags } - schema := providerSchema.SchemaForResourceAddr(n.Addr.Resource.Resource) + + // the calling node may be a list resource, in which case we still need to + // lookup the schema for the corresponding managed resource for generating + // configuration. + managedAddr := n.Addr.Resource.Resource + managedAddr.Mode = addrs.ManagedResourceMode + + schema := providerSchema.SchemaForResourceAddr(managedAddr) if schema.Body == nil { // Should be caught during validation, so we don't bother with a pretty error here - diags = diags.Append(fmt.Errorf("provider does not support resource type for %q", n.Addr)) + diags = diags.Append(fmt.Errorf("provider does not support resource type for %q", managedAddr)) return cty.DynamicVal, diags } diff --git a/internal/tfplugin5/tfplugin5.pb.go b/internal/tfplugin5/tfplugin5.pb.go index 85e273150051..151e1376a840 100644 --- a/internal/tfplugin5/tfplugin5.pb.go +++ b/internal/tfplugin5/tfplugin5.pb.go @@ -28,6 +28,10 @@ package tfplugin5 import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" @@ -7845,3 +7849,1356 @@ func file_tfplugin5_proto_init() { file_tfplugin5_proto_goTypes = nil file_tfplugin5_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ProviderClient is the client API for Provider service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ProviderClient interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) + PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) + ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) + ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) + UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) + PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) + ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) + ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) + MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) + ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) + GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) + ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) + // ////// Actions + PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) + InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) + ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) +} + +type providerClient struct { + cc grpc.ClientConnInterface +} + +func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { + return &providerClient{cc} +} + +func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { + out := new(GetMetadata_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetMetadata", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { + out := new(GetProviderSchema_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetSchema", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) { + out := new(PrepareProviderConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/PrepareProviderConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) { + out := new(ValidateResourceTypeConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateResourceTypeConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) { + out := new(ValidateDataSourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateDataSourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { + out := new(UpgradeResourceState_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/UpgradeResourceState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { + out := new(GetResourceIdentitySchemas_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetResourceIdentitySchemas", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { + out := new(UpgradeResourceIdentity_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/UpgradeResourceIdentity", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) { + out := new(Configure_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/Configure", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { + out := new(ReadResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ReadResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { + out := new(PlanResourceChange_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/PlanResourceChange", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { + out := new(ApplyResourceChange_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ApplyResourceChange", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { + out := new(ImportResourceState_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ImportResourceState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { + out := new(MoveResourceState_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/MoveResourceState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { + out := new(ReadDataSource_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ReadDataSource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { + out := new(GenerateResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GenerateResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { + out := new(ValidateEphemeralResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateEphemeralResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { + out := new(OpenEphemeralResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/OpenEphemeralResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { + out := new(RenewEphemeralResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/RenewEphemeralResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { + out := new(CloseEphemeralResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/CloseEphemeralResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { + stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[0], "/tfplugin5.Provider/ListResource", opts...) + if err != nil { + return nil, err + } + x := &providerListResourceClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_ListResourceClient interface { + Recv() (*ListResource_Event, error) + grpc.ClientStream +} + +type providerListResourceClient struct { + grpc.ClientStream +} + +func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { + m := new(ListResource_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { + out := new(ValidateListResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateListResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { + out := new(GetFunctions_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/GetFunctions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { + out := new(CallFunction_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/CallFunction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { + out := new(PlanAction_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/PlanAction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { + stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[1], "/tfplugin5.Provider/InvokeAction", opts...) + if err != nil { + return nil, err + } + x := &providerInvokeActionClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_InvokeActionClient interface { + Recv() (*InvokeAction_Event, error) + grpc.ClientStream +} + +type providerInvokeActionClient struct { + grpc.ClientStream +} + +func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { + m := new(InvokeAction_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { + out := new(ValidateActionConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/ValidateActionConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { + out := new(Stop_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provider/Stop", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProviderServer is the server API for Provider service. +type ProviderServer interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) + PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) + ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) + ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) + UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + Configure(context.Context, *Configure_Request) (*Configure_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) + PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) + ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) + ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) + MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) + ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) + GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(*ListResource_Request, Provider_ListResourceServer) error + ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) + // ////// Actions + PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) + InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error + ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + Stop(context.Context, *Stop_Request) (*Stop_Response, error) +} + +// UnimplementedProviderServer can be embedded to have forward compatible implementations. +type UnimplementedProviderServer struct { +} + +func (*UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") +} +func (*UnimplementedProviderServer) GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (*UnimplementedProviderServer) PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PrepareProviderConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceTypeConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateDataSourceConfig not implemented") +} +func (*UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") +} +func (*UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") +} +func (*UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") +} +func (*UnimplementedProviderServer) Configure(context.Context, *Configure_Request) (*Configure_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") +} +func (*UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") +} +func (*UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") +} +func (*UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") +} +func (*UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") +} +func (*UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") +} +func (*UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") +} +func (*UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") +} +func (*UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") +} +func (*UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") +} +func (*UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") +} +func (*UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { + return status.Errorf(codes.Unimplemented, "method ListResource not implemented") +} +func (*UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") +} +func (*UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") +} +func (*UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") +} +func (*UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") +} +func (*UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { + return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") +} +func (*UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") +} +func (*UnimplementedProviderServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + +func RegisterProviderServer(s *grpc.Server, srv ProviderServer) { + s.RegisterService(&_Provider_serviceDesc, srv) +} + +func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMetadata_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/GetMetadata", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/GetSchema", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetSchema(ctx, req.(*GetProviderSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PrepareProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrepareProviderConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PrepareProviderConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/PrepareProviderConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PrepareProviderConfig(ctx, req.(*PrepareProviderConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateResourceTypeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateResourceTypeConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ValidateResourceTypeConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, req.(*ValidateResourceTypeConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateDataSourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateDataSourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateDataSourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ValidateDataSourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateDataSourceConfig(ctx, req.(*ValidateDataSourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/UpgradeResourceState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetResourceIdentitySchemas_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/GetResourceIdentitySchemas", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceIdentity_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/UpgradeResourceIdentity", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Configure_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).Configure(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/Configure", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).Configure(ctx, req.(*Configure_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ReadResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/PlanResourceChange", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ApplyResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ApplyResourceChange", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ImportResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ImportResourceState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MoveResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).MoveResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/MoveResourceState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadDataSource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadDataSource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ReadDataSource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GenerateResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/GenerateResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateEphemeralResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ValidateEphemeralResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).OpenEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/OpenEphemeralResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RenewEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).RenewEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/RenewEphemeralResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CloseEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/CloseEphemeralResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListResource_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) +} + +type Provider_ListResourceServer interface { + Send(*ListResource_Event) error + grpc.ServerStream +} + +type providerListResourceServer struct { + grpc.ServerStream +} + +func (x *providerListResourceServer) Send(m *ListResource_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateListResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ValidateListResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFunctions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetFunctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/GetFunctions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CallFunction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CallFunction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/CallFunction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanAction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanAction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/PlanAction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(InvokeAction_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) +} + +type Provider_InvokeActionServer interface { + Send(*InvokeAction_Event) error + grpc.ServerStream +} + +type providerInvokeActionServer struct { + grpc.ServerStream +} + +func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateActionConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateActionConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/ValidateActionConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Stop_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).Stop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provider/Stop", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).Stop(ctx, req.(*Stop_Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Provider_serviceDesc = grpc.ServiceDesc{ + ServiceName: "tfplugin5.Provider", + HandlerType: (*ProviderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetMetadata", + Handler: _Provider_GetMetadata_Handler, + }, + { + MethodName: "GetSchema", + Handler: _Provider_GetSchema_Handler, + }, + { + MethodName: "PrepareProviderConfig", + Handler: _Provider_PrepareProviderConfig_Handler, + }, + { + MethodName: "ValidateResourceTypeConfig", + Handler: _Provider_ValidateResourceTypeConfig_Handler, + }, + { + MethodName: "ValidateDataSourceConfig", + Handler: _Provider_ValidateDataSourceConfig_Handler, + }, + { + MethodName: "UpgradeResourceState", + Handler: _Provider_UpgradeResourceState_Handler, + }, + { + MethodName: "GetResourceIdentitySchemas", + Handler: _Provider_GetResourceIdentitySchemas_Handler, + }, + { + MethodName: "UpgradeResourceIdentity", + Handler: _Provider_UpgradeResourceIdentity_Handler, + }, + { + MethodName: "Configure", + Handler: _Provider_Configure_Handler, + }, + { + MethodName: "ReadResource", + Handler: _Provider_ReadResource_Handler, + }, + { + MethodName: "PlanResourceChange", + Handler: _Provider_PlanResourceChange_Handler, + }, + { + MethodName: "ApplyResourceChange", + Handler: _Provider_ApplyResourceChange_Handler, + }, + { + MethodName: "ImportResourceState", + Handler: _Provider_ImportResourceState_Handler, + }, + { + MethodName: "MoveResourceState", + Handler: _Provider_MoveResourceState_Handler, + }, + { + MethodName: "ReadDataSource", + Handler: _Provider_ReadDataSource_Handler, + }, + { + MethodName: "GenerateResourceConfig", + Handler: _Provider_GenerateResourceConfig_Handler, + }, + { + MethodName: "ValidateEphemeralResourceConfig", + Handler: _Provider_ValidateEphemeralResourceConfig_Handler, + }, + { + MethodName: "OpenEphemeralResource", + Handler: _Provider_OpenEphemeralResource_Handler, + }, + { + MethodName: "RenewEphemeralResource", + Handler: _Provider_RenewEphemeralResource_Handler, + }, + { + MethodName: "CloseEphemeralResource", + Handler: _Provider_CloseEphemeralResource_Handler, + }, + { + MethodName: "ValidateListResourceConfig", + Handler: _Provider_ValidateListResourceConfig_Handler, + }, + { + MethodName: "GetFunctions", + Handler: _Provider_GetFunctions_Handler, + }, + { + MethodName: "CallFunction", + Handler: _Provider_CallFunction_Handler, + }, + { + MethodName: "PlanAction", + Handler: _Provider_PlanAction_Handler, + }, + { + MethodName: "ValidateActionConfig", + Handler: _Provider_ValidateActionConfig_Handler, + }, + { + MethodName: "Stop", + Handler: _Provider_Stop_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListResource", + Handler: _Provider_ListResource_Handler, + ServerStreams: true, + }, + { + StreamName: "InvokeAction", + Handler: _Provider_InvokeAction_Handler, + ServerStreams: true, + }, + }, + Metadata: "tfplugin5.proto", +} + +// ProvisionerClient is the client API for Provisioner service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ProvisionerClient interface { + GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) + ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) + ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) + Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) +} + +type provisionerClient struct { + cc grpc.ClientConnInterface +} + +func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient { + return &provisionerClient{cc} +} + +func (c *provisionerClient) GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) { + out := new(GetProvisionerSchema_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provisioner/GetSchema", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionerClient) ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) { + out := new(ValidateProvisionerConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provisioner/ValidateProvisionerConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *provisionerClient) ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) { + stream, err := c.cc.NewStream(ctx, &_Provisioner_serviceDesc.Streams[0], "/tfplugin5.Provisioner/ProvisionResource", opts...) + if err != nil { + return nil, err + } + x := &provisionerProvisionResourceClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provisioner_ProvisionResourceClient interface { + Recv() (*ProvisionResource_Response, error) + grpc.ClientStream +} + +type provisionerProvisionResourceClient struct { + grpc.ClientStream +} + +func (x *provisionerProvisionResourceClient) Recv() (*ProvisionResource_Response, error) { + m := new(ProvisionResource_Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *provisionerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { + out := new(Stop_Response) + err := c.cc.Invoke(ctx, "/tfplugin5.Provisioner/Stop", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProvisionerServer is the server API for Provisioner service. +type ProvisionerServer interface { + GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) + ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) + ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error + Stop(context.Context, *Stop_Request) (*Stop_Response, error) +} + +// UnimplementedProvisionerServer can be embedded to have forward compatible implementations. +type UnimplementedProvisionerServer struct { +} + +func (*UnimplementedProvisionerServer) GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (*UnimplementedProvisionerServer) ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateProvisionerConfig not implemented") +} +func (*UnimplementedProvisionerServer) ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error { + return status.Errorf(codes.Unimplemented, "method ProvisionResource not implemented") +} +func (*UnimplementedProvisionerServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + +func RegisterProvisionerServer(s *grpc.Server, srv ProvisionerServer) { + s.RegisterService(&_Provisioner_serviceDesc, srv) +} + +func _Provisioner_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProvisionerSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).GetSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provisioner/GetSchema", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).GetSchema(ctx, req.(*GetProvisionerSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provisioner_ValidateProvisionerConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateProvisionerConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provisioner/ValidateProvisionerConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, req.(*ValidateProvisionerConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provisioner_ProvisionResource_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ProvisionResource_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProvisionerServer).ProvisionResource(m, &provisionerProvisionResourceServer{stream}) +} + +type Provisioner_ProvisionResourceServer interface { + Send(*ProvisionResource_Response) error + grpc.ServerStream +} + +type provisionerProvisionResourceServer struct { + grpc.ServerStream +} + +func (x *provisionerProvisionResourceServer) Send(m *ProvisionResource_Response) error { + return x.ServerStream.SendMsg(m) +} + +func _Provisioner_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Stop_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProvisionerServer).Stop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin5.Provisioner/Stop", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProvisionerServer).Stop(ctx, req.(*Stop_Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Provisioner_serviceDesc = grpc.ServiceDesc{ + ServiceName: "tfplugin5.Provisioner", + HandlerType: (*ProvisionerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetSchema", + Handler: _Provisioner_GetSchema_Handler, + }, + { + MethodName: "ValidateProvisionerConfig", + Handler: _Provisioner_ValidateProvisionerConfig_Handler, + }, + { + MethodName: "Stop", + Handler: _Provisioner_Stop_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ProvisionResource", + Handler: _Provisioner_ProvisionResource_Handler, + ServerStreams: true, + }, + }, + Metadata: "tfplugin5.proto", +} diff --git a/internal/tfplugin5/tfplugin5_grpc.pb.go b/internal/tfplugin5/tfplugin5_grpc.pb.go deleted file mode 100644 index d97317fd09b5..000000000000 --- a/internal/tfplugin5/tfplugin5_grpc.pb.go +++ /dev/null @@ -1,1447 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -// Terraform Plugin RPC protocol version 5.10 -// -// This file defines version 5.10 of the RPC protocol. To implement a plugin -// against this protocol, copy this definition into your own codebase and -// use protoc to generate stubs for your target language. -// -// Any minor versions of protocol 5 to follow should modify this file while -// maintaining backwards compatibility. Breaking changes, if any are required, -// will come in a subsequent major version with its own separate proto definition. -// -// Note that only the proto files included in a release tag of Terraform are -// official protocol releases. Proto files taken from other commits may include -// incomplete changes or features that did not make it into a final release. -// In all reasonable cases, plugin developers should take the proto file from -// the tag of the most recent release of Terraform, and not from the main -// branch or any other development branch. -// - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: tfplugin5.proto - -package tfplugin5 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Provider_GetMetadata_FullMethodName = "/tfplugin5.Provider/GetMetadata" - Provider_GetSchema_FullMethodName = "/tfplugin5.Provider/GetSchema" - Provider_PrepareProviderConfig_FullMethodName = "/tfplugin5.Provider/PrepareProviderConfig" - Provider_ValidateResourceTypeConfig_FullMethodName = "/tfplugin5.Provider/ValidateResourceTypeConfig" - Provider_ValidateDataSourceConfig_FullMethodName = "/tfplugin5.Provider/ValidateDataSourceConfig" - Provider_UpgradeResourceState_FullMethodName = "/tfplugin5.Provider/UpgradeResourceState" - Provider_GetResourceIdentitySchemas_FullMethodName = "/tfplugin5.Provider/GetResourceIdentitySchemas" - Provider_UpgradeResourceIdentity_FullMethodName = "/tfplugin5.Provider/UpgradeResourceIdentity" - Provider_Configure_FullMethodName = "/tfplugin5.Provider/Configure" - Provider_ReadResource_FullMethodName = "/tfplugin5.Provider/ReadResource" - Provider_PlanResourceChange_FullMethodName = "/tfplugin5.Provider/PlanResourceChange" - Provider_ApplyResourceChange_FullMethodName = "/tfplugin5.Provider/ApplyResourceChange" - Provider_ImportResourceState_FullMethodName = "/tfplugin5.Provider/ImportResourceState" - Provider_MoveResourceState_FullMethodName = "/tfplugin5.Provider/MoveResourceState" - Provider_ReadDataSource_FullMethodName = "/tfplugin5.Provider/ReadDataSource" - Provider_GenerateResourceConfig_FullMethodName = "/tfplugin5.Provider/GenerateResourceConfig" - Provider_ValidateEphemeralResourceConfig_FullMethodName = "/tfplugin5.Provider/ValidateEphemeralResourceConfig" - Provider_OpenEphemeralResource_FullMethodName = "/tfplugin5.Provider/OpenEphemeralResource" - Provider_RenewEphemeralResource_FullMethodName = "/tfplugin5.Provider/RenewEphemeralResource" - Provider_CloseEphemeralResource_FullMethodName = "/tfplugin5.Provider/CloseEphemeralResource" - Provider_ListResource_FullMethodName = "/tfplugin5.Provider/ListResource" - Provider_ValidateListResourceConfig_FullMethodName = "/tfplugin5.Provider/ValidateListResourceConfig" - Provider_GetFunctions_FullMethodName = "/tfplugin5.Provider/GetFunctions" - Provider_CallFunction_FullMethodName = "/tfplugin5.Provider/CallFunction" - Provider_PlanAction_FullMethodName = "/tfplugin5.Provider/PlanAction" - Provider_InvokeAction_FullMethodName = "/tfplugin5.Provider/InvokeAction" - Provider_ValidateActionConfig_FullMethodName = "/tfplugin5.Provider/ValidateActionConfig" - Provider_Stop_FullMethodName = "/tfplugin5.Provider/Stop" -) - -// ProviderClient is the client API for Provider service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ProviderClient interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) - PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) - ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) - ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) - UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) - PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) - ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) - ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) - MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) - ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) - GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) - ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) - // ////// Actions - PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) - InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) - ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) -} - -type providerClient struct { - cc grpc.ClientConnInterface -} - -func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { - return &providerClient{cc} -} - -func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { - out := new(GetMetadata_Response) - err := c.cc.Invoke(ctx, Provider_GetMetadata_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { - out := new(GetProviderSchema_Response) - err := c.cc.Invoke(ctx, Provider_GetSchema_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) { - out := new(PrepareProviderConfig_Response) - err := c.cc.Invoke(ctx, Provider_PrepareProviderConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) { - out := new(ValidateResourceTypeConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateResourceTypeConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) { - out := new(ValidateDataSourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateDataSourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { - out := new(UpgradeResourceState_Response) - err := c.cc.Invoke(ctx, Provider_UpgradeResourceState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { - out := new(GetResourceIdentitySchemas_Response) - err := c.cc.Invoke(ctx, Provider_GetResourceIdentitySchemas_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { - out := new(UpgradeResourceIdentity_Response) - err := c.cc.Invoke(ctx, Provider_UpgradeResourceIdentity_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) { - out := new(Configure_Response) - err := c.cc.Invoke(ctx, Provider_Configure_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { - out := new(ReadResource_Response) - err := c.cc.Invoke(ctx, Provider_ReadResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { - out := new(PlanResourceChange_Response) - err := c.cc.Invoke(ctx, Provider_PlanResourceChange_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { - out := new(ApplyResourceChange_Response) - err := c.cc.Invoke(ctx, Provider_ApplyResourceChange_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { - out := new(ImportResourceState_Response) - err := c.cc.Invoke(ctx, Provider_ImportResourceState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { - out := new(MoveResourceState_Response) - err := c.cc.Invoke(ctx, Provider_MoveResourceState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { - out := new(ReadDataSource_Response) - err := c.cc.Invoke(ctx, Provider_ReadDataSource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { - out := new(GenerateResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_GenerateResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { - out := new(ValidateEphemeralResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateEphemeralResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { - out := new(OpenEphemeralResource_Response) - err := c.cc.Invoke(ctx, Provider_OpenEphemeralResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { - out := new(RenewEphemeralResource_Response) - err := c.cc.Invoke(ctx, Provider_RenewEphemeralResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { - out := new(CloseEphemeralResource_Response) - err := c.cc.Invoke(ctx, Provider_CloseEphemeralResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { - stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[0], Provider_ListResource_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &providerListResourceClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_ListResourceClient interface { - Recv() (*ListResource_Event, error) - grpc.ClientStream -} - -type providerListResourceClient struct { - grpc.ClientStream -} - -func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { - m := new(ListResource_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { - out := new(ValidateListResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateListResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { - out := new(GetFunctions_Response) - err := c.cc.Invoke(ctx, Provider_GetFunctions_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { - out := new(CallFunction_Response) - err := c.cc.Invoke(ctx, Provider_CallFunction_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { - out := new(PlanAction_Response) - err := c.cc.Invoke(ctx, Provider_PlanAction_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { - stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[1], Provider_InvokeAction_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &providerInvokeActionClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_InvokeActionClient interface { - Recv() (*InvokeAction_Event, error) - grpc.ClientStream -} - -type providerInvokeActionClient struct { - grpc.ClientStream -} - -func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { - m := new(InvokeAction_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { - out := new(ValidateActionConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateActionConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { - out := new(Stop_Response) - err := c.cc.Invoke(ctx, Provider_Stop_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProviderServer is the server API for Provider service. -// All implementations should embed UnimplementedProviderServer -// for forward compatibility -type ProviderServer interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) - PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) - ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) - ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) - UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - Configure(context.Context, *Configure_Request) (*Configure_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) - PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) - ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) - ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) - MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) - ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) - GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(*ListResource_Request, Provider_ListResourceServer) error - ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) - // ////// Actions - PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) - InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error - ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - Stop(context.Context, *Stop_Request) (*Stop_Response, error) -} - -// UnimplementedProviderServer should be embedded to have forward compatible implementations. -type UnimplementedProviderServer struct { -} - -func (UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") -} -func (UnimplementedProviderServer) GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") -} -func (UnimplementedProviderServer) PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PrepareProviderConfig not implemented") -} -func (UnimplementedProviderServer) ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceTypeConfig not implemented") -} -func (UnimplementedProviderServer) ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateDataSourceConfig not implemented") -} -func (UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") -} -func (UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") -} -func (UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") -} -func (UnimplementedProviderServer) Configure(context.Context, *Configure_Request) (*Configure_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") -} -func (UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") -} -func (UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") -} -func (UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") -} -func (UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") -} -func (UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") -} -func (UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") -} -func (UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") -} -func (UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") -} -func (UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") -} -func (UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") -} -func (UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") -} -func (UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { - return status.Errorf(codes.Unimplemented, "method ListResource not implemented") -} -func (UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") -} -func (UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") -} -func (UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") -} -func (UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") -} -func (UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { - return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") -} -func (UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") -} -func (UnimplementedProviderServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") -} - -// UnsafeProviderServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ProviderServer will -// result in compilation errors. -type UnsafeProviderServer interface { - mustEmbedUnimplementedProviderServer() -} - -func RegisterProviderServer(s grpc.ServiceRegistrar, srv ProviderServer) { - s.RegisterService(&Provider_ServiceDesc, srv) -} - -func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMetadata_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetMetadata_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetSchema_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetSchema(ctx, req.(*GetProviderSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PrepareProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PrepareProviderConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PrepareProviderConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_PrepareProviderConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PrepareProviderConfig(ctx, req.(*PrepareProviderConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateResourceTypeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateResourceTypeConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateResourceTypeConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateResourceTypeConfig(ctx, req.(*ValidateResourceTypeConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateDataSourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateDataSourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateDataSourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateDataSourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateDataSourceConfig(ctx, req.(*ValidateDataSourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_UpgradeResourceState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetResourceIdentitySchemas_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetResourceIdentitySchemas_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceIdentity_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_UpgradeResourceIdentity_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Configure_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).Configure(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_Configure_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).Configure(ctx, req.(*Configure_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ReadResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_PlanResourceChange_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ApplyResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ApplyResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ApplyResourceChange_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ImportResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ImportResourceState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MoveResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).MoveResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_MoveResourceState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadDataSource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadDataSource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ReadDataSource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GenerateResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GenerateResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GenerateResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateEphemeralResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateEphemeralResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).OpenEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_OpenEphemeralResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RenewEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).RenewEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_RenewEphemeralResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CloseEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_CloseEphemeralResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListResource_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) -} - -type Provider_ListResourceServer interface { - Send(*ListResource_Event) error - grpc.ServerStream -} - -type providerListResourceServer struct { - grpc.ServerStream -} - -func (x *providerListResourceServer) Send(m *ListResource_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateListResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateListResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFunctions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetFunctions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetFunctions_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CallFunction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CallFunction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_CallFunction_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanAction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanAction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_PlanAction_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(InvokeAction_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) -} - -type Provider_InvokeActionServer interface { - Send(*InvokeAction_Event) error - grpc.ServerStream -} - -type providerInvokeActionServer struct { - grpc.ServerStream -} - -func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateActionConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateActionConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateActionConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Stop_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_Stop_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).Stop(ctx, req.(*Stop_Request)) - } - return interceptor(ctx, in, info, handler) -} - -// Provider_ServiceDesc is the grpc.ServiceDesc for Provider service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Provider_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "tfplugin5.Provider", - HandlerType: (*ProviderServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetMetadata", - Handler: _Provider_GetMetadata_Handler, - }, - { - MethodName: "GetSchema", - Handler: _Provider_GetSchema_Handler, - }, - { - MethodName: "PrepareProviderConfig", - Handler: _Provider_PrepareProviderConfig_Handler, - }, - { - MethodName: "ValidateResourceTypeConfig", - Handler: _Provider_ValidateResourceTypeConfig_Handler, - }, - { - MethodName: "ValidateDataSourceConfig", - Handler: _Provider_ValidateDataSourceConfig_Handler, - }, - { - MethodName: "UpgradeResourceState", - Handler: _Provider_UpgradeResourceState_Handler, - }, - { - MethodName: "GetResourceIdentitySchemas", - Handler: _Provider_GetResourceIdentitySchemas_Handler, - }, - { - MethodName: "UpgradeResourceIdentity", - Handler: _Provider_UpgradeResourceIdentity_Handler, - }, - { - MethodName: "Configure", - Handler: _Provider_Configure_Handler, - }, - { - MethodName: "ReadResource", - Handler: _Provider_ReadResource_Handler, - }, - { - MethodName: "PlanResourceChange", - Handler: _Provider_PlanResourceChange_Handler, - }, - { - MethodName: "ApplyResourceChange", - Handler: _Provider_ApplyResourceChange_Handler, - }, - { - MethodName: "ImportResourceState", - Handler: _Provider_ImportResourceState_Handler, - }, - { - MethodName: "MoveResourceState", - Handler: _Provider_MoveResourceState_Handler, - }, - { - MethodName: "ReadDataSource", - Handler: _Provider_ReadDataSource_Handler, - }, - { - MethodName: "GenerateResourceConfig", - Handler: _Provider_GenerateResourceConfig_Handler, - }, - { - MethodName: "ValidateEphemeralResourceConfig", - Handler: _Provider_ValidateEphemeralResourceConfig_Handler, - }, - { - MethodName: "OpenEphemeralResource", - Handler: _Provider_OpenEphemeralResource_Handler, - }, - { - MethodName: "RenewEphemeralResource", - Handler: _Provider_RenewEphemeralResource_Handler, - }, - { - MethodName: "CloseEphemeralResource", - Handler: _Provider_CloseEphemeralResource_Handler, - }, - { - MethodName: "ValidateListResourceConfig", - Handler: _Provider_ValidateListResourceConfig_Handler, - }, - { - MethodName: "GetFunctions", - Handler: _Provider_GetFunctions_Handler, - }, - { - MethodName: "CallFunction", - Handler: _Provider_CallFunction_Handler, - }, - { - MethodName: "PlanAction", - Handler: _Provider_PlanAction_Handler, - }, - { - MethodName: "ValidateActionConfig", - Handler: _Provider_ValidateActionConfig_Handler, - }, - { - MethodName: "Stop", - Handler: _Provider_Stop_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ListResource", - Handler: _Provider_ListResource_Handler, - ServerStreams: true, - }, - { - StreamName: "InvokeAction", - Handler: _Provider_InvokeAction_Handler, - ServerStreams: true, - }, - }, - Metadata: "tfplugin5.proto", -} - -const ( - Provisioner_GetSchema_FullMethodName = "/tfplugin5.Provisioner/GetSchema" - Provisioner_ValidateProvisionerConfig_FullMethodName = "/tfplugin5.Provisioner/ValidateProvisionerConfig" - Provisioner_ProvisionResource_FullMethodName = "/tfplugin5.Provisioner/ProvisionResource" - Provisioner_Stop_FullMethodName = "/tfplugin5.Provisioner/Stop" -) - -// ProvisionerClient is the client API for Provisioner service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ProvisionerClient interface { - GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) - ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) - ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) - Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) -} - -type provisionerClient struct { - cc grpc.ClientConnInterface -} - -func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient { - return &provisionerClient{cc} -} - -func (c *provisionerClient) GetSchema(ctx context.Context, in *GetProvisionerSchema_Request, opts ...grpc.CallOption) (*GetProvisionerSchema_Response, error) { - out := new(GetProvisionerSchema_Response) - err := c.cc.Invoke(ctx, Provisioner_GetSchema_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *provisionerClient) ValidateProvisionerConfig(ctx context.Context, in *ValidateProvisionerConfig_Request, opts ...grpc.CallOption) (*ValidateProvisionerConfig_Response, error) { - out := new(ValidateProvisionerConfig_Response) - err := c.cc.Invoke(ctx, Provisioner_ValidateProvisionerConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *provisionerClient) ProvisionResource(ctx context.Context, in *ProvisionResource_Request, opts ...grpc.CallOption) (Provisioner_ProvisionResourceClient, error) { - stream, err := c.cc.NewStream(ctx, &Provisioner_ServiceDesc.Streams[0], Provisioner_ProvisionResource_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &provisionerProvisionResourceClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provisioner_ProvisionResourceClient interface { - Recv() (*ProvisionResource_Response, error) - grpc.ClientStream -} - -type provisionerProvisionResourceClient struct { - grpc.ClientStream -} - -func (x *provisionerProvisionResourceClient) Recv() (*ProvisionResource_Response, error) { - m := new(ProvisionResource_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *provisionerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) { - out := new(Stop_Response) - err := c.cc.Invoke(ctx, Provisioner_Stop_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProvisionerServer is the server API for Provisioner service. -// All implementations should embed UnimplementedProvisionerServer -// for forward compatibility -type ProvisionerServer interface { - GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) - ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) - ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error - Stop(context.Context, *Stop_Request) (*Stop_Response, error) -} - -// UnimplementedProvisionerServer should be embedded to have forward compatible implementations. -type UnimplementedProvisionerServer struct { -} - -func (UnimplementedProvisionerServer) GetSchema(context.Context, *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") -} -func (UnimplementedProvisionerServer) ValidateProvisionerConfig(context.Context, *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateProvisionerConfig not implemented") -} -func (UnimplementedProvisionerServer) ProvisionResource(*ProvisionResource_Request, Provisioner_ProvisionResourceServer) error { - return status.Errorf(codes.Unimplemented, "method ProvisionResource not implemented") -} -func (UnimplementedProvisionerServer) Stop(context.Context, *Stop_Request) (*Stop_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") -} - -// UnsafeProvisionerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ProvisionerServer will -// result in compilation errors. -type UnsafeProvisionerServer interface { - mustEmbedUnimplementedProvisionerServer() -} - -func RegisterProvisionerServer(s grpc.ServiceRegistrar, srv ProvisionerServer) { - s.RegisterService(&Provisioner_ServiceDesc, srv) -} - -func _Provisioner_GetSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProvisionerSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).GetSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provisioner_GetSchema_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).GetSchema(ctx, req.(*GetProvisionerSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provisioner_ValidateProvisionerConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateProvisionerConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provisioner_ValidateProvisionerConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).ValidateProvisionerConfig(ctx, req.(*ValidateProvisionerConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provisioner_ProvisionResource_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ProvisionResource_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProvisionerServer).ProvisionResource(m, &provisionerProvisionResourceServer{stream}) -} - -type Provisioner_ProvisionResourceServer interface { - Send(*ProvisionResource_Response) error - grpc.ServerStream -} - -type provisionerProvisionResourceServer struct { - grpc.ServerStream -} - -func (x *provisionerProvisionResourceServer) Send(m *ProvisionResource_Response) error { - return x.ServerStream.SendMsg(m) -} - -func _Provisioner_Stop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Stop_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProvisionerServer).Stop(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provisioner_Stop_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProvisionerServer).Stop(ctx, req.(*Stop_Request)) - } - return interceptor(ctx, in, info, handler) -} - -// Provisioner_ServiceDesc is the grpc.ServiceDesc for Provisioner service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Provisioner_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "tfplugin5.Provisioner", - HandlerType: (*ProvisionerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetSchema", - Handler: _Provisioner_GetSchema_Handler, - }, - { - MethodName: "ValidateProvisionerConfig", - Handler: _Provisioner_ValidateProvisionerConfig_Handler, - }, - { - MethodName: "Stop", - Handler: _Provisioner_Stop_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ProvisionResource", - Handler: _Provisioner_ProvisionResource_Handler, - ServerStreams: true, - }, - }, - Metadata: "tfplugin5.proto", -} diff --git a/internal/tfplugin6/tfplugin6.pb.go b/internal/tfplugin6/tfplugin6.pb.go index fbbea9c98d0a..c40bb14b33be 100644 --- a/internal/tfplugin6/tfplugin6.pb.go +++ b/internal/tfplugin6/tfplugin6.pb.go @@ -28,6 +28,10 @@ package tfplugin6 import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" timestamppb "google.golang.org/protobuf/types/known/timestamppb" @@ -2070,270 +2074,6 @@ func (*ConfigureStateStore) Descriptor() ([]byte, []int) { return file_tfplugin6_proto_rawDescGZIP(), []int{39} } -type StateStoreClientCapabilities struct { - state protoimpl.MessageState `protogen:"open.v1"` - ChunkSize int64 `protobuf:"varint,1,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` // suggested chunk size by Core - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StateStoreClientCapabilities) Reset() { - *x = StateStoreClientCapabilities{} - mi := &file_tfplugin6_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StateStoreClientCapabilities) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StateStoreClientCapabilities) ProtoMessage() {} - -func (x *StateStoreClientCapabilities) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[40] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StateStoreClientCapabilities.ProtoReflect.Descriptor instead. -func (*StateStoreClientCapabilities) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{40} -} - -func (x *StateStoreClientCapabilities) GetChunkSize() int64 { - if x != nil { - return x.ChunkSize - } - return 0 -} - -type StateStoreServerCapabilities struct { - state protoimpl.MessageState `protogen:"open.v1"` - ChunkSize int64 `protobuf:"varint,1,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` // chosen chunk size by plugin - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StateStoreServerCapabilities) Reset() { - *x = StateStoreServerCapabilities{} - mi := &file_tfplugin6_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StateStoreServerCapabilities) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StateStoreServerCapabilities) ProtoMessage() {} - -func (x *StateStoreServerCapabilities) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[41] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StateStoreServerCapabilities.ProtoReflect.Descriptor instead. -func (*StateStoreServerCapabilities) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{41} -} - -func (x *StateStoreServerCapabilities) GetChunkSize() int64 { - if x != nil { - return x.ChunkSize - } - return 0 -} - -type ReadStateBytes struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReadStateBytes) Reset() { - *x = ReadStateBytes{} - mi := &file_tfplugin6_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReadStateBytes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadStateBytes) ProtoMessage() {} - -func (x *ReadStateBytes) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[42] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReadStateBytes.ProtoReflect.Descriptor instead. -func (*ReadStateBytes) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{42} -} - -type WriteStateBytes struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteStateBytes) Reset() { - *x = WriteStateBytes{} - mi := &file_tfplugin6_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteStateBytes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteStateBytes) ProtoMessage() {} - -func (x *WriteStateBytes) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[43] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteStateBytes.ProtoReflect.Descriptor instead. -func (*WriteStateBytes) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43} -} - -type RequestChunkMeta struct { - state protoimpl.MessageState `protogen:"open.v1"` - TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - StateId string `protobuf:"bytes,2,opt,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *RequestChunkMeta) Reset() { - *x = RequestChunkMeta{} - mi := &file_tfplugin6_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *RequestChunkMeta) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RequestChunkMeta) ProtoMessage() {} - -func (x *RequestChunkMeta) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[44] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RequestChunkMeta.ProtoReflect.Descriptor instead. -func (*RequestChunkMeta) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{44} -} - -func (x *RequestChunkMeta) GetTypeName() string { - if x != nil { - return x.TypeName - } - return "" -} - -func (x *RequestChunkMeta) GetStateId() string { - if x != nil { - return x.StateId - } - return "" -} - -type StateRange struct { - state protoimpl.MessageState `protogen:"open.v1"` - Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *StateRange) Reset() { - *x = StateRange{} - mi := &file_tfplugin6_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *StateRange) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StateRange) ProtoMessage() {} - -func (x *StateRange) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[45] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StateRange.ProtoReflect.Descriptor instead. -func (*StateRange) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{45} -} - -func (x *StateRange) GetStart() int64 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *StateRange) GetEnd() int64 { - if x != nil { - return x.End - } - return 0 -} - type GetStates struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -2342,7 +2082,7 @@ type GetStates struct { func (x *GetStates) Reset() { *x = GetStates{} - mi := &file_tfplugin6_proto_msgTypes[46] + mi := &file_tfplugin6_proto_msgTypes[40] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2354,7 +2094,7 @@ func (x *GetStates) String() string { func (*GetStates) ProtoMessage() {} func (x *GetStates) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[46] + mi := &file_tfplugin6_proto_msgTypes[40] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2367,7 +2107,7 @@ func (x *GetStates) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStates.ProtoReflect.Descriptor instead. func (*GetStates) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{46} + return file_tfplugin6_proto_rawDescGZIP(), []int{40} } type DeleteState struct { @@ -2378,7 +2118,7 @@ type DeleteState struct { func (x *DeleteState) Reset() { *x = DeleteState{} - mi := &file_tfplugin6_proto_msgTypes[47] + mi := &file_tfplugin6_proto_msgTypes[41] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2390,7 +2130,7 @@ func (x *DeleteState) String() string { func (*DeleteState) ProtoMessage() {} func (x *DeleteState) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[47] + mi := &file_tfplugin6_proto_msgTypes[41] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2403,7 +2143,7 @@ func (x *DeleteState) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteState.ProtoReflect.Descriptor instead. func (*DeleteState) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{47} + return file_tfplugin6_proto_rawDescGZIP(), []int{41} } type PlanAction struct { @@ -2414,7 +2154,7 @@ type PlanAction struct { func (x *PlanAction) Reset() { *x = PlanAction{} - mi := &file_tfplugin6_proto_msgTypes[48] + mi := &file_tfplugin6_proto_msgTypes[42] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2426,7 +2166,7 @@ func (x *PlanAction) String() string { func (*PlanAction) ProtoMessage() {} func (x *PlanAction) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[48] + mi := &file_tfplugin6_proto_msgTypes[42] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2439,7 +2179,7 @@ func (x *PlanAction) ProtoReflect() protoreflect.Message { // Deprecated: Use PlanAction.ProtoReflect.Descriptor instead. func (*PlanAction) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{48} + return file_tfplugin6_proto_rawDescGZIP(), []int{42} } type InvokeAction struct { @@ -2450,7 +2190,7 @@ type InvokeAction struct { func (x *InvokeAction) Reset() { *x = InvokeAction{} - mi := &file_tfplugin6_proto_msgTypes[49] + mi := &file_tfplugin6_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2462,7 +2202,7 @@ func (x *InvokeAction) String() string { func (*InvokeAction) ProtoMessage() {} func (x *InvokeAction) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[49] + mi := &file_tfplugin6_proto_msgTypes[43] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2475,7 +2215,7 @@ func (x *InvokeAction) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction.ProtoReflect.Descriptor instead. func (*InvokeAction) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{49} + return file_tfplugin6_proto_rawDescGZIP(), []int{43} } type ValidateActionConfig struct { @@ -2486,7 +2226,7 @@ type ValidateActionConfig struct { func (x *ValidateActionConfig) Reset() { *x = ValidateActionConfig{} - mi := &file_tfplugin6_proto_msgTypes[50] + mi := &file_tfplugin6_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2498,7 +2238,7 @@ func (x *ValidateActionConfig) String() string { func (*ValidateActionConfig) ProtoMessage() {} func (x *ValidateActionConfig) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[50] + mi := &file_tfplugin6_proto_msgTypes[44] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2511,7 +2251,7 @@ func (x *ValidateActionConfig) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateActionConfig.ProtoReflect.Descriptor instead. func (*ValidateActionConfig) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{50} + return file_tfplugin6_proto_rawDescGZIP(), []int{44} } type AttributePath_Step struct { @@ -2528,7 +2268,7 @@ type AttributePath_Step struct { func (x *AttributePath_Step) Reset() { *x = AttributePath_Step{} - mi := &file_tfplugin6_proto_msgTypes[51] + mi := &file_tfplugin6_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2540,7 +2280,7 @@ func (x *AttributePath_Step) String() string { func (*AttributePath_Step) ProtoMessage() {} func (x *AttributePath_Step) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[51] + mi := &file_tfplugin6_proto_msgTypes[45] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2624,7 +2364,7 @@ type StopProvider_Request struct { func (x *StopProvider_Request) Reset() { *x = StopProvider_Request{} - mi := &file_tfplugin6_proto_msgTypes[52] + mi := &file_tfplugin6_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2636,7 +2376,7 @@ func (x *StopProvider_Request) String() string { func (*StopProvider_Request) ProtoMessage() {} func (x *StopProvider_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[52] + mi := &file_tfplugin6_proto_msgTypes[46] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2661,7 +2401,7 @@ type StopProvider_Response struct { func (x *StopProvider_Response) Reset() { *x = StopProvider_Response{} - mi := &file_tfplugin6_proto_msgTypes[53] + mi := &file_tfplugin6_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2673,7 +2413,7 @@ func (x *StopProvider_Response) String() string { func (*StopProvider_Response) ProtoMessage() {} func (x *StopProvider_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[53] + mi := &file_tfplugin6_proto_msgTypes[47] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2719,7 +2459,7 @@ type ResourceIdentitySchema_IdentityAttribute struct { func (x *ResourceIdentitySchema_IdentityAttribute) Reset() { *x = ResourceIdentitySchema_IdentityAttribute{} - mi := &file_tfplugin6_proto_msgTypes[55] + mi := &file_tfplugin6_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2731,7 +2471,7 @@ func (x *ResourceIdentitySchema_IdentityAttribute) String() string { func (*ResourceIdentitySchema_IdentityAttribute) ProtoMessage() {} func (x *ResourceIdentitySchema_IdentityAttribute) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[55] + mi := &file_tfplugin6_proto_msgTypes[49] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2796,7 +2536,7 @@ type Schema_Block struct { func (x *Schema_Block) Reset() { *x = Schema_Block{} - mi := &file_tfplugin6_proto_msgTypes[56] + mi := &file_tfplugin6_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2808,7 +2548,7 @@ func (x *Schema_Block) String() string { func (*Schema_Block) ProtoMessage() {} func (x *Schema_Block) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[56] + mi := &file_tfplugin6_proto_msgTypes[50] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2885,7 +2625,7 @@ type Schema_Attribute struct { func (x *Schema_Attribute) Reset() { *x = Schema_Attribute{} - mi := &file_tfplugin6_proto_msgTypes[57] + mi := &file_tfplugin6_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2897,7 +2637,7 @@ func (x *Schema_Attribute) String() string { func (*Schema_Attribute) ProtoMessage() {} func (x *Schema_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[57] + mi := &file_tfplugin6_proto_msgTypes[51] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3003,7 +2743,7 @@ type Schema_NestedBlock struct { func (x *Schema_NestedBlock) Reset() { *x = Schema_NestedBlock{} - mi := &file_tfplugin6_proto_msgTypes[58] + mi := &file_tfplugin6_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3015,7 +2755,7 @@ func (x *Schema_NestedBlock) String() string { func (*Schema_NestedBlock) ProtoMessage() {} func (x *Schema_NestedBlock) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[58] + mi := &file_tfplugin6_proto_msgTypes[52] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3083,7 +2823,7 @@ type Schema_Object struct { func (x *Schema_Object) Reset() { *x = Schema_Object{} - mi := &file_tfplugin6_proto_msgTypes[59] + mi := &file_tfplugin6_proto_msgTypes[53] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3095,7 +2835,7 @@ func (x *Schema_Object) String() string { func (*Schema_Object) ProtoMessage() {} func (x *Schema_Object) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[59] + mi := &file_tfplugin6_proto_msgTypes[53] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3166,7 +2906,7 @@ type Function_Parameter struct { func (x *Function_Parameter) Reset() { *x = Function_Parameter{} - mi := &file_tfplugin6_proto_msgTypes[60] + mi := &file_tfplugin6_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3178,7 +2918,7 @@ func (x *Function_Parameter) String() string { func (*Function_Parameter) ProtoMessage() {} func (x *Function_Parameter) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[60] + mi := &file_tfplugin6_proto_msgTypes[54] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3246,7 +2986,7 @@ type Function_Return struct { func (x *Function_Return) Reset() { *x = Function_Return{} - mi := &file_tfplugin6_proto_msgTypes[61] + mi := &file_tfplugin6_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3258,7 +2998,7 @@ func (x *Function_Return) String() string { func (*Function_Return) ProtoMessage() {} func (x *Function_Return) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[61] + mi := &file_tfplugin6_proto_msgTypes[55] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3289,7 +3029,7 @@ type GetMetadata_Request struct { func (x *GetMetadata_Request) Reset() { *x = GetMetadata_Request{} - mi := &file_tfplugin6_proto_msgTypes[62] + mi := &file_tfplugin6_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3301,7 +3041,7 @@ func (x *GetMetadata_Request) String() string { func (*GetMetadata_Request) ProtoMessage() {} func (x *GetMetadata_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[62] + mi := &file_tfplugin6_proto_msgTypes[56] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3335,7 +3075,7 @@ type GetMetadata_Response struct { func (x *GetMetadata_Response) Reset() { *x = GetMetadata_Response{} - mi := &file_tfplugin6_proto_msgTypes[63] + mi := &file_tfplugin6_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3347,7 +3087,7 @@ func (x *GetMetadata_Response) String() string { func (*GetMetadata_Response) ProtoMessage() {} func (x *GetMetadata_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[63] + mi := &file_tfplugin6_proto_msgTypes[57] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3435,7 +3175,7 @@ type GetMetadata_EphemeralMetadata struct { func (x *GetMetadata_EphemeralMetadata) Reset() { *x = GetMetadata_EphemeralMetadata{} - mi := &file_tfplugin6_proto_msgTypes[64] + mi := &file_tfplugin6_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3447,7 +3187,7 @@ func (x *GetMetadata_EphemeralMetadata) String() string { func (*GetMetadata_EphemeralMetadata) ProtoMessage() {} func (x *GetMetadata_EphemeralMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[64] + mi := &file_tfplugin6_proto_msgTypes[58] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3480,7 +3220,7 @@ type GetMetadata_FunctionMetadata struct { func (x *GetMetadata_FunctionMetadata) Reset() { *x = GetMetadata_FunctionMetadata{} - mi := &file_tfplugin6_proto_msgTypes[65] + mi := &file_tfplugin6_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3492,7 +3232,7 @@ func (x *GetMetadata_FunctionMetadata) String() string { func (*GetMetadata_FunctionMetadata) ProtoMessage() {} func (x *GetMetadata_FunctionMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[65] + mi := &file_tfplugin6_proto_msgTypes[59] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3524,7 +3264,7 @@ type GetMetadata_DataSourceMetadata struct { func (x *GetMetadata_DataSourceMetadata) Reset() { *x = GetMetadata_DataSourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[66] + mi := &file_tfplugin6_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3536,7 +3276,7 @@ func (x *GetMetadata_DataSourceMetadata) String() string { func (*GetMetadata_DataSourceMetadata) ProtoMessage() {} func (x *GetMetadata_DataSourceMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[66] + mi := &file_tfplugin6_proto_msgTypes[60] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3568,7 +3308,7 @@ type GetMetadata_ResourceMetadata struct { func (x *GetMetadata_ResourceMetadata) Reset() { *x = GetMetadata_ResourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[67] + mi := &file_tfplugin6_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3580,7 +3320,7 @@ func (x *GetMetadata_ResourceMetadata) String() string { func (*GetMetadata_ResourceMetadata) ProtoMessage() {} func (x *GetMetadata_ResourceMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[67] + mi := &file_tfplugin6_proto_msgTypes[61] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3612,7 +3352,7 @@ type GetMetadata_ListResourceMetadata struct { func (x *GetMetadata_ListResourceMetadata) Reset() { *x = GetMetadata_ListResourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[68] + mi := &file_tfplugin6_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3624,7 +3364,7 @@ func (x *GetMetadata_ListResourceMetadata) String() string { func (*GetMetadata_ListResourceMetadata) ProtoMessage() {} func (x *GetMetadata_ListResourceMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[68] + mi := &file_tfplugin6_proto_msgTypes[62] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3656,7 +3396,7 @@ type GetMetadata_StateStoreMetadata struct { func (x *GetMetadata_StateStoreMetadata) Reset() { *x = GetMetadata_StateStoreMetadata{} - mi := &file_tfplugin6_proto_msgTypes[69] + mi := &file_tfplugin6_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3668,7 +3408,7 @@ func (x *GetMetadata_StateStoreMetadata) String() string { func (*GetMetadata_StateStoreMetadata) ProtoMessage() {} func (x *GetMetadata_StateStoreMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[69] + mi := &file_tfplugin6_proto_msgTypes[63] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3700,7 +3440,7 @@ type GetMetadata_ActionMetadata struct { func (x *GetMetadata_ActionMetadata) Reset() { *x = GetMetadata_ActionMetadata{} - mi := &file_tfplugin6_proto_msgTypes[70] + mi := &file_tfplugin6_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3712,7 +3452,7 @@ func (x *GetMetadata_ActionMetadata) String() string { func (*GetMetadata_ActionMetadata) ProtoMessage() {} func (x *GetMetadata_ActionMetadata) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[70] + mi := &file_tfplugin6_proto_msgTypes[64] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3743,7 +3483,7 @@ type GetProviderSchema_Request struct { func (x *GetProviderSchema_Request) Reset() { *x = GetProviderSchema_Request{} - mi := &file_tfplugin6_proto_msgTypes[71] + mi := &file_tfplugin6_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3755,7 +3495,7 @@ func (x *GetProviderSchema_Request) String() string { func (*GetProviderSchema_Request) ProtoMessage() {} func (x *GetProviderSchema_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[71] + mi := &file_tfplugin6_proto_msgTypes[65] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3790,7 +3530,7 @@ type GetProviderSchema_Response struct { func (x *GetProviderSchema_Response) Reset() { *x = GetProviderSchema_Response{} - mi := &file_tfplugin6_proto_msgTypes[72] + mi := &file_tfplugin6_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3802,7 +3542,7 @@ func (x *GetProviderSchema_Response) String() string { func (*GetProviderSchema_Response) ProtoMessage() {} func (x *GetProviderSchema_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[72] + mi := &file_tfplugin6_proto_msgTypes[66] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3904,7 +3644,7 @@ type ValidateProviderConfig_Request struct { func (x *ValidateProviderConfig_Request) Reset() { *x = ValidateProviderConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[80] + mi := &file_tfplugin6_proto_msgTypes[74] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3916,7 +3656,7 @@ func (x *ValidateProviderConfig_Request) String() string { func (*ValidateProviderConfig_Request) ProtoMessage() {} func (x *ValidateProviderConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[80] + mi := &file_tfplugin6_proto_msgTypes[74] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3948,7 +3688,7 @@ type ValidateProviderConfig_Response struct { func (x *ValidateProviderConfig_Response) Reset() { *x = ValidateProviderConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[81] + mi := &file_tfplugin6_proto_msgTypes[75] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3960,7 +3700,7 @@ func (x *ValidateProviderConfig_Response) String() string { func (*ValidateProviderConfig_Response) ProtoMessage() {} func (x *ValidateProviderConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[81] + mi := &file_tfplugin6_proto_msgTypes[75] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4009,7 +3749,7 @@ type UpgradeResourceState_Request struct { func (x *UpgradeResourceState_Request) Reset() { *x = UpgradeResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[82] + mi := &file_tfplugin6_proto_msgTypes[76] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4021,7 +3761,7 @@ func (x *UpgradeResourceState_Request) String() string { func (*UpgradeResourceState_Request) ProtoMessage() {} func (x *UpgradeResourceState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[82] + mi := &file_tfplugin6_proto_msgTypes[76] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4074,7 +3814,7 @@ type UpgradeResourceState_Response struct { func (x *UpgradeResourceState_Response) Reset() { *x = UpgradeResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[83] + mi := &file_tfplugin6_proto_msgTypes[77] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4086,7 +3826,7 @@ func (x *UpgradeResourceState_Response) String() string { func (*UpgradeResourceState_Response) ProtoMessage() {} func (x *UpgradeResourceState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[83] + mi := &file_tfplugin6_proto_msgTypes[77] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4124,7 +3864,7 @@ type GetResourceIdentitySchemas_Request struct { func (x *GetResourceIdentitySchemas_Request) Reset() { *x = GetResourceIdentitySchemas_Request{} - mi := &file_tfplugin6_proto_msgTypes[84] + mi := &file_tfplugin6_proto_msgTypes[78] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4136,7 +3876,7 @@ func (x *GetResourceIdentitySchemas_Request) String() string { func (*GetResourceIdentitySchemas_Request) ProtoMessage() {} func (x *GetResourceIdentitySchemas_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[84] + mi := &file_tfplugin6_proto_msgTypes[78] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4164,7 +3904,7 @@ type GetResourceIdentitySchemas_Response struct { func (x *GetResourceIdentitySchemas_Response) Reset() { *x = GetResourceIdentitySchemas_Response{} - mi := &file_tfplugin6_proto_msgTypes[85] + mi := &file_tfplugin6_proto_msgTypes[79] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4176,7 +3916,7 @@ func (x *GetResourceIdentitySchemas_Response) String() string { func (*GetResourceIdentitySchemas_Response) ProtoMessage() {} func (x *GetResourceIdentitySchemas_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[85] + mi := &file_tfplugin6_proto_msgTypes[79] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4223,7 +3963,7 @@ type UpgradeResourceIdentity_Request struct { func (x *UpgradeResourceIdentity_Request) Reset() { *x = UpgradeResourceIdentity_Request{} - mi := &file_tfplugin6_proto_msgTypes[87] + mi := &file_tfplugin6_proto_msgTypes[81] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4235,7 +3975,7 @@ func (x *UpgradeResourceIdentity_Request) String() string { func (*UpgradeResourceIdentity_Request) ProtoMessage() {} func (x *UpgradeResourceIdentity_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[87] + mi := &file_tfplugin6_proto_msgTypes[81] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4284,7 +4024,7 @@ type UpgradeResourceIdentity_Response struct { func (x *UpgradeResourceIdentity_Response) Reset() { *x = UpgradeResourceIdentity_Response{} - mi := &file_tfplugin6_proto_msgTypes[88] + mi := &file_tfplugin6_proto_msgTypes[82] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4296,7 +4036,7 @@ func (x *UpgradeResourceIdentity_Response) String() string { func (*UpgradeResourceIdentity_Response) ProtoMessage() {} func (x *UpgradeResourceIdentity_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[88] + mi := &file_tfplugin6_proto_msgTypes[82] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4337,7 +4077,7 @@ type ValidateResourceConfig_Request struct { func (x *ValidateResourceConfig_Request) Reset() { *x = ValidateResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[89] + mi := &file_tfplugin6_proto_msgTypes[83] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4349,7 +4089,7 @@ func (x *ValidateResourceConfig_Request) String() string { func (*ValidateResourceConfig_Request) ProtoMessage() {} func (x *ValidateResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[89] + mi := &file_tfplugin6_proto_msgTypes[83] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4395,7 +4135,7 @@ type ValidateResourceConfig_Response struct { func (x *ValidateResourceConfig_Response) Reset() { *x = ValidateResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[90] + mi := &file_tfplugin6_proto_msgTypes[84] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4407,7 +4147,7 @@ func (x *ValidateResourceConfig_Response) String() string { func (*ValidateResourceConfig_Response) ProtoMessage() {} func (x *ValidateResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[90] + mi := &file_tfplugin6_proto_msgTypes[84] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4440,7 +4180,7 @@ type ValidateDataResourceConfig_Request struct { func (x *ValidateDataResourceConfig_Request) Reset() { *x = ValidateDataResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[91] + mi := &file_tfplugin6_proto_msgTypes[85] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4452,7 +4192,7 @@ func (x *ValidateDataResourceConfig_Request) String() string { func (*ValidateDataResourceConfig_Request) ProtoMessage() {} func (x *ValidateDataResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[91] + mi := &file_tfplugin6_proto_msgTypes[85] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4491,7 +4231,7 @@ type ValidateDataResourceConfig_Response struct { func (x *ValidateDataResourceConfig_Response) Reset() { *x = ValidateDataResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[92] + mi := &file_tfplugin6_proto_msgTypes[86] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4503,7 +4243,7 @@ func (x *ValidateDataResourceConfig_Response) String() string { func (*ValidateDataResourceConfig_Response) ProtoMessage() {} func (x *ValidateDataResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[92] + mi := &file_tfplugin6_proto_msgTypes[86] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4536,7 +4276,7 @@ type ValidateEphemeralResourceConfig_Request struct { func (x *ValidateEphemeralResourceConfig_Request) Reset() { *x = ValidateEphemeralResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[93] + mi := &file_tfplugin6_proto_msgTypes[87] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4548,7 +4288,7 @@ func (x *ValidateEphemeralResourceConfig_Request) String() string { func (*ValidateEphemeralResourceConfig_Request) ProtoMessage() {} func (x *ValidateEphemeralResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[93] + mi := &file_tfplugin6_proto_msgTypes[87] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4587,7 +4327,7 @@ type ValidateEphemeralResourceConfig_Response struct { func (x *ValidateEphemeralResourceConfig_Response) Reset() { *x = ValidateEphemeralResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[94] + mi := &file_tfplugin6_proto_msgTypes[88] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4599,7 +4339,7 @@ func (x *ValidateEphemeralResourceConfig_Response) String() string { func (*ValidateEphemeralResourceConfig_Response) ProtoMessage() {} func (x *ValidateEphemeralResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[94] + mi := &file_tfplugin6_proto_msgTypes[88] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4633,7 +4373,7 @@ type ConfigureProvider_Request struct { func (x *ConfigureProvider_Request) Reset() { *x = ConfigureProvider_Request{} - mi := &file_tfplugin6_proto_msgTypes[95] + mi := &file_tfplugin6_proto_msgTypes[89] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4645,7 +4385,7 @@ func (x *ConfigureProvider_Request) String() string { func (*ConfigureProvider_Request) ProtoMessage() {} func (x *ConfigureProvider_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[95] + mi := &file_tfplugin6_proto_msgTypes[89] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4691,7 +4431,7 @@ type ConfigureProvider_Response struct { func (x *ConfigureProvider_Response) Reset() { *x = ConfigureProvider_Response{} - mi := &file_tfplugin6_proto_msgTypes[96] + mi := &file_tfplugin6_proto_msgTypes[90] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4703,7 +4443,7 @@ func (x *ConfigureProvider_Response) String() string { func (*ConfigureProvider_Response) ProtoMessage() {} func (x *ConfigureProvider_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[96] + mi := &file_tfplugin6_proto_msgTypes[90] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4748,7 +4488,7 @@ type ReadResource_Request struct { func (x *ReadResource_Request) Reset() { *x = ReadResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[97] + mi := &file_tfplugin6_proto_msgTypes[91] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4760,7 +4500,7 @@ func (x *ReadResource_Request) String() string { func (*ReadResource_Request) ProtoMessage() {} func (x *ReadResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[97] + mi := &file_tfplugin6_proto_msgTypes[91] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4833,7 +4573,7 @@ type ReadResource_Response struct { func (x *ReadResource_Response) Reset() { *x = ReadResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[98] + mi := &file_tfplugin6_proto_msgTypes[92] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4845,7 +4585,7 @@ func (x *ReadResource_Response) String() string { func (*ReadResource_Response) ProtoMessage() {} func (x *ReadResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[98] + mi := &file_tfplugin6_proto_msgTypes[92] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4912,7 +4652,7 @@ type PlanResourceChange_Request struct { func (x *PlanResourceChange_Request) Reset() { *x = PlanResourceChange_Request{} - mi := &file_tfplugin6_proto_msgTypes[99] + mi := &file_tfplugin6_proto_msgTypes[93] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4924,7 +4664,7 @@ func (x *PlanResourceChange_Request) String() string { func (*PlanResourceChange_Request) ProtoMessage() {} func (x *PlanResourceChange_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[99] + mi := &file_tfplugin6_proto_msgTypes[93] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5024,7 +4764,7 @@ type PlanResourceChange_Response struct { func (x *PlanResourceChange_Response) Reset() { *x = PlanResourceChange_Response{} - mi := &file_tfplugin6_proto_msgTypes[100] + mi := &file_tfplugin6_proto_msgTypes[94] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5036,7 +4776,7 @@ func (x *PlanResourceChange_Response) String() string { func (*PlanResourceChange_Response) ProtoMessage() {} func (x *PlanResourceChange_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[100] + mi := &file_tfplugin6_proto_msgTypes[94] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5116,7 +4856,7 @@ type ApplyResourceChange_Request struct { func (x *ApplyResourceChange_Request) Reset() { *x = ApplyResourceChange_Request{} - mi := &file_tfplugin6_proto_msgTypes[101] + mi := &file_tfplugin6_proto_msgTypes[95] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5128,7 +4868,7 @@ func (x *ApplyResourceChange_Request) String() string { func (*ApplyResourceChange_Request) ProtoMessage() {} func (x *ApplyResourceChange_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[101] + mi := &file_tfplugin6_proto_msgTypes[95] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5217,7 +4957,7 @@ type ApplyResourceChange_Response struct { func (x *ApplyResourceChange_Response) Reset() { *x = ApplyResourceChange_Response{} - mi := &file_tfplugin6_proto_msgTypes[102] + mi := &file_tfplugin6_proto_msgTypes[96] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5229,7 +4969,7 @@ func (x *ApplyResourceChange_Response) String() string { func (*ApplyResourceChange_Response) ProtoMessage() {} func (x *ApplyResourceChange_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[102] + mi := &file_tfplugin6_proto_msgTypes[96] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5292,7 +5032,7 @@ type ImportResourceState_Request struct { func (x *ImportResourceState_Request) Reset() { *x = ImportResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[103] + mi := &file_tfplugin6_proto_msgTypes[97] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5304,7 +5044,7 @@ func (x *ImportResourceState_Request) String() string { func (*ImportResourceState_Request) ProtoMessage() {} func (x *ImportResourceState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[103] + mi := &file_tfplugin6_proto_msgTypes[97] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5360,7 +5100,7 @@ type ImportResourceState_ImportedResource struct { func (x *ImportResourceState_ImportedResource) Reset() { *x = ImportResourceState_ImportedResource{} - mi := &file_tfplugin6_proto_msgTypes[104] + mi := &file_tfplugin6_proto_msgTypes[98] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5372,7 +5112,7 @@ func (x *ImportResourceState_ImportedResource) String() string { func (*ImportResourceState_ImportedResource) ProtoMessage() {} func (x *ImportResourceState_ImportedResource) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[104] + mi := &file_tfplugin6_proto_msgTypes[98] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5429,7 +5169,7 @@ type ImportResourceState_Response struct { func (x *ImportResourceState_Response) Reset() { *x = ImportResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[105] + mi := &file_tfplugin6_proto_msgTypes[99] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5441,7 +5181,7 @@ func (x *ImportResourceState_Response) String() string { func (*ImportResourceState_Response) ProtoMessage() {} func (x *ImportResourceState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[105] + mi := &file_tfplugin6_proto_msgTypes[99] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5488,7 +5228,7 @@ type GenerateResourceConfig_Request struct { func (x *GenerateResourceConfig_Request) Reset() { *x = GenerateResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[106] + mi := &file_tfplugin6_proto_msgTypes[100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5500,7 +5240,7 @@ func (x *GenerateResourceConfig_Request) String() string { func (*GenerateResourceConfig_Request) ProtoMessage() {} func (x *GenerateResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[106] + mi := &file_tfplugin6_proto_msgTypes[100] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5541,7 +5281,7 @@ type GenerateResourceConfig_Response struct { func (x *GenerateResourceConfig_Response) Reset() { *x = GenerateResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[107] + mi := &file_tfplugin6_proto_msgTypes[101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5553,7 +5293,7 @@ func (x *GenerateResourceConfig_Response) String() string { func (*GenerateResourceConfig_Response) ProtoMessage() {} func (x *GenerateResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[107] + mi := &file_tfplugin6_proto_msgTypes[101] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5613,7 +5353,7 @@ type MoveResourceState_Request struct { func (x *MoveResourceState_Request) Reset() { *x = MoveResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[108] + mi := &file_tfplugin6_proto_msgTypes[102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5625,7 +5365,7 @@ func (x *MoveResourceState_Request) String() string { func (*MoveResourceState_Request) ProtoMessage() {} func (x *MoveResourceState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[108] + mi := &file_tfplugin6_proto_msgTypes[102] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5712,7 +5452,7 @@ type MoveResourceState_Response struct { func (x *MoveResourceState_Response) Reset() { *x = MoveResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[109] + mi := &file_tfplugin6_proto_msgTypes[103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5724,7 +5464,7 @@ func (x *MoveResourceState_Response) String() string { func (*MoveResourceState_Response) ProtoMessage() {} func (x *MoveResourceState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[109] + mi := &file_tfplugin6_proto_msgTypes[103] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5780,7 +5520,7 @@ type ReadDataSource_Request struct { func (x *ReadDataSource_Request) Reset() { *x = ReadDataSource_Request{} - mi := &file_tfplugin6_proto_msgTypes[110] + mi := &file_tfplugin6_proto_msgTypes[104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5792,7 +5532,7 @@ func (x *ReadDataSource_Request) String() string { func (*ReadDataSource_Request) ProtoMessage() {} func (x *ReadDataSource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[110] + mi := &file_tfplugin6_proto_msgTypes[104] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5849,7 +5589,7 @@ type ReadDataSource_Response struct { func (x *ReadDataSource_Response) Reset() { *x = ReadDataSource_Response{} - mi := &file_tfplugin6_proto_msgTypes[111] + mi := &file_tfplugin6_proto_msgTypes[105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5861,7 +5601,7 @@ func (x *ReadDataSource_Response) String() string { func (*ReadDataSource_Response) ProtoMessage() {} func (x *ReadDataSource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[111] + mi := &file_tfplugin6_proto_msgTypes[105] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5909,7 +5649,7 @@ type OpenEphemeralResource_Request struct { func (x *OpenEphemeralResource_Request) Reset() { *x = OpenEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[112] + mi := &file_tfplugin6_proto_msgTypes[106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5921,7 +5661,7 @@ func (x *OpenEphemeralResource_Request) String() string { func (*OpenEphemeralResource_Request) ProtoMessage() {} func (x *OpenEphemeralResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[112] + mi := &file_tfplugin6_proto_msgTypes[106] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5971,7 +5711,7 @@ type OpenEphemeralResource_Response struct { func (x *OpenEphemeralResource_Response) Reset() { *x = OpenEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[113] + mi := &file_tfplugin6_proto_msgTypes[107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5983,7 +5723,7 @@ func (x *OpenEphemeralResource_Response) String() string { func (*OpenEphemeralResource_Response) ProtoMessage() {} func (x *OpenEphemeralResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[113] + mi := &file_tfplugin6_proto_msgTypes[107] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6044,7 +5784,7 @@ type RenewEphemeralResource_Request struct { func (x *RenewEphemeralResource_Request) Reset() { *x = RenewEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[114] + mi := &file_tfplugin6_proto_msgTypes[108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6056,7 +5796,7 @@ func (x *RenewEphemeralResource_Request) String() string { func (*RenewEphemeralResource_Request) ProtoMessage() {} func (x *RenewEphemeralResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[114] + mi := &file_tfplugin6_proto_msgTypes[108] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6097,7 +5837,7 @@ type RenewEphemeralResource_Response struct { func (x *RenewEphemeralResource_Response) Reset() { *x = RenewEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[115] + mi := &file_tfplugin6_proto_msgTypes[109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6109,7 +5849,7 @@ func (x *RenewEphemeralResource_Response) String() string { func (*RenewEphemeralResource_Response) ProtoMessage() {} func (x *RenewEphemeralResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[115] + mi := &file_tfplugin6_proto_msgTypes[109] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6156,7 +5896,7 @@ type CloseEphemeralResource_Request struct { func (x *CloseEphemeralResource_Request) Reset() { *x = CloseEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[116] + mi := &file_tfplugin6_proto_msgTypes[110] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6168,7 +5908,7 @@ func (x *CloseEphemeralResource_Request) String() string { func (*CloseEphemeralResource_Request) ProtoMessage() {} func (x *CloseEphemeralResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[116] + mi := &file_tfplugin6_proto_msgTypes[110] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6207,7 +5947,7 @@ type CloseEphemeralResource_Response struct { func (x *CloseEphemeralResource_Response) Reset() { *x = CloseEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[117] + mi := &file_tfplugin6_proto_msgTypes[111] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6219,7 +5959,7 @@ func (x *CloseEphemeralResource_Response) String() string { func (*CloseEphemeralResource_Response) ProtoMessage() {} func (x *CloseEphemeralResource_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[117] + mi := &file_tfplugin6_proto_msgTypes[111] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6250,7 +5990,7 @@ type GetFunctions_Request struct { func (x *GetFunctions_Request) Reset() { *x = GetFunctions_Request{} - mi := &file_tfplugin6_proto_msgTypes[118] + mi := &file_tfplugin6_proto_msgTypes[112] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6262,7 +6002,7 @@ func (x *GetFunctions_Request) String() string { func (*GetFunctions_Request) ProtoMessage() {} func (x *GetFunctions_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[118] + mi := &file_tfplugin6_proto_msgTypes[112] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6290,7 +6030,7 @@ type GetFunctions_Response struct { func (x *GetFunctions_Response) Reset() { *x = GetFunctions_Response{} - mi := &file_tfplugin6_proto_msgTypes[119] + mi := &file_tfplugin6_proto_msgTypes[113] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6302,7 +6042,7 @@ func (x *GetFunctions_Response) String() string { func (*GetFunctions_Response) ProtoMessage() {} func (x *GetFunctions_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[119] + mi := &file_tfplugin6_proto_msgTypes[113] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6342,7 +6082,7 @@ type CallFunction_Request struct { func (x *CallFunction_Request) Reset() { *x = CallFunction_Request{} - mi := &file_tfplugin6_proto_msgTypes[121] + mi := &file_tfplugin6_proto_msgTypes[115] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6354,7 +6094,7 @@ func (x *CallFunction_Request) String() string { func (*CallFunction_Request) ProtoMessage() {} func (x *CallFunction_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[121] + mi := &file_tfplugin6_proto_msgTypes[115] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6394,7 +6134,7 @@ type CallFunction_Response struct { func (x *CallFunction_Response) Reset() { *x = CallFunction_Response{} - mi := &file_tfplugin6_proto_msgTypes[122] + mi := &file_tfplugin6_proto_msgTypes[116] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6406,7 +6146,7 @@ func (x *CallFunction_Response) String() string { func (*CallFunction_Response) ProtoMessage() {} func (x *CallFunction_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[122] + mi := &file_tfplugin6_proto_msgTypes[116] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6454,7 +6194,7 @@ type ListResource_Request struct { func (x *ListResource_Request) Reset() { *x = ListResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[123] + mi := &file_tfplugin6_proto_msgTypes[117] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6466,7 +6206,7 @@ func (x *ListResource_Request) String() string { func (*ListResource_Request) ProtoMessage() {} func (x *ListResource_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[123] + mi := &file_tfplugin6_proto_msgTypes[117] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6526,7 +6266,7 @@ type ListResource_Event struct { func (x *ListResource_Event) Reset() { *x = ListResource_Event{} - mi := &file_tfplugin6_proto_msgTypes[124] + mi := &file_tfplugin6_proto_msgTypes[118] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6538,7 +6278,7 @@ func (x *ListResource_Event) String() string { func (*ListResource_Event) ProtoMessage() {} func (x *ListResource_Event) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[124] + mi := &file_tfplugin6_proto_msgTypes[118] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6594,7 +6334,7 @@ type ValidateListResourceConfig_Request struct { func (x *ValidateListResourceConfig_Request) Reset() { *x = ValidateListResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[125] + mi := &file_tfplugin6_proto_msgTypes[119] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6606,7 +6346,7 @@ func (x *ValidateListResourceConfig_Request) String() string { func (*ValidateListResourceConfig_Request) ProtoMessage() {} func (x *ValidateListResourceConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[125] + mi := &file_tfplugin6_proto_msgTypes[119] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6659,7 +6399,7 @@ type ValidateListResourceConfig_Response struct { func (x *ValidateListResourceConfig_Response) Reset() { *x = ValidateListResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[126] + mi := &file_tfplugin6_proto_msgTypes[120] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6671,7 +6411,7 @@ func (x *ValidateListResourceConfig_Response) String() string { func (*ValidateListResourceConfig_Response) ProtoMessage() {} func (x *ValidateListResourceConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[126] + mi := &file_tfplugin6_proto_msgTypes[120] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6704,7 +6444,7 @@ type ValidateStateStore_Request struct { func (x *ValidateStateStore_Request) Reset() { *x = ValidateStateStore_Request{} - mi := &file_tfplugin6_proto_msgTypes[127] + mi := &file_tfplugin6_proto_msgTypes[121] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6716,7 +6456,7 @@ func (x *ValidateStateStore_Request) String() string { func (*ValidateStateStore_Request) ProtoMessage() {} func (x *ValidateStateStore_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[127] + mi := &file_tfplugin6_proto_msgTypes[121] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6755,7 +6495,7 @@ type ValidateStateStore_Response struct { func (x *ValidateStateStore_Response) Reset() { *x = ValidateStateStore_Response{} - mi := &file_tfplugin6_proto_msgTypes[128] + mi := &file_tfplugin6_proto_msgTypes[122] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6767,7 +6507,7 @@ func (x *ValidateStateStore_Response) String() string { func (*ValidateStateStore_Response) ProtoMessage() {} func (x *ValidateStateStore_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[128] + mi := &file_tfplugin6_proto_msgTypes[122] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6791,17 +6531,16 @@ func (x *ValidateStateStore_Response) GetDiagnostics() []*Diagnostic { } type ConfigureStateStore_Request struct { - state protoimpl.MessageState `protogen:"open.v1"` - TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - Config *DynamicValue `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` - Capabilities *StateStoreClientCapabilities `protobuf:"bytes,3,opt,name=capabilities,proto3" json:"capabilities,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + Config *DynamicValue `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ConfigureStateStore_Request) Reset() { *x = ConfigureStateStore_Request{} - mi := &file_tfplugin6_proto_msgTypes[129] + mi := &file_tfplugin6_proto_msgTypes[123] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6813,7 +6552,7 @@ func (x *ConfigureStateStore_Request) String() string { func (*ConfigureStateStore_Request) ProtoMessage() {} func (x *ConfigureStateStore_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[129] + mi := &file_tfplugin6_proto_msgTypes[123] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6843,24 +6582,16 @@ func (x *ConfigureStateStore_Request) GetConfig() *DynamicValue { return nil } -func (x *ConfigureStateStore_Request) GetCapabilities() *StateStoreClientCapabilities { - if x != nil { - return x.Capabilities - } - return nil -} - type ConfigureStateStore_Response struct { - state protoimpl.MessageState `protogen:"open.v1"` - Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` - Capabilities *StateStoreServerCapabilities `protobuf:"bytes,2,opt,name=capabilities,proto3" json:"capabilities,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *ConfigureStateStore_Response) Reset() { *x = ConfigureStateStore_Response{} - mi := &file_tfplugin6_proto_msgTypes[130] + mi := &file_tfplugin6_proto_msgTypes[124] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6872,7 +6603,7 @@ func (x *ConfigureStateStore_Response) String() string { func (*ConfigureStateStore_Response) ProtoMessage() {} func (x *ConfigureStateStore_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[130] + mi := &file_tfplugin6_proto_msgTypes[124] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6895,36 +6626,28 @@ func (x *ConfigureStateStore_Response) GetDiagnostics() []*Diagnostic { return nil } -func (x *ConfigureStateStore_Response) GetCapabilities() *StateStoreServerCapabilities { - if x != nil { - return x.Capabilities - } - return nil -} - -type ReadStateBytes_Request struct { +type GetStates_Request struct { state protoimpl.MessageState `protogen:"open.v1"` TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - StateId string `protobuf:"bytes,2,opt,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ReadStateBytes_Request) Reset() { - *x = ReadStateBytes_Request{} - mi := &file_tfplugin6_proto_msgTypes[131] +func (x *GetStates_Request) Reset() { + *x = GetStates_Request{} + mi := &file_tfplugin6_proto_msgTypes[125] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ReadStateBytes_Request) String() string { +func (x *GetStates_Request) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReadStateBytes_Request) ProtoMessage() {} +func (*GetStates_Request) ProtoMessage() {} -func (x *ReadStateBytes_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[131] +func (x *GetStates_Request) ProtoReflect() protoreflect.Message { + mi := &file_tfplugin6_proto_msgTypes[125] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6935,261 +6658,29 @@ func (x *ReadStateBytes_Request) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReadStateBytes_Request.ProtoReflect.Descriptor instead. -func (*ReadStateBytes_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{42, 0} +// Deprecated: Use GetStates_Request.ProtoReflect.Descriptor instead. +func (*GetStates_Request) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{40, 0} } -func (x *ReadStateBytes_Request) GetTypeName() string { +func (x *GetStates_Request) GetTypeName() string { if x != nil { return x.TypeName } return "" } -func (x *ReadStateBytes_Request) GetStateId() string { - if x != nil { - return x.StateId - } - return "" -} - -type ReadStateBytes_Response struct { +type GetStates_Response struct { state protoimpl.MessageState `protogen:"open.v1"` - Bytes []byte `protobuf:"bytes,1,opt,name=bytes,proto3" json:"bytes,omitempty"` - TotalLength int64 `protobuf:"varint,2,opt,name=total_length,json=totalLength,proto3" json:"total_length,omitempty"` - Range *StateRange `protobuf:"bytes,3,opt,name=range,proto3" json:"range,omitempty"` - Diagnostics []*Diagnostic `protobuf:"bytes,4,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReadStateBytes_Response) Reset() { - *x = ReadStateBytes_Response{} - mi := &file_tfplugin6_proto_msgTypes[132] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReadStateBytes_Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadStateBytes_Response) ProtoMessage() {} - -func (x *ReadStateBytes_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[132] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReadStateBytes_Response.ProtoReflect.Descriptor instead. -func (*ReadStateBytes_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{42, 1} -} - -func (x *ReadStateBytes_Response) GetBytes() []byte { - if x != nil { - return x.Bytes - } - return nil -} - -func (x *ReadStateBytes_Response) GetTotalLength() int64 { - if x != nil { - return x.TotalLength - } - return 0 -} - -func (x *ReadStateBytes_Response) GetRange() *StateRange { - if x != nil { - return x.Range - } - return nil -} - -func (x *ReadStateBytes_Response) GetDiagnostics() []*Diagnostic { - if x != nil { - return x.Diagnostics - } - return nil -} - -type WriteStateBytes_RequestChunk struct { - state protoimpl.MessageState `protogen:"open.v1"` - // meta is sent with the first chunk only - Meta *RequestChunkMeta `protobuf:"bytes,1,opt,name=meta,proto3,oneof" json:"meta,omitempty"` - Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` - TotalLength int64 `protobuf:"varint,3,opt,name=total_length,json=totalLength,proto3" json:"total_length,omitempty"` - Range *StateRange `protobuf:"bytes,4,opt,name=range,proto3" json:"range,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteStateBytes_RequestChunk) Reset() { - *x = WriteStateBytes_RequestChunk{} - mi := &file_tfplugin6_proto_msgTypes[133] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteStateBytes_RequestChunk) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteStateBytes_RequestChunk) ProtoMessage() {} - -func (x *WriteStateBytes_RequestChunk) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[133] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteStateBytes_RequestChunk.ProtoReflect.Descriptor instead. -func (*WriteStateBytes_RequestChunk) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43, 0} -} - -func (x *WriteStateBytes_RequestChunk) GetMeta() *RequestChunkMeta { - if x != nil { - return x.Meta - } - return nil -} - -func (x *WriteStateBytes_RequestChunk) GetBytes() []byte { - if x != nil { - return x.Bytes - } - return nil -} - -func (x *WriteStateBytes_RequestChunk) GetTotalLength() int64 { - if x != nil { - return x.TotalLength - } - return 0 -} - -func (x *WriteStateBytes_RequestChunk) GetRange() *StateRange { - if x != nil { - return x.Range - } - return nil -} - -type WriteStateBytes_Response struct { - state protoimpl.MessageState `protogen:"open.v1"` - Diagnostics []*Diagnostic `protobuf:"bytes,1,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *WriteStateBytes_Response) Reset() { - *x = WriteStateBytes_Response{} - mi := &file_tfplugin6_proto_msgTypes[134] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *WriteStateBytes_Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WriteStateBytes_Response) ProtoMessage() {} - -func (x *WriteStateBytes_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[134] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WriteStateBytes_Response.ProtoReflect.Descriptor instead. -func (*WriteStateBytes_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1} -} - -func (x *WriteStateBytes_Response) GetDiagnostics() []*Diagnostic { - if x != nil { - return x.Diagnostics - } - return nil -} - -type GetStates_Request struct { - state protoimpl.MessageState `protogen:"open.v1"` - TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *GetStates_Request) Reset() { - *x = GetStates_Request{} - mi := &file_tfplugin6_proto_msgTypes[135] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *GetStates_Request) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetStates_Request) ProtoMessage() {} - -func (x *GetStates_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[135] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GetStates_Request.ProtoReflect.Descriptor instead. -func (*GetStates_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{46, 0} -} - -func (x *GetStates_Request) GetTypeName() string { - if x != nil { - return x.TypeName - } - return "" -} - -type GetStates_Response struct { - state protoimpl.MessageState `protogen:"open.v1"` - StateId []string `protobuf:"bytes,1,rep,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` - Diagnostics []*Diagnostic `protobuf:"bytes,2,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` + StateId []string `protobuf:"bytes,1,rep,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` + Diagnostics []*Diagnostic `protobuf:"bytes,2,rep,name=diagnostics,proto3" json:"diagnostics,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *GetStates_Response) Reset() { *x = GetStates_Response{} - mi := &file_tfplugin6_proto_msgTypes[136] + mi := &file_tfplugin6_proto_msgTypes[126] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7201,7 +6692,7 @@ func (x *GetStates_Response) String() string { func (*GetStates_Response) ProtoMessage() {} func (x *GetStates_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[136] + mi := &file_tfplugin6_proto_msgTypes[126] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7214,7 +6705,7 @@ func (x *GetStates_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStates_Response.ProtoReflect.Descriptor instead. func (*GetStates_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{46, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{40, 1} } func (x *GetStates_Response) GetStateId() []string { @@ -7241,7 +6732,7 @@ type DeleteState_Request struct { func (x *DeleteState_Request) Reset() { *x = DeleteState_Request{} - mi := &file_tfplugin6_proto_msgTypes[137] + mi := &file_tfplugin6_proto_msgTypes[127] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7253,7 +6744,7 @@ func (x *DeleteState_Request) String() string { func (*DeleteState_Request) ProtoMessage() {} func (x *DeleteState_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[137] + mi := &file_tfplugin6_proto_msgTypes[127] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7266,7 +6757,7 @@ func (x *DeleteState_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteState_Request.ProtoReflect.Descriptor instead. func (*DeleteState_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{47, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{41, 0} } func (x *DeleteState_Request) GetTypeName() string { @@ -7292,7 +6783,7 @@ type DeleteState_Response struct { func (x *DeleteState_Response) Reset() { *x = DeleteState_Response{} - mi := &file_tfplugin6_proto_msgTypes[138] + mi := &file_tfplugin6_proto_msgTypes[128] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7304,7 +6795,7 @@ func (x *DeleteState_Response) String() string { func (*DeleteState_Response) ProtoMessage() {} func (x *DeleteState_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[138] + mi := &file_tfplugin6_proto_msgTypes[128] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7317,7 +6808,7 @@ func (x *DeleteState_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteState_Response.ProtoReflect.Descriptor instead. func (*DeleteState_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{47, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{41, 1} } func (x *DeleteState_Response) GetDiagnostics() []*Diagnostic { @@ -7340,7 +6831,7 @@ type PlanAction_Request struct { func (x *PlanAction_Request) Reset() { *x = PlanAction_Request{} - mi := &file_tfplugin6_proto_msgTypes[139] + mi := &file_tfplugin6_proto_msgTypes[129] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7352,7 +6843,7 @@ func (x *PlanAction_Request) String() string { func (*PlanAction_Request) ProtoMessage() {} func (x *PlanAction_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[139] + mi := &file_tfplugin6_proto_msgTypes[129] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7365,7 +6856,7 @@ func (x *PlanAction_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use PlanAction_Request.ProtoReflect.Descriptor instead. func (*PlanAction_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{48, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{42, 0} } func (x *PlanAction_Request) GetActionType() string { @@ -7400,7 +6891,7 @@ type PlanAction_Response struct { func (x *PlanAction_Response) Reset() { *x = PlanAction_Response{} - mi := &file_tfplugin6_proto_msgTypes[140] + mi := &file_tfplugin6_proto_msgTypes[130] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7412,7 +6903,7 @@ func (x *PlanAction_Response) String() string { func (*PlanAction_Response) ProtoMessage() {} func (x *PlanAction_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[140] + mi := &file_tfplugin6_proto_msgTypes[130] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7425,7 +6916,7 @@ func (x *PlanAction_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use PlanAction_Response.ProtoReflect.Descriptor instead. func (*PlanAction_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{48, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{42, 1} } func (x *PlanAction_Response) GetDiagnostics() []*Diagnostic { @@ -7455,7 +6946,7 @@ type InvokeAction_Request struct { func (x *InvokeAction_Request) Reset() { *x = InvokeAction_Request{} - mi := &file_tfplugin6_proto_msgTypes[141] + mi := &file_tfplugin6_proto_msgTypes[131] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7467,7 +6958,7 @@ func (x *InvokeAction_Request) String() string { func (*InvokeAction_Request) ProtoMessage() {} func (x *InvokeAction_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[141] + mi := &file_tfplugin6_proto_msgTypes[131] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7480,7 +6971,7 @@ func (x *InvokeAction_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Request.ProtoReflect.Descriptor instead. func (*InvokeAction_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{49, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{43, 0} } func (x *InvokeAction_Request) GetActionType() string { @@ -7517,7 +7008,7 @@ type InvokeAction_Event struct { func (x *InvokeAction_Event) Reset() { *x = InvokeAction_Event{} - mi := &file_tfplugin6_proto_msgTypes[142] + mi := &file_tfplugin6_proto_msgTypes[132] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7529,7 +7020,7 @@ func (x *InvokeAction_Event) String() string { func (*InvokeAction_Event) ProtoMessage() {} func (x *InvokeAction_Event) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[142] + mi := &file_tfplugin6_proto_msgTypes[132] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7542,7 +7033,7 @@ func (x *InvokeAction_Event) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Event.ProtoReflect.Descriptor instead. func (*InvokeAction_Event) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{49, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1} } func (x *InvokeAction_Event) GetType() isInvokeAction_Event_Type { @@ -7596,7 +7087,7 @@ type InvokeAction_Event_Progress struct { func (x *InvokeAction_Event_Progress) Reset() { *x = InvokeAction_Event_Progress{} - mi := &file_tfplugin6_proto_msgTypes[143] + mi := &file_tfplugin6_proto_msgTypes[133] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7608,7 +7099,7 @@ func (x *InvokeAction_Event_Progress) String() string { func (*InvokeAction_Event_Progress) ProtoMessage() {} func (x *InvokeAction_Event_Progress) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[143] + mi := &file_tfplugin6_proto_msgTypes[133] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7621,7 +7112,7 @@ func (x *InvokeAction_Event_Progress) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Event_Progress.ProtoReflect.Descriptor instead. func (*InvokeAction_Event_Progress) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{49, 1, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1, 0} } func (x *InvokeAction_Event_Progress) GetMessage() string { @@ -7640,7 +7131,7 @@ type InvokeAction_Event_Completed struct { func (x *InvokeAction_Event_Completed) Reset() { *x = InvokeAction_Event_Completed{} - mi := &file_tfplugin6_proto_msgTypes[144] + mi := &file_tfplugin6_proto_msgTypes[134] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7652,7 +7143,7 @@ func (x *InvokeAction_Event_Completed) String() string { func (*InvokeAction_Event_Completed) ProtoMessage() {} func (x *InvokeAction_Event_Completed) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[144] + mi := &file_tfplugin6_proto_msgTypes[134] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7665,7 +7156,7 @@ func (x *InvokeAction_Event_Completed) ProtoReflect() protoreflect.Message { // Deprecated: Use InvokeAction_Event_Completed.ProtoReflect.Descriptor instead. func (*InvokeAction_Event_Completed) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{49, 1, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{43, 1, 1} } func (x *InvokeAction_Event_Completed) GetDiagnostics() []*Diagnostic { @@ -7685,7 +7176,7 @@ type ValidateActionConfig_Request struct { func (x *ValidateActionConfig_Request) Reset() { *x = ValidateActionConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[145] + mi := &file_tfplugin6_proto_msgTypes[135] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7697,7 +7188,7 @@ func (x *ValidateActionConfig_Request) String() string { func (*ValidateActionConfig_Request) ProtoMessage() {} func (x *ValidateActionConfig_Request) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[145] + mi := &file_tfplugin6_proto_msgTypes[135] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7710,7 +7201,7 @@ func (x *ValidateActionConfig_Request) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateActionConfig_Request.ProtoReflect.Descriptor instead. func (*ValidateActionConfig_Request) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{50, 0} + return file_tfplugin6_proto_rawDescGZIP(), []int{44, 0} } func (x *ValidateActionConfig_Request) GetTypeName() string { @@ -7736,7 +7227,7 @@ type ValidateActionConfig_Response struct { func (x *ValidateActionConfig_Response) Reset() { *x = ValidateActionConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[146] + mi := &file_tfplugin6_proto_msgTypes[136] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7748,7 +7239,7 @@ func (x *ValidateActionConfig_Response) String() string { func (*ValidateActionConfig_Response) ProtoMessage() {} func (x *ValidateActionConfig_Response) ProtoReflect() protoreflect.Message { - mi := &file_tfplugin6_proto_msgTypes[146] + mi := &file_tfplugin6_proto_msgTypes[136] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7761,7 +7252,7 @@ func (x *ValidateActionConfig_Response) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateActionConfig_Response.ProtoReflect.Descriptor instead. func (*ValidateActionConfig_Response) Descriptor() ([]byte, []int) { - return file_tfplugin6_proto_rawDescGZIP(), []int{50, 1} + return file_tfplugin6_proto_rawDescGZIP(), []int{44, 1} } func (x *ValidateActionConfig_Response) GetDiagnostics() []*Diagnostic { @@ -8209,46 +7700,13 @@ const file_tfplugin6_proto_rawDesc = "" + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12/\n" + "\x06config\x18\x02 \x01(\v2\x17.tfplugin6.DynamicValueR\x06config\x1aC\n" + "\bResponse\x127\n" + - "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\xcf\x02\n" + - "\x13ConfigureStateStore\x1a\xa4\x01\n" + + "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\xb3\x01\n" + + "\x13ConfigureStateStore\x1aW\n" + "\aRequest\x12\x1b\n" + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12/\n" + - "\x06config\x18\x02 \x01(\v2\x17.tfplugin6.DynamicValueR\x06config\x12K\n" + - "\fcapabilities\x18\x03 \x01(\v2'.tfplugin6.StateStoreClientCapabilitiesR\fcapabilities\x1a\x90\x01\n" + - "\bResponse\x127\n" + - "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\x12K\n" + - "\fcapabilities\x18\x02 \x01(\v2'.tfplugin6.StateStoreServerCapabilitiesR\fcapabilities\"=\n" + - "\x1cStateStoreClientCapabilities\x12\x1d\n" + - "\n" + - "chunk_size\x18\x01 \x01(\x03R\tchunkSize\"=\n" + - "\x1cStateStoreServerCapabilities\x12\x1d\n" + - "\n" + - "chunk_size\x18\x01 \x01(\x03R\tchunkSize\"\xff\x01\n" + - "\x0eReadStateBytes\x1aA\n" + - "\aRequest\x12\x1b\n" + - "\ttype_name\x18\x01 \x01(\tR\btypeName\x12\x19\n" + - "\bstate_id\x18\x02 \x01(\tR\astateId\x1a\xa9\x01\n" + - "\bResponse\x12\x14\n" + - "\x05bytes\x18\x01 \x01(\fR\x05bytes\x12!\n" + - "\ftotal_length\x18\x02 \x01(\x03R\vtotalLength\x12+\n" + - "\x05range\x18\x03 \x01(\v2\x15.tfplugin6.StateRangeR\x05range\x127\n" + - "\vdiagnostics\x18\x04 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\x8c\x02\n" + - "\x0fWriteStateBytes\x1a\xb3\x01\n" + - "\fRequestChunk\x124\n" + - "\x04meta\x18\x01 \x01(\v2\x1b.tfplugin6.RequestChunkMetaH\x00R\x04meta\x88\x01\x01\x12\x14\n" + - "\x05bytes\x18\x02 \x01(\fR\x05bytes\x12!\n" + - "\ftotal_length\x18\x03 \x01(\x03R\vtotalLength\x12+\n" + - "\x05range\x18\x04 \x01(\v2\x15.tfplugin6.StateRangeR\x05rangeB\a\n" + - "\x05_meta\x1aC\n" + + "\x06config\x18\x02 \x01(\v2\x17.tfplugin6.DynamicValueR\x06config\x1aC\n" + "\bResponse\x127\n" + - "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"J\n" + - "\x10RequestChunkMeta\x12\x1b\n" + - "\ttype_name\x18\x01 \x01(\tR\btypeName\x12\x19\n" + - "\bstate_id\x18\x02 \x01(\tR\astateId\"4\n" + - "\n" + - "StateRange\x12\x14\n" + - "\x05start\x18\x01 \x01(\x03R\x05start\x12\x10\n" + - "\x03end\x18\x02 \x01(\x03R\x03end\"\x93\x01\n" + + "\vdiagnostics\x18\x01 \x03(\v2\x15.tfplugin6.DiagnosticR\vdiagnostics\"\x93\x01\n" + "\tGetStates\x1a&\n" + "\aRequest\x12\x1b\n" + "\ttype_name\x18\x01 \x01(\tR\btypeName\x1a^\n" + @@ -8294,7 +7752,7 @@ const file_tfplugin6_proto_rawDesc = "" + "\n" + "StringKind\x12\t\n" + "\x05PLAIN\x10\x00\x12\f\n" + - "\bMARKDOWN\x10\x012\xe7\x1a\n" + + "\bMARKDOWN\x10\x012\xa9\x19\n" + "\bProvider\x12N\n" + "\vGetMetadata\x12\x1e.tfplugin6.GetMetadata.Request\x1a\x1f.tfplugin6.GetMetadata.Response\x12`\n" + "\x11GetProviderSchema\x12$.tfplugin6.GetProviderSchema.Request\x1a%.tfplugin6.GetProviderSchema.Response\x12o\n" + @@ -8321,9 +7779,7 @@ const file_tfplugin6_proto_rawDesc = "" + "\fGetFunctions\x12\x1f.tfplugin6.GetFunctions.Request\x1a .tfplugin6.GetFunctions.Response\x12Q\n" + "\fCallFunction\x12\x1f.tfplugin6.CallFunction.Request\x1a .tfplugin6.CallFunction.Response\x12i\n" + "\x18ValidateStateStoreConfig\x12%.tfplugin6.ValidateStateStore.Request\x1a&.tfplugin6.ValidateStateStore.Response\x12f\n" + - "\x13ConfigureStateStore\x12&.tfplugin6.ConfigureStateStore.Request\x1a'.tfplugin6.ConfigureStateStore.Response\x12Y\n" + - "\x0eReadStateBytes\x12!.tfplugin6.ReadStateBytes.Request\x1a\".tfplugin6.ReadStateBytes.Response0\x01\x12a\n" + - "\x0fWriteStateBytes\x12'.tfplugin6.WriteStateBytes.RequestChunk\x1a#.tfplugin6.WriteStateBytes.Response(\x01\x12H\n" + + "\x13ConfigureStateStore\x12&.tfplugin6.ConfigureStateStore.Request\x1a'.tfplugin6.ConfigureStateStore.Response\x12H\n" + "\tGetStates\x12\x1c.tfplugin6.GetStates.Request\x1a\x1d.tfplugin6.GetStates.Response\x12N\n" + "\vDeleteState\x12\x1e.tfplugin6.DeleteState.Request\x1a\x1f.tfplugin6.DeleteState.Response\x12K\n" + "\n" + @@ -8345,7 +7801,7 @@ func file_tfplugin6_proto_rawDescGZIP() []byte { } var file_tfplugin6_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_tfplugin6_proto_msgTypes = make([]protoimpl.MessageInfo, 147) +var file_tfplugin6_proto_msgTypes = make([]protoimpl.MessageInfo, 137) var file_tfplugin6_proto_goTypes = []any{ (StringKind)(0), // 0: tfplugin6.StringKind (Diagnostic_Severity)(0), // 1: tfplugin6.Diagnostic.Severity @@ -8392,156 +7848,146 @@ var file_tfplugin6_proto_goTypes = []any{ (*ValidateListResourceConfig)(nil), // 42: tfplugin6.ValidateListResourceConfig (*ValidateStateStore)(nil), // 43: tfplugin6.ValidateStateStore (*ConfigureStateStore)(nil), // 44: tfplugin6.ConfigureStateStore - (*StateStoreClientCapabilities)(nil), // 45: tfplugin6.StateStoreClientCapabilities - (*StateStoreServerCapabilities)(nil), // 46: tfplugin6.StateStoreServerCapabilities - (*ReadStateBytes)(nil), // 47: tfplugin6.ReadStateBytes - (*WriteStateBytes)(nil), // 48: tfplugin6.WriteStateBytes - (*RequestChunkMeta)(nil), // 49: tfplugin6.RequestChunkMeta - (*StateRange)(nil), // 50: tfplugin6.StateRange - (*GetStates)(nil), // 51: tfplugin6.GetStates - (*DeleteState)(nil), // 52: tfplugin6.DeleteState - (*PlanAction)(nil), // 53: tfplugin6.PlanAction - (*InvokeAction)(nil), // 54: tfplugin6.InvokeAction - (*ValidateActionConfig)(nil), // 55: tfplugin6.ValidateActionConfig - (*AttributePath_Step)(nil), // 56: tfplugin6.AttributePath.Step - (*StopProvider_Request)(nil), // 57: tfplugin6.StopProvider.Request - (*StopProvider_Response)(nil), // 58: tfplugin6.StopProvider.Response - nil, // 59: tfplugin6.RawState.FlatmapEntry - (*ResourceIdentitySchema_IdentityAttribute)(nil), // 60: tfplugin6.ResourceIdentitySchema.IdentityAttribute - (*Schema_Block)(nil), // 61: tfplugin6.Schema.Block - (*Schema_Attribute)(nil), // 62: tfplugin6.Schema.Attribute - (*Schema_NestedBlock)(nil), // 63: tfplugin6.Schema.NestedBlock - (*Schema_Object)(nil), // 64: tfplugin6.Schema.Object - (*Function_Parameter)(nil), // 65: tfplugin6.Function.Parameter - (*Function_Return)(nil), // 66: tfplugin6.Function.Return - (*GetMetadata_Request)(nil), // 67: tfplugin6.GetMetadata.Request - (*GetMetadata_Response)(nil), // 68: tfplugin6.GetMetadata.Response - (*GetMetadata_EphemeralMetadata)(nil), // 69: tfplugin6.GetMetadata.EphemeralMetadata - (*GetMetadata_FunctionMetadata)(nil), // 70: tfplugin6.GetMetadata.FunctionMetadata - (*GetMetadata_DataSourceMetadata)(nil), // 71: tfplugin6.GetMetadata.DataSourceMetadata - (*GetMetadata_ResourceMetadata)(nil), // 72: tfplugin6.GetMetadata.ResourceMetadata - (*GetMetadata_ListResourceMetadata)(nil), // 73: tfplugin6.GetMetadata.ListResourceMetadata - (*GetMetadata_StateStoreMetadata)(nil), // 74: tfplugin6.GetMetadata.StateStoreMetadata - (*GetMetadata_ActionMetadata)(nil), // 75: tfplugin6.GetMetadata.ActionMetadata - (*GetProviderSchema_Request)(nil), // 76: tfplugin6.GetProviderSchema.Request - (*GetProviderSchema_Response)(nil), // 77: tfplugin6.GetProviderSchema.Response - nil, // 78: tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry - nil, // 79: tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry - nil, // 80: tfplugin6.GetProviderSchema.Response.FunctionsEntry - nil, // 81: tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry - nil, // 82: tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry - nil, // 83: tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry - nil, // 84: tfplugin6.GetProviderSchema.Response.ActionSchemasEntry - (*ValidateProviderConfig_Request)(nil), // 85: tfplugin6.ValidateProviderConfig.Request - (*ValidateProviderConfig_Response)(nil), // 86: tfplugin6.ValidateProviderConfig.Response - (*UpgradeResourceState_Request)(nil), // 87: tfplugin6.UpgradeResourceState.Request - (*UpgradeResourceState_Response)(nil), // 88: tfplugin6.UpgradeResourceState.Response - (*GetResourceIdentitySchemas_Request)(nil), // 89: tfplugin6.GetResourceIdentitySchemas.Request - (*GetResourceIdentitySchemas_Response)(nil), // 90: tfplugin6.GetResourceIdentitySchemas.Response - nil, // 91: tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry - (*UpgradeResourceIdentity_Request)(nil), // 92: tfplugin6.UpgradeResourceIdentity.Request - (*UpgradeResourceIdentity_Response)(nil), // 93: tfplugin6.UpgradeResourceIdentity.Response - (*ValidateResourceConfig_Request)(nil), // 94: tfplugin6.ValidateResourceConfig.Request - (*ValidateResourceConfig_Response)(nil), // 95: tfplugin6.ValidateResourceConfig.Response - (*ValidateDataResourceConfig_Request)(nil), // 96: tfplugin6.ValidateDataResourceConfig.Request - (*ValidateDataResourceConfig_Response)(nil), // 97: tfplugin6.ValidateDataResourceConfig.Response - (*ValidateEphemeralResourceConfig_Request)(nil), // 98: tfplugin6.ValidateEphemeralResourceConfig.Request - (*ValidateEphemeralResourceConfig_Response)(nil), // 99: tfplugin6.ValidateEphemeralResourceConfig.Response - (*ConfigureProvider_Request)(nil), // 100: tfplugin6.ConfigureProvider.Request - (*ConfigureProvider_Response)(nil), // 101: tfplugin6.ConfigureProvider.Response - (*ReadResource_Request)(nil), // 102: tfplugin6.ReadResource.Request - (*ReadResource_Response)(nil), // 103: tfplugin6.ReadResource.Response - (*PlanResourceChange_Request)(nil), // 104: tfplugin6.PlanResourceChange.Request - (*PlanResourceChange_Response)(nil), // 105: tfplugin6.PlanResourceChange.Response - (*ApplyResourceChange_Request)(nil), // 106: tfplugin6.ApplyResourceChange.Request - (*ApplyResourceChange_Response)(nil), // 107: tfplugin6.ApplyResourceChange.Response - (*ImportResourceState_Request)(nil), // 108: tfplugin6.ImportResourceState.Request - (*ImportResourceState_ImportedResource)(nil), // 109: tfplugin6.ImportResourceState.ImportedResource - (*ImportResourceState_Response)(nil), // 110: tfplugin6.ImportResourceState.Response - (*GenerateResourceConfig_Request)(nil), // 111: tfplugin6.GenerateResourceConfig.Request - (*GenerateResourceConfig_Response)(nil), // 112: tfplugin6.GenerateResourceConfig.Response - (*MoveResourceState_Request)(nil), // 113: tfplugin6.MoveResourceState.Request - (*MoveResourceState_Response)(nil), // 114: tfplugin6.MoveResourceState.Response - (*ReadDataSource_Request)(nil), // 115: tfplugin6.ReadDataSource.Request - (*ReadDataSource_Response)(nil), // 116: tfplugin6.ReadDataSource.Response - (*OpenEphemeralResource_Request)(nil), // 117: tfplugin6.OpenEphemeralResource.Request - (*OpenEphemeralResource_Response)(nil), // 118: tfplugin6.OpenEphemeralResource.Response - (*RenewEphemeralResource_Request)(nil), // 119: tfplugin6.RenewEphemeralResource.Request - (*RenewEphemeralResource_Response)(nil), // 120: tfplugin6.RenewEphemeralResource.Response - (*CloseEphemeralResource_Request)(nil), // 121: tfplugin6.CloseEphemeralResource.Request - (*CloseEphemeralResource_Response)(nil), // 122: tfplugin6.CloseEphemeralResource.Response - (*GetFunctions_Request)(nil), // 123: tfplugin6.GetFunctions.Request - (*GetFunctions_Response)(nil), // 124: tfplugin6.GetFunctions.Response - nil, // 125: tfplugin6.GetFunctions.Response.FunctionsEntry - (*CallFunction_Request)(nil), // 126: tfplugin6.CallFunction.Request - (*CallFunction_Response)(nil), // 127: tfplugin6.CallFunction.Response - (*ListResource_Request)(nil), // 128: tfplugin6.ListResource.Request - (*ListResource_Event)(nil), // 129: tfplugin6.ListResource.Event - (*ValidateListResourceConfig_Request)(nil), // 130: tfplugin6.ValidateListResourceConfig.Request - (*ValidateListResourceConfig_Response)(nil), // 131: tfplugin6.ValidateListResourceConfig.Response - (*ValidateStateStore_Request)(nil), // 132: tfplugin6.ValidateStateStore.Request - (*ValidateStateStore_Response)(nil), // 133: tfplugin6.ValidateStateStore.Response - (*ConfigureStateStore_Request)(nil), // 134: tfplugin6.ConfigureStateStore.Request - (*ConfigureStateStore_Response)(nil), // 135: tfplugin6.ConfigureStateStore.Response - (*ReadStateBytes_Request)(nil), // 136: tfplugin6.ReadStateBytes.Request - (*ReadStateBytes_Response)(nil), // 137: tfplugin6.ReadStateBytes.Response - (*WriteStateBytes_RequestChunk)(nil), // 138: tfplugin6.WriteStateBytes.RequestChunk - (*WriteStateBytes_Response)(nil), // 139: tfplugin6.WriteStateBytes.Response - (*GetStates_Request)(nil), // 140: tfplugin6.GetStates.Request - (*GetStates_Response)(nil), // 141: tfplugin6.GetStates.Response - (*DeleteState_Request)(nil), // 142: tfplugin6.DeleteState.Request - (*DeleteState_Response)(nil), // 143: tfplugin6.DeleteState.Response - (*PlanAction_Request)(nil), // 144: tfplugin6.PlanAction.Request - (*PlanAction_Response)(nil), // 145: tfplugin6.PlanAction.Response - (*InvokeAction_Request)(nil), // 146: tfplugin6.InvokeAction.Request - (*InvokeAction_Event)(nil), // 147: tfplugin6.InvokeAction.Event - (*InvokeAction_Event_Progress)(nil), // 148: tfplugin6.InvokeAction.Event.Progress - (*InvokeAction_Event_Completed)(nil), // 149: tfplugin6.InvokeAction.Event.Completed - (*ValidateActionConfig_Request)(nil), // 150: tfplugin6.ValidateActionConfig.Request - (*ValidateActionConfig_Response)(nil), // 151: tfplugin6.ValidateActionConfig.Response - (*timestamppb.Timestamp)(nil), // 152: google.protobuf.Timestamp + (*GetStates)(nil), // 45: tfplugin6.GetStates + (*DeleteState)(nil), // 46: tfplugin6.DeleteState + (*PlanAction)(nil), // 47: tfplugin6.PlanAction + (*InvokeAction)(nil), // 48: tfplugin6.InvokeAction + (*ValidateActionConfig)(nil), // 49: tfplugin6.ValidateActionConfig + (*AttributePath_Step)(nil), // 50: tfplugin6.AttributePath.Step + (*StopProvider_Request)(nil), // 51: tfplugin6.StopProvider.Request + (*StopProvider_Response)(nil), // 52: tfplugin6.StopProvider.Response + nil, // 53: tfplugin6.RawState.FlatmapEntry + (*ResourceIdentitySchema_IdentityAttribute)(nil), // 54: tfplugin6.ResourceIdentitySchema.IdentityAttribute + (*Schema_Block)(nil), // 55: tfplugin6.Schema.Block + (*Schema_Attribute)(nil), // 56: tfplugin6.Schema.Attribute + (*Schema_NestedBlock)(nil), // 57: tfplugin6.Schema.NestedBlock + (*Schema_Object)(nil), // 58: tfplugin6.Schema.Object + (*Function_Parameter)(nil), // 59: tfplugin6.Function.Parameter + (*Function_Return)(nil), // 60: tfplugin6.Function.Return + (*GetMetadata_Request)(nil), // 61: tfplugin6.GetMetadata.Request + (*GetMetadata_Response)(nil), // 62: tfplugin6.GetMetadata.Response + (*GetMetadata_EphemeralMetadata)(nil), // 63: tfplugin6.GetMetadata.EphemeralMetadata + (*GetMetadata_FunctionMetadata)(nil), // 64: tfplugin6.GetMetadata.FunctionMetadata + (*GetMetadata_DataSourceMetadata)(nil), // 65: tfplugin6.GetMetadata.DataSourceMetadata + (*GetMetadata_ResourceMetadata)(nil), // 66: tfplugin6.GetMetadata.ResourceMetadata + (*GetMetadata_ListResourceMetadata)(nil), // 67: tfplugin6.GetMetadata.ListResourceMetadata + (*GetMetadata_StateStoreMetadata)(nil), // 68: tfplugin6.GetMetadata.StateStoreMetadata + (*GetMetadata_ActionMetadata)(nil), // 69: tfplugin6.GetMetadata.ActionMetadata + (*GetProviderSchema_Request)(nil), // 70: tfplugin6.GetProviderSchema.Request + (*GetProviderSchema_Response)(nil), // 71: tfplugin6.GetProviderSchema.Response + nil, // 72: tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry + nil, // 73: tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry + nil, // 74: tfplugin6.GetProviderSchema.Response.FunctionsEntry + nil, // 75: tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry + nil, // 76: tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry + nil, // 77: tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry + nil, // 78: tfplugin6.GetProviderSchema.Response.ActionSchemasEntry + (*ValidateProviderConfig_Request)(nil), // 79: tfplugin6.ValidateProviderConfig.Request + (*ValidateProviderConfig_Response)(nil), // 80: tfplugin6.ValidateProviderConfig.Response + (*UpgradeResourceState_Request)(nil), // 81: tfplugin6.UpgradeResourceState.Request + (*UpgradeResourceState_Response)(nil), // 82: tfplugin6.UpgradeResourceState.Response + (*GetResourceIdentitySchemas_Request)(nil), // 83: tfplugin6.GetResourceIdentitySchemas.Request + (*GetResourceIdentitySchemas_Response)(nil), // 84: tfplugin6.GetResourceIdentitySchemas.Response + nil, // 85: tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry + (*UpgradeResourceIdentity_Request)(nil), // 86: tfplugin6.UpgradeResourceIdentity.Request + (*UpgradeResourceIdentity_Response)(nil), // 87: tfplugin6.UpgradeResourceIdentity.Response + (*ValidateResourceConfig_Request)(nil), // 88: tfplugin6.ValidateResourceConfig.Request + (*ValidateResourceConfig_Response)(nil), // 89: tfplugin6.ValidateResourceConfig.Response + (*ValidateDataResourceConfig_Request)(nil), // 90: tfplugin6.ValidateDataResourceConfig.Request + (*ValidateDataResourceConfig_Response)(nil), // 91: tfplugin6.ValidateDataResourceConfig.Response + (*ValidateEphemeralResourceConfig_Request)(nil), // 92: tfplugin6.ValidateEphemeralResourceConfig.Request + (*ValidateEphemeralResourceConfig_Response)(nil), // 93: tfplugin6.ValidateEphemeralResourceConfig.Response + (*ConfigureProvider_Request)(nil), // 94: tfplugin6.ConfigureProvider.Request + (*ConfigureProvider_Response)(nil), // 95: tfplugin6.ConfigureProvider.Response + (*ReadResource_Request)(nil), // 96: tfplugin6.ReadResource.Request + (*ReadResource_Response)(nil), // 97: tfplugin6.ReadResource.Response + (*PlanResourceChange_Request)(nil), // 98: tfplugin6.PlanResourceChange.Request + (*PlanResourceChange_Response)(nil), // 99: tfplugin6.PlanResourceChange.Response + (*ApplyResourceChange_Request)(nil), // 100: tfplugin6.ApplyResourceChange.Request + (*ApplyResourceChange_Response)(nil), // 101: tfplugin6.ApplyResourceChange.Response + (*ImportResourceState_Request)(nil), // 102: tfplugin6.ImportResourceState.Request + (*ImportResourceState_ImportedResource)(nil), // 103: tfplugin6.ImportResourceState.ImportedResource + (*ImportResourceState_Response)(nil), // 104: tfplugin6.ImportResourceState.Response + (*GenerateResourceConfig_Request)(nil), // 105: tfplugin6.GenerateResourceConfig.Request + (*GenerateResourceConfig_Response)(nil), // 106: tfplugin6.GenerateResourceConfig.Response + (*MoveResourceState_Request)(nil), // 107: tfplugin6.MoveResourceState.Request + (*MoveResourceState_Response)(nil), // 108: tfplugin6.MoveResourceState.Response + (*ReadDataSource_Request)(nil), // 109: tfplugin6.ReadDataSource.Request + (*ReadDataSource_Response)(nil), // 110: tfplugin6.ReadDataSource.Response + (*OpenEphemeralResource_Request)(nil), // 111: tfplugin6.OpenEphemeralResource.Request + (*OpenEphemeralResource_Response)(nil), // 112: tfplugin6.OpenEphemeralResource.Response + (*RenewEphemeralResource_Request)(nil), // 113: tfplugin6.RenewEphemeralResource.Request + (*RenewEphemeralResource_Response)(nil), // 114: tfplugin6.RenewEphemeralResource.Response + (*CloseEphemeralResource_Request)(nil), // 115: tfplugin6.CloseEphemeralResource.Request + (*CloseEphemeralResource_Response)(nil), // 116: tfplugin6.CloseEphemeralResource.Response + (*GetFunctions_Request)(nil), // 117: tfplugin6.GetFunctions.Request + (*GetFunctions_Response)(nil), // 118: tfplugin6.GetFunctions.Response + nil, // 119: tfplugin6.GetFunctions.Response.FunctionsEntry + (*CallFunction_Request)(nil), // 120: tfplugin6.CallFunction.Request + (*CallFunction_Response)(nil), // 121: tfplugin6.CallFunction.Response + (*ListResource_Request)(nil), // 122: tfplugin6.ListResource.Request + (*ListResource_Event)(nil), // 123: tfplugin6.ListResource.Event + (*ValidateListResourceConfig_Request)(nil), // 124: tfplugin6.ValidateListResourceConfig.Request + (*ValidateListResourceConfig_Response)(nil), // 125: tfplugin6.ValidateListResourceConfig.Response + (*ValidateStateStore_Request)(nil), // 126: tfplugin6.ValidateStateStore.Request + (*ValidateStateStore_Response)(nil), // 127: tfplugin6.ValidateStateStore.Response + (*ConfigureStateStore_Request)(nil), // 128: tfplugin6.ConfigureStateStore.Request + (*ConfigureStateStore_Response)(nil), // 129: tfplugin6.ConfigureStateStore.Response + (*GetStates_Request)(nil), // 130: tfplugin6.GetStates.Request + (*GetStates_Response)(nil), // 131: tfplugin6.GetStates.Response + (*DeleteState_Request)(nil), // 132: tfplugin6.DeleteState.Request + (*DeleteState_Response)(nil), // 133: tfplugin6.DeleteState.Response + (*PlanAction_Request)(nil), // 134: tfplugin6.PlanAction.Request + (*PlanAction_Response)(nil), // 135: tfplugin6.PlanAction.Response + (*InvokeAction_Request)(nil), // 136: tfplugin6.InvokeAction.Request + (*InvokeAction_Event)(nil), // 137: tfplugin6.InvokeAction.Event + (*InvokeAction_Event_Progress)(nil), // 138: tfplugin6.InvokeAction.Event.Progress + (*InvokeAction_Event_Completed)(nil), // 139: tfplugin6.InvokeAction.Event.Completed + (*ValidateActionConfig_Request)(nil), // 140: tfplugin6.ValidateActionConfig.Request + (*ValidateActionConfig_Response)(nil), // 141: tfplugin6.ValidateActionConfig.Response + (*timestamppb.Timestamp)(nil), // 142: google.protobuf.Timestamp } var file_tfplugin6_proto_depIdxs = []int32{ 1, // 0: tfplugin6.Diagnostic.severity:type_name -> tfplugin6.Diagnostic.Severity 8, // 1: tfplugin6.Diagnostic.attribute:type_name -> tfplugin6.AttributePath - 56, // 2: tfplugin6.AttributePath.steps:type_name -> tfplugin6.AttributePath.Step - 59, // 3: tfplugin6.RawState.flatmap:type_name -> tfplugin6.RawState.FlatmapEntry - 60, // 4: tfplugin6.ResourceIdentitySchema.identity_attributes:type_name -> tfplugin6.ResourceIdentitySchema.IdentityAttribute + 50, // 2: tfplugin6.AttributePath.steps:type_name -> tfplugin6.AttributePath.Step + 53, // 3: tfplugin6.RawState.flatmap:type_name -> tfplugin6.RawState.FlatmapEntry + 54, // 4: tfplugin6.ResourceIdentitySchema.identity_attributes:type_name -> tfplugin6.ResourceIdentitySchema.IdentityAttribute 5, // 5: tfplugin6.ResourceIdentityData.identity_data:type_name -> tfplugin6.DynamicValue 14, // 6: tfplugin6.ActionSchema.schema:type_name -> tfplugin6.Schema - 61, // 7: tfplugin6.Schema.block:type_name -> tfplugin6.Schema.Block - 65, // 8: tfplugin6.Function.parameters:type_name -> tfplugin6.Function.Parameter - 65, // 9: tfplugin6.Function.variadic_parameter:type_name -> tfplugin6.Function.Parameter - 66, // 10: tfplugin6.Function.return:type_name -> tfplugin6.Function.Return + 55, // 7: tfplugin6.Schema.block:type_name -> tfplugin6.Schema.Block + 59, // 8: tfplugin6.Function.parameters:type_name -> tfplugin6.Function.Parameter + 59, // 9: tfplugin6.Function.variadic_parameter:type_name -> tfplugin6.Function.Parameter + 60, // 10: tfplugin6.Function.return:type_name -> tfplugin6.Function.Return 0, // 11: tfplugin6.Function.description_kind:type_name -> tfplugin6.StringKind 4, // 12: tfplugin6.Deferred.reason:type_name -> tfplugin6.Deferred.Reason - 62, // 13: tfplugin6.Schema.Block.attributes:type_name -> tfplugin6.Schema.Attribute - 63, // 14: tfplugin6.Schema.Block.block_types:type_name -> tfplugin6.Schema.NestedBlock + 56, // 13: tfplugin6.Schema.Block.attributes:type_name -> tfplugin6.Schema.Attribute + 57, // 14: tfplugin6.Schema.Block.block_types:type_name -> tfplugin6.Schema.NestedBlock 0, // 15: tfplugin6.Schema.Block.description_kind:type_name -> tfplugin6.StringKind - 64, // 16: tfplugin6.Schema.Attribute.nested_type:type_name -> tfplugin6.Schema.Object + 58, // 16: tfplugin6.Schema.Attribute.nested_type:type_name -> tfplugin6.Schema.Object 0, // 17: tfplugin6.Schema.Attribute.description_kind:type_name -> tfplugin6.StringKind - 61, // 18: tfplugin6.Schema.NestedBlock.block:type_name -> tfplugin6.Schema.Block + 55, // 18: tfplugin6.Schema.NestedBlock.block:type_name -> tfplugin6.Schema.Block 2, // 19: tfplugin6.Schema.NestedBlock.nesting:type_name -> tfplugin6.Schema.NestedBlock.NestingMode - 62, // 20: tfplugin6.Schema.Object.attributes:type_name -> tfplugin6.Schema.Attribute + 56, // 20: tfplugin6.Schema.Object.attributes:type_name -> tfplugin6.Schema.Attribute 3, // 21: tfplugin6.Schema.Object.nesting:type_name -> tfplugin6.Schema.Object.NestingMode 0, // 22: tfplugin6.Function.Parameter.description_kind:type_name -> tfplugin6.StringKind 16, // 23: tfplugin6.GetMetadata.Response.server_capabilities:type_name -> tfplugin6.ServerCapabilities 6, // 24: tfplugin6.GetMetadata.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 71, // 25: tfplugin6.GetMetadata.Response.data_sources:type_name -> tfplugin6.GetMetadata.DataSourceMetadata - 72, // 26: tfplugin6.GetMetadata.Response.resources:type_name -> tfplugin6.GetMetadata.ResourceMetadata - 70, // 27: tfplugin6.GetMetadata.Response.functions:type_name -> tfplugin6.GetMetadata.FunctionMetadata - 69, // 28: tfplugin6.GetMetadata.Response.ephemeral_resources:type_name -> tfplugin6.GetMetadata.EphemeralMetadata - 73, // 29: tfplugin6.GetMetadata.Response.list_resources:type_name -> tfplugin6.GetMetadata.ListResourceMetadata - 74, // 30: tfplugin6.GetMetadata.Response.state_stores:type_name -> tfplugin6.GetMetadata.StateStoreMetadata - 75, // 31: tfplugin6.GetMetadata.Response.actions:type_name -> tfplugin6.GetMetadata.ActionMetadata + 65, // 25: tfplugin6.GetMetadata.Response.data_sources:type_name -> tfplugin6.GetMetadata.DataSourceMetadata + 66, // 26: tfplugin6.GetMetadata.Response.resources:type_name -> tfplugin6.GetMetadata.ResourceMetadata + 64, // 27: tfplugin6.GetMetadata.Response.functions:type_name -> tfplugin6.GetMetadata.FunctionMetadata + 63, // 28: tfplugin6.GetMetadata.Response.ephemeral_resources:type_name -> tfplugin6.GetMetadata.EphemeralMetadata + 67, // 29: tfplugin6.GetMetadata.Response.list_resources:type_name -> tfplugin6.GetMetadata.ListResourceMetadata + 68, // 30: tfplugin6.GetMetadata.Response.state_stores:type_name -> tfplugin6.GetMetadata.StateStoreMetadata + 69, // 31: tfplugin6.GetMetadata.Response.actions:type_name -> tfplugin6.GetMetadata.ActionMetadata 14, // 32: tfplugin6.GetProviderSchema.Response.provider:type_name -> tfplugin6.Schema - 78, // 33: tfplugin6.GetProviderSchema.Response.resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry - 79, // 34: tfplugin6.GetProviderSchema.Response.data_source_schemas:type_name -> tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry - 80, // 35: tfplugin6.GetProviderSchema.Response.functions:type_name -> tfplugin6.GetProviderSchema.Response.FunctionsEntry - 81, // 36: tfplugin6.GetProviderSchema.Response.ephemeral_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry - 82, // 37: tfplugin6.GetProviderSchema.Response.list_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry - 83, // 38: tfplugin6.GetProviderSchema.Response.state_store_schemas:type_name -> tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry - 84, // 39: tfplugin6.GetProviderSchema.Response.action_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ActionSchemasEntry + 72, // 33: tfplugin6.GetProviderSchema.Response.resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry + 73, // 34: tfplugin6.GetProviderSchema.Response.data_source_schemas:type_name -> tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry + 74, // 35: tfplugin6.GetProviderSchema.Response.functions:type_name -> tfplugin6.GetProviderSchema.Response.FunctionsEntry + 75, // 36: tfplugin6.GetProviderSchema.Response.ephemeral_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry + 76, // 37: tfplugin6.GetProviderSchema.Response.list_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry + 77, // 38: tfplugin6.GetProviderSchema.Response.state_store_schemas:type_name -> tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry + 78, // 39: tfplugin6.GetProviderSchema.Response.action_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ActionSchemasEntry 6, // 40: tfplugin6.GetProviderSchema.Response.diagnostics:type_name -> tfplugin6.Diagnostic 14, // 41: tfplugin6.GetProviderSchema.Response.provider_meta:type_name -> tfplugin6.Schema 16, // 42: tfplugin6.GetProviderSchema.Response.server_capabilities:type_name -> tfplugin6.ServerCapabilities @@ -8557,7 +8003,7 @@ var file_tfplugin6_proto_depIdxs = []int32{ 10, // 52: tfplugin6.UpgradeResourceState.Request.raw_state:type_name -> tfplugin6.RawState 5, // 53: tfplugin6.UpgradeResourceState.Response.upgraded_state:type_name -> tfplugin6.DynamicValue 6, // 54: tfplugin6.UpgradeResourceState.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 91, // 55: tfplugin6.GetResourceIdentitySchemas.Response.identity_schemas:type_name -> tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry + 85, // 55: tfplugin6.GetResourceIdentitySchemas.Response.identity_schemas:type_name -> tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry 6, // 56: tfplugin6.GetResourceIdentitySchemas.Response.diagnostics:type_name -> tfplugin6.Diagnostic 11, // 57: tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry.value:type_name -> tfplugin6.ResourceIdentitySchema 10, // 58: tfplugin6.UpgradeResourceIdentity.Request.raw_identity:type_name -> tfplugin6.RawState @@ -8604,7 +8050,7 @@ var file_tfplugin6_proto_depIdxs = []int32{ 12, // 99: tfplugin6.ImportResourceState.Request.identity:type_name -> tfplugin6.ResourceIdentityData 5, // 100: tfplugin6.ImportResourceState.ImportedResource.state:type_name -> tfplugin6.DynamicValue 12, // 101: tfplugin6.ImportResourceState.ImportedResource.identity:type_name -> tfplugin6.ResourceIdentityData - 109, // 102: tfplugin6.ImportResourceState.Response.imported_resources:type_name -> tfplugin6.ImportResourceState.ImportedResource + 103, // 102: tfplugin6.ImportResourceState.Response.imported_resources:type_name -> tfplugin6.ImportResourceState.ImportedResource 6, // 103: tfplugin6.ImportResourceState.Response.diagnostics:type_name -> tfplugin6.Diagnostic 18, // 104: tfplugin6.ImportResourceState.Response.deferred:type_name -> tfplugin6.Deferred 5, // 105: tfplugin6.GenerateResourceConfig.Request.state:type_name -> tfplugin6.DynamicValue @@ -8624,13 +8070,13 @@ var file_tfplugin6_proto_depIdxs = []int32{ 5, // 119: tfplugin6.OpenEphemeralResource.Request.config:type_name -> tfplugin6.DynamicValue 17, // 120: tfplugin6.OpenEphemeralResource.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities 6, // 121: tfplugin6.OpenEphemeralResource.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 152, // 122: tfplugin6.OpenEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp + 142, // 122: tfplugin6.OpenEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp 5, // 123: tfplugin6.OpenEphemeralResource.Response.result:type_name -> tfplugin6.DynamicValue 18, // 124: tfplugin6.OpenEphemeralResource.Response.deferred:type_name -> tfplugin6.Deferred 6, // 125: tfplugin6.RenewEphemeralResource.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 152, // 126: tfplugin6.RenewEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp + 142, // 126: tfplugin6.RenewEphemeralResource.Response.renew_at:type_name -> google.protobuf.Timestamp 6, // 127: tfplugin6.CloseEphemeralResource.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 125, // 128: tfplugin6.GetFunctions.Response.functions:type_name -> tfplugin6.GetFunctions.Response.FunctionsEntry + 119, // 128: tfplugin6.GetFunctions.Response.functions:type_name -> tfplugin6.GetFunctions.Response.FunctionsEntry 6, // 129: tfplugin6.GetFunctions.Response.diagnostics:type_name -> tfplugin6.Diagnostic 15, // 130: tfplugin6.GetFunctions.Response.FunctionsEntry.value:type_name -> tfplugin6.Function 5, // 131: tfplugin6.CallFunction.Request.arguments:type_name -> tfplugin6.DynamicValue @@ -8647,100 +8093,89 @@ var file_tfplugin6_proto_depIdxs = []int32{ 5, // 142: tfplugin6.ValidateStateStore.Request.config:type_name -> tfplugin6.DynamicValue 6, // 143: tfplugin6.ValidateStateStore.Response.diagnostics:type_name -> tfplugin6.Diagnostic 5, // 144: tfplugin6.ConfigureStateStore.Request.config:type_name -> tfplugin6.DynamicValue - 45, // 145: tfplugin6.ConfigureStateStore.Request.capabilities:type_name -> tfplugin6.StateStoreClientCapabilities - 6, // 146: tfplugin6.ConfigureStateStore.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 46, // 147: tfplugin6.ConfigureStateStore.Response.capabilities:type_name -> tfplugin6.StateStoreServerCapabilities - 50, // 148: tfplugin6.ReadStateBytes.Response.range:type_name -> tfplugin6.StateRange - 6, // 149: tfplugin6.ReadStateBytes.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 49, // 150: tfplugin6.WriteStateBytes.RequestChunk.meta:type_name -> tfplugin6.RequestChunkMeta - 50, // 151: tfplugin6.WriteStateBytes.RequestChunk.range:type_name -> tfplugin6.StateRange - 6, // 152: tfplugin6.WriteStateBytes.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 6, // 153: tfplugin6.GetStates.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 6, // 154: tfplugin6.DeleteState.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 5, // 155: tfplugin6.PlanAction.Request.config:type_name -> tfplugin6.DynamicValue - 17, // 156: tfplugin6.PlanAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities - 6, // 157: tfplugin6.PlanAction.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 18, // 158: tfplugin6.PlanAction.Response.deferred:type_name -> tfplugin6.Deferred - 5, // 159: tfplugin6.InvokeAction.Request.config:type_name -> tfplugin6.DynamicValue - 17, // 160: tfplugin6.InvokeAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities - 148, // 161: tfplugin6.InvokeAction.Event.progress:type_name -> tfplugin6.InvokeAction.Event.Progress - 149, // 162: tfplugin6.InvokeAction.Event.completed:type_name -> tfplugin6.InvokeAction.Event.Completed - 6, // 163: tfplugin6.InvokeAction.Event.Completed.diagnostics:type_name -> tfplugin6.Diagnostic - 5, // 164: tfplugin6.ValidateActionConfig.Request.config:type_name -> tfplugin6.DynamicValue - 6, // 165: tfplugin6.ValidateActionConfig.Response.diagnostics:type_name -> tfplugin6.Diagnostic - 67, // 166: tfplugin6.Provider.GetMetadata:input_type -> tfplugin6.GetMetadata.Request - 76, // 167: tfplugin6.Provider.GetProviderSchema:input_type -> tfplugin6.GetProviderSchema.Request - 85, // 168: tfplugin6.Provider.ValidateProviderConfig:input_type -> tfplugin6.ValidateProviderConfig.Request - 94, // 169: tfplugin6.Provider.ValidateResourceConfig:input_type -> tfplugin6.ValidateResourceConfig.Request - 96, // 170: tfplugin6.Provider.ValidateDataResourceConfig:input_type -> tfplugin6.ValidateDataResourceConfig.Request - 87, // 171: tfplugin6.Provider.UpgradeResourceState:input_type -> tfplugin6.UpgradeResourceState.Request - 89, // 172: tfplugin6.Provider.GetResourceIdentitySchemas:input_type -> tfplugin6.GetResourceIdentitySchemas.Request - 92, // 173: tfplugin6.Provider.UpgradeResourceIdentity:input_type -> tfplugin6.UpgradeResourceIdentity.Request - 100, // 174: tfplugin6.Provider.ConfigureProvider:input_type -> tfplugin6.ConfigureProvider.Request - 102, // 175: tfplugin6.Provider.ReadResource:input_type -> tfplugin6.ReadResource.Request - 104, // 176: tfplugin6.Provider.PlanResourceChange:input_type -> tfplugin6.PlanResourceChange.Request - 106, // 177: tfplugin6.Provider.ApplyResourceChange:input_type -> tfplugin6.ApplyResourceChange.Request - 108, // 178: tfplugin6.Provider.ImportResourceState:input_type -> tfplugin6.ImportResourceState.Request - 113, // 179: tfplugin6.Provider.MoveResourceState:input_type -> tfplugin6.MoveResourceState.Request - 115, // 180: tfplugin6.Provider.ReadDataSource:input_type -> tfplugin6.ReadDataSource.Request - 111, // 181: tfplugin6.Provider.GenerateResourceConfig:input_type -> tfplugin6.GenerateResourceConfig.Request - 98, // 182: tfplugin6.Provider.ValidateEphemeralResourceConfig:input_type -> tfplugin6.ValidateEphemeralResourceConfig.Request - 117, // 183: tfplugin6.Provider.OpenEphemeralResource:input_type -> tfplugin6.OpenEphemeralResource.Request - 119, // 184: tfplugin6.Provider.RenewEphemeralResource:input_type -> tfplugin6.RenewEphemeralResource.Request - 121, // 185: tfplugin6.Provider.CloseEphemeralResource:input_type -> tfplugin6.CloseEphemeralResource.Request - 128, // 186: tfplugin6.Provider.ListResource:input_type -> tfplugin6.ListResource.Request - 130, // 187: tfplugin6.Provider.ValidateListResourceConfig:input_type -> tfplugin6.ValidateListResourceConfig.Request - 123, // 188: tfplugin6.Provider.GetFunctions:input_type -> tfplugin6.GetFunctions.Request - 126, // 189: tfplugin6.Provider.CallFunction:input_type -> tfplugin6.CallFunction.Request - 132, // 190: tfplugin6.Provider.ValidateStateStoreConfig:input_type -> tfplugin6.ValidateStateStore.Request - 134, // 191: tfplugin6.Provider.ConfigureStateStore:input_type -> tfplugin6.ConfigureStateStore.Request - 136, // 192: tfplugin6.Provider.ReadStateBytes:input_type -> tfplugin6.ReadStateBytes.Request - 138, // 193: tfplugin6.Provider.WriteStateBytes:input_type -> tfplugin6.WriteStateBytes.RequestChunk - 140, // 194: tfplugin6.Provider.GetStates:input_type -> tfplugin6.GetStates.Request - 142, // 195: tfplugin6.Provider.DeleteState:input_type -> tfplugin6.DeleteState.Request - 144, // 196: tfplugin6.Provider.PlanAction:input_type -> tfplugin6.PlanAction.Request - 146, // 197: tfplugin6.Provider.InvokeAction:input_type -> tfplugin6.InvokeAction.Request - 150, // 198: tfplugin6.Provider.ValidateActionConfig:input_type -> tfplugin6.ValidateActionConfig.Request - 57, // 199: tfplugin6.Provider.StopProvider:input_type -> tfplugin6.StopProvider.Request - 68, // 200: tfplugin6.Provider.GetMetadata:output_type -> tfplugin6.GetMetadata.Response - 77, // 201: tfplugin6.Provider.GetProviderSchema:output_type -> tfplugin6.GetProviderSchema.Response - 86, // 202: tfplugin6.Provider.ValidateProviderConfig:output_type -> tfplugin6.ValidateProviderConfig.Response - 95, // 203: tfplugin6.Provider.ValidateResourceConfig:output_type -> tfplugin6.ValidateResourceConfig.Response - 97, // 204: tfplugin6.Provider.ValidateDataResourceConfig:output_type -> tfplugin6.ValidateDataResourceConfig.Response - 88, // 205: tfplugin6.Provider.UpgradeResourceState:output_type -> tfplugin6.UpgradeResourceState.Response - 90, // 206: tfplugin6.Provider.GetResourceIdentitySchemas:output_type -> tfplugin6.GetResourceIdentitySchemas.Response - 93, // 207: tfplugin6.Provider.UpgradeResourceIdentity:output_type -> tfplugin6.UpgradeResourceIdentity.Response - 101, // 208: tfplugin6.Provider.ConfigureProvider:output_type -> tfplugin6.ConfigureProvider.Response - 103, // 209: tfplugin6.Provider.ReadResource:output_type -> tfplugin6.ReadResource.Response - 105, // 210: tfplugin6.Provider.PlanResourceChange:output_type -> tfplugin6.PlanResourceChange.Response - 107, // 211: tfplugin6.Provider.ApplyResourceChange:output_type -> tfplugin6.ApplyResourceChange.Response - 110, // 212: tfplugin6.Provider.ImportResourceState:output_type -> tfplugin6.ImportResourceState.Response - 114, // 213: tfplugin6.Provider.MoveResourceState:output_type -> tfplugin6.MoveResourceState.Response - 116, // 214: tfplugin6.Provider.ReadDataSource:output_type -> tfplugin6.ReadDataSource.Response - 112, // 215: tfplugin6.Provider.GenerateResourceConfig:output_type -> tfplugin6.GenerateResourceConfig.Response - 99, // 216: tfplugin6.Provider.ValidateEphemeralResourceConfig:output_type -> tfplugin6.ValidateEphemeralResourceConfig.Response - 118, // 217: tfplugin6.Provider.OpenEphemeralResource:output_type -> tfplugin6.OpenEphemeralResource.Response - 120, // 218: tfplugin6.Provider.RenewEphemeralResource:output_type -> tfplugin6.RenewEphemeralResource.Response - 122, // 219: tfplugin6.Provider.CloseEphemeralResource:output_type -> tfplugin6.CloseEphemeralResource.Response - 129, // 220: tfplugin6.Provider.ListResource:output_type -> tfplugin6.ListResource.Event - 131, // 221: tfplugin6.Provider.ValidateListResourceConfig:output_type -> tfplugin6.ValidateListResourceConfig.Response - 124, // 222: tfplugin6.Provider.GetFunctions:output_type -> tfplugin6.GetFunctions.Response - 127, // 223: tfplugin6.Provider.CallFunction:output_type -> tfplugin6.CallFunction.Response - 133, // 224: tfplugin6.Provider.ValidateStateStoreConfig:output_type -> tfplugin6.ValidateStateStore.Response - 135, // 225: tfplugin6.Provider.ConfigureStateStore:output_type -> tfplugin6.ConfigureStateStore.Response - 137, // 226: tfplugin6.Provider.ReadStateBytes:output_type -> tfplugin6.ReadStateBytes.Response - 139, // 227: tfplugin6.Provider.WriteStateBytes:output_type -> tfplugin6.WriteStateBytes.Response - 141, // 228: tfplugin6.Provider.GetStates:output_type -> tfplugin6.GetStates.Response - 143, // 229: tfplugin6.Provider.DeleteState:output_type -> tfplugin6.DeleteState.Response - 145, // 230: tfplugin6.Provider.PlanAction:output_type -> tfplugin6.PlanAction.Response - 147, // 231: tfplugin6.Provider.InvokeAction:output_type -> tfplugin6.InvokeAction.Event - 151, // 232: tfplugin6.Provider.ValidateActionConfig:output_type -> tfplugin6.ValidateActionConfig.Response - 58, // 233: tfplugin6.Provider.StopProvider:output_type -> tfplugin6.StopProvider.Response - 200, // [200:234] is the sub-list for method output_type - 166, // [166:200] is the sub-list for method input_type - 166, // [166:166] is the sub-list for extension type_name - 166, // [166:166] is the sub-list for extension extendee - 0, // [0:166] is the sub-list for field type_name + 6, // 145: tfplugin6.ConfigureStateStore.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 6, // 146: tfplugin6.GetStates.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 6, // 147: tfplugin6.DeleteState.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 5, // 148: tfplugin6.PlanAction.Request.config:type_name -> tfplugin6.DynamicValue + 17, // 149: tfplugin6.PlanAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities + 6, // 150: tfplugin6.PlanAction.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 18, // 151: tfplugin6.PlanAction.Response.deferred:type_name -> tfplugin6.Deferred + 5, // 152: tfplugin6.InvokeAction.Request.config:type_name -> tfplugin6.DynamicValue + 17, // 153: tfplugin6.InvokeAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities + 138, // 154: tfplugin6.InvokeAction.Event.progress:type_name -> tfplugin6.InvokeAction.Event.Progress + 139, // 155: tfplugin6.InvokeAction.Event.completed:type_name -> tfplugin6.InvokeAction.Event.Completed + 6, // 156: tfplugin6.InvokeAction.Event.Completed.diagnostics:type_name -> tfplugin6.Diagnostic + 5, // 157: tfplugin6.ValidateActionConfig.Request.config:type_name -> tfplugin6.DynamicValue + 6, // 158: tfplugin6.ValidateActionConfig.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 61, // 159: tfplugin6.Provider.GetMetadata:input_type -> tfplugin6.GetMetadata.Request + 70, // 160: tfplugin6.Provider.GetProviderSchema:input_type -> tfplugin6.GetProviderSchema.Request + 79, // 161: tfplugin6.Provider.ValidateProviderConfig:input_type -> tfplugin6.ValidateProviderConfig.Request + 88, // 162: tfplugin6.Provider.ValidateResourceConfig:input_type -> tfplugin6.ValidateResourceConfig.Request + 90, // 163: tfplugin6.Provider.ValidateDataResourceConfig:input_type -> tfplugin6.ValidateDataResourceConfig.Request + 81, // 164: tfplugin6.Provider.UpgradeResourceState:input_type -> tfplugin6.UpgradeResourceState.Request + 83, // 165: tfplugin6.Provider.GetResourceIdentitySchemas:input_type -> tfplugin6.GetResourceIdentitySchemas.Request + 86, // 166: tfplugin6.Provider.UpgradeResourceIdentity:input_type -> tfplugin6.UpgradeResourceIdentity.Request + 94, // 167: tfplugin6.Provider.ConfigureProvider:input_type -> tfplugin6.ConfigureProvider.Request + 96, // 168: tfplugin6.Provider.ReadResource:input_type -> tfplugin6.ReadResource.Request + 98, // 169: tfplugin6.Provider.PlanResourceChange:input_type -> tfplugin6.PlanResourceChange.Request + 100, // 170: tfplugin6.Provider.ApplyResourceChange:input_type -> tfplugin6.ApplyResourceChange.Request + 102, // 171: tfplugin6.Provider.ImportResourceState:input_type -> tfplugin6.ImportResourceState.Request + 107, // 172: tfplugin6.Provider.MoveResourceState:input_type -> tfplugin6.MoveResourceState.Request + 109, // 173: tfplugin6.Provider.ReadDataSource:input_type -> tfplugin6.ReadDataSource.Request + 105, // 174: tfplugin6.Provider.GenerateResourceConfig:input_type -> tfplugin6.GenerateResourceConfig.Request + 92, // 175: tfplugin6.Provider.ValidateEphemeralResourceConfig:input_type -> tfplugin6.ValidateEphemeralResourceConfig.Request + 111, // 176: tfplugin6.Provider.OpenEphemeralResource:input_type -> tfplugin6.OpenEphemeralResource.Request + 113, // 177: tfplugin6.Provider.RenewEphemeralResource:input_type -> tfplugin6.RenewEphemeralResource.Request + 115, // 178: tfplugin6.Provider.CloseEphemeralResource:input_type -> tfplugin6.CloseEphemeralResource.Request + 122, // 179: tfplugin6.Provider.ListResource:input_type -> tfplugin6.ListResource.Request + 124, // 180: tfplugin6.Provider.ValidateListResourceConfig:input_type -> tfplugin6.ValidateListResourceConfig.Request + 117, // 181: tfplugin6.Provider.GetFunctions:input_type -> tfplugin6.GetFunctions.Request + 120, // 182: tfplugin6.Provider.CallFunction:input_type -> tfplugin6.CallFunction.Request + 126, // 183: tfplugin6.Provider.ValidateStateStoreConfig:input_type -> tfplugin6.ValidateStateStore.Request + 128, // 184: tfplugin6.Provider.ConfigureStateStore:input_type -> tfplugin6.ConfigureStateStore.Request + 130, // 185: tfplugin6.Provider.GetStates:input_type -> tfplugin6.GetStates.Request + 132, // 186: tfplugin6.Provider.DeleteState:input_type -> tfplugin6.DeleteState.Request + 134, // 187: tfplugin6.Provider.PlanAction:input_type -> tfplugin6.PlanAction.Request + 136, // 188: tfplugin6.Provider.InvokeAction:input_type -> tfplugin6.InvokeAction.Request + 140, // 189: tfplugin6.Provider.ValidateActionConfig:input_type -> tfplugin6.ValidateActionConfig.Request + 51, // 190: tfplugin6.Provider.StopProvider:input_type -> tfplugin6.StopProvider.Request + 62, // 191: tfplugin6.Provider.GetMetadata:output_type -> tfplugin6.GetMetadata.Response + 71, // 192: tfplugin6.Provider.GetProviderSchema:output_type -> tfplugin6.GetProviderSchema.Response + 80, // 193: tfplugin6.Provider.ValidateProviderConfig:output_type -> tfplugin6.ValidateProviderConfig.Response + 89, // 194: tfplugin6.Provider.ValidateResourceConfig:output_type -> tfplugin6.ValidateResourceConfig.Response + 91, // 195: tfplugin6.Provider.ValidateDataResourceConfig:output_type -> tfplugin6.ValidateDataResourceConfig.Response + 82, // 196: tfplugin6.Provider.UpgradeResourceState:output_type -> tfplugin6.UpgradeResourceState.Response + 84, // 197: tfplugin6.Provider.GetResourceIdentitySchemas:output_type -> tfplugin6.GetResourceIdentitySchemas.Response + 87, // 198: tfplugin6.Provider.UpgradeResourceIdentity:output_type -> tfplugin6.UpgradeResourceIdentity.Response + 95, // 199: tfplugin6.Provider.ConfigureProvider:output_type -> tfplugin6.ConfigureProvider.Response + 97, // 200: tfplugin6.Provider.ReadResource:output_type -> tfplugin6.ReadResource.Response + 99, // 201: tfplugin6.Provider.PlanResourceChange:output_type -> tfplugin6.PlanResourceChange.Response + 101, // 202: tfplugin6.Provider.ApplyResourceChange:output_type -> tfplugin6.ApplyResourceChange.Response + 104, // 203: tfplugin6.Provider.ImportResourceState:output_type -> tfplugin6.ImportResourceState.Response + 108, // 204: tfplugin6.Provider.MoveResourceState:output_type -> tfplugin6.MoveResourceState.Response + 110, // 205: tfplugin6.Provider.ReadDataSource:output_type -> tfplugin6.ReadDataSource.Response + 106, // 206: tfplugin6.Provider.GenerateResourceConfig:output_type -> tfplugin6.GenerateResourceConfig.Response + 93, // 207: tfplugin6.Provider.ValidateEphemeralResourceConfig:output_type -> tfplugin6.ValidateEphemeralResourceConfig.Response + 112, // 208: tfplugin6.Provider.OpenEphemeralResource:output_type -> tfplugin6.OpenEphemeralResource.Response + 114, // 209: tfplugin6.Provider.RenewEphemeralResource:output_type -> tfplugin6.RenewEphemeralResource.Response + 116, // 210: tfplugin6.Provider.CloseEphemeralResource:output_type -> tfplugin6.CloseEphemeralResource.Response + 123, // 211: tfplugin6.Provider.ListResource:output_type -> tfplugin6.ListResource.Event + 125, // 212: tfplugin6.Provider.ValidateListResourceConfig:output_type -> tfplugin6.ValidateListResourceConfig.Response + 118, // 213: tfplugin6.Provider.GetFunctions:output_type -> tfplugin6.GetFunctions.Response + 121, // 214: tfplugin6.Provider.CallFunction:output_type -> tfplugin6.CallFunction.Response + 127, // 215: tfplugin6.Provider.ValidateStateStoreConfig:output_type -> tfplugin6.ValidateStateStore.Response + 129, // 216: tfplugin6.Provider.ConfigureStateStore:output_type -> tfplugin6.ConfigureStateStore.Response + 131, // 217: tfplugin6.Provider.GetStates:output_type -> tfplugin6.GetStates.Response + 133, // 218: tfplugin6.Provider.DeleteState:output_type -> tfplugin6.DeleteState.Response + 135, // 219: tfplugin6.Provider.PlanAction:output_type -> tfplugin6.PlanAction.Response + 137, // 220: tfplugin6.Provider.InvokeAction:output_type -> tfplugin6.InvokeAction.Event + 141, // 221: tfplugin6.Provider.ValidateActionConfig:output_type -> tfplugin6.ValidateActionConfig.Response + 52, // 222: tfplugin6.Provider.StopProvider:output_type -> tfplugin6.StopProvider.Response + 191, // [191:223] is the sub-list for method output_type + 159, // [159:191] is the sub-list for method input_type + 159, // [159:159] is the sub-list for extension type_name + 159, // [159:159] is the sub-list for extension extendee + 0, // [0:159] is the sub-list for field type_name } func init() { file_tfplugin6_proto_init() } @@ -8749,18 +8184,17 @@ func file_tfplugin6_proto_init() { return } file_tfplugin6_proto_msgTypes[2].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[51].OneofWrappers = []any{ + file_tfplugin6_proto_msgTypes[45].OneofWrappers = []any{ (*AttributePath_Step_AttributeName)(nil), (*AttributePath_Step_ElementKeyString)(nil), (*AttributePath_Step_ElementKeyInt)(nil), } - file_tfplugin6_proto_msgTypes[113].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[114].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[115].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[116].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[124].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[133].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[142].OneofWrappers = []any{ + file_tfplugin6_proto_msgTypes[107].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[108].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[109].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[110].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[118].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[132].OneofWrappers = []any{ (*InvokeAction_Event_Progress_)(nil), (*InvokeAction_Event_Completed_)(nil), } @@ -8770,7 +8204,7 @@ func file_tfplugin6_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_tfplugin6_proto_rawDesc), len(file_tfplugin6_proto_rawDesc)), NumEnums: 5, - NumMessages: 147, + NumMessages: 137, NumExtensions: 0, NumServices: 1, }, @@ -8783,3 +8217,1300 @@ func file_tfplugin6_proto_init() { file_tfplugin6_proto_goTypes = nil file_tfplugin6_proto_depIdxs = nil } + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// ProviderClient is the client API for Provider service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ProviderClient interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) + ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) + ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) + ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) + UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) + PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) + ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) + ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) + MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) + ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) + GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) + ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) + // ValidateStateStoreConfig performs configuration validation + ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) + // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider + ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) + // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store + GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) + // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) + DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) + // ////// Actions + PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) + InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) + ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) +} + +type providerClient struct { + cc grpc.ClientConnInterface +} + +func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { + return &providerClient{cc} +} + +func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { + out := new(GetMetadata_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetMetadata", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { + out := new(GetProviderSchema_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetProviderSchema", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) { + out := new(ValidateProviderConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateProviderConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) { + out := new(ValidateResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) { + out := new(ValidateDataResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateDataResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { + out := new(UpgradeResourceState_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/UpgradeResourceState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { + out := new(GetResourceIdentitySchemas_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetResourceIdentitySchemas", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { + out := new(UpgradeResourceIdentity_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/UpgradeResourceIdentity", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) { + out := new(ConfigureProvider_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ConfigureProvider", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { + out := new(ReadResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ReadResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { + out := new(PlanResourceChange_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/PlanResourceChange", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { + out := new(ApplyResourceChange_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ApplyResourceChange", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { + out := new(ImportResourceState_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ImportResourceState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { + out := new(MoveResourceState_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/MoveResourceState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { + out := new(ReadDataSource_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ReadDataSource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { + out := new(GenerateResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GenerateResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { + out := new(ValidateEphemeralResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateEphemeralResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { + out := new(OpenEphemeralResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/OpenEphemeralResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { + out := new(RenewEphemeralResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/RenewEphemeralResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { + out := new(CloseEphemeralResource_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/CloseEphemeralResource", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { + stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[0], "/tfplugin6.Provider/ListResource", opts...) + if err != nil { + return nil, err + } + x := &providerListResourceClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_ListResourceClient interface { + Recv() (*ListResource_Event, error) + grpc.ClientStream +} + +type providerListResourceClient struct { + grpc.ClientStream +} + +func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { + m := new(ListResource_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { + out := new(ValidateListResourceConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateListResourceConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { + out := new(GetFunctions_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetFunctions", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { + out := new(CallFunction_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/CallFunction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) { + out := new(ValidateStateStore_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateStateStoreConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) { + out := new(ConfigureStateStore_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ConfigureStateStore", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) { + out := new(GetStates_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/GetStates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) { + out := new(DeleteState_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/DeleteState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { + out := new(PlanAction_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/PlanAction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { + stream, err := c.cc.NewStream(ctx, &_Provider_serviceDesc.Streams[1], "/tfplugin6.Provider/InvokeAction", opts...) + if err != nil { + return nil, err + } + x := &providerInvokeActionClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Provider_InvokeActionClient interface { + Recv() (*InvokeAction_Event, error) + grpc.ClientStream +} + +type providerInvokeActionClient struct { + grpc.ClientStream +} + +func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { + m := new(InvokeAction_Event) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { + out := new(ValidateActionConfig_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/ValidateActionConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *providerClient) StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) { + out := new(StopProvider_Response) + err := c.cc.Invoke(ctx, "/tfplugin6.Provider/StopProvider", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ProviderServer is the server API for Provider service. +type ProviderServer interface { + // GetMetadata returns upfront information about server capabilities and + // supported resource types without requiring the server to instantiate all + // schema information, which may be memory intensive. + // This method is CURRENTLY UNUSED and it serves mostly for convenience + // of code generation inside of terraform-plugin-mux. + GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) + // GetSchema returns schema information for the provider, data resources, + // and managed resources. + GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) + ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) + ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) + ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) + UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) + // GetResourceIdentitySchemas returns the identity schemas for all managed + // resources. + GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) + // UpgradeResourceIdentityData should return the upgraded resource identity + // data for a managed resource type. + UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) + // ////// One-time initialization, called before other functions below + ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) + // ////// Managed Resource Lifecycle + ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) + PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) + ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) + ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) + MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) + ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) + GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) + // ////// Ephemeral Resource Lifecycle + ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) + OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) + RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) + CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) + // ///// List + ListResource(*ListResource_Request, Provider_ListResourceServer) error + ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) + // GetFunctions returns the definitions of all functions. + GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) + // ////// Provider-contributed Functions + CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) + // ValidateStateStoreConfig performs configuration validation + ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) + // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider + ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) + // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store + GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) + // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) + DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) + // ////// Actions + PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) + InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error + ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) + // ////// Graceful Shutdown + StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) +} + +// UnimplementedProviderServer can be embedded to have forward compatible implementations. +type UnimplementedProviderServer struct { +} + +func (*UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") +} +func (*UnimplementedProviderServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") +} +func (*UnimplementedProviderServer) ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateProviderConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateDataResourceConfig not implemented") +} +func (*UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") +} +func (*UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") +} +func (*UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") +} +func (*UnimplementedProviderServer) ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigureProvider not implemented") +} +func (*UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") +} +func (*UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") +} +func (*UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") +} +func (*UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") +} +func (*UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") +} +func (*UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") +} +func (*UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") +} +func (*UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") +} +func (*UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") +} +func (*UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") +} +func (*UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { + return status.Errorf(codes.Unimplemented, "method ListResource not implemented") +} +func (*UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") +} +func (*UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") +} +func (*UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") +} +func (*UnimplementedProviderServer) ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateStateStoreConfig not implemented") +} +func (*UnimplementedProviderServer) ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ConfigureStateStore not implemented") +} +func (*UnimplementedProviderServer) GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetStates not implemented") +} +func (*UnimplementedProviderServer) DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteState not implemented") +} +func (*UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") +} +func (*UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { + return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") +} +func (*UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") +} +func (*UnimplementedProviderServer) StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopProvider not implemented") +} + +func RegisterProviderServer(s *grpc.Server, srv ProviderServer) { + s.RegisterService(&_Provider_serviceDesc, srv) +} + +func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMetadata_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/GetMetadata", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetProviderSchema_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetProviderSchema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/GetProviderSchema", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateProviderConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateProviderConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ValidateProviderConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateProviderConfig(ctx, req.(*ValidateProviderConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ValidateResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateResourceConfig(ctx, req.(*ValidateResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateDataResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateDataResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateDataResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ValidateDataResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateDataResourceConfig(ctx, req.(*ValidateDataResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/UpgradeResourceState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetResourceIdentitySchemas_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/GetResourceIdentitySchemas", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpgradeResourceIdentity_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/UpgradeResourceIdentity", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ConfigureProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigureProvider_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ConfigureProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ConfigureProvider", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ConfigureProvider(ctx, req.(*ConfigureProvider_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ReadResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/PlanResourceChange", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ApplyResourceChange_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ApplyResourceChange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ApplyResourceChange", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImportResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ImportResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ImportResourceState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MoveResourceState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).MoveResourceState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/MoveResourceState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadDataSource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ReadDataSource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ReadDataSource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GenerateResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/GenerateResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateEphemeralResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ValidateEphemeralResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(OpenEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).OpenEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/OpenEphemeralResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RenewEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).RenewEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/RenewEphemeralResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CloseEphemeralResource_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CloseEphemeralResource(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/CloseEphemeralResource", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListResource_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) +} + +type Provider_ListResourceServer interface { + Send(*ListResource_Event) error + grpc.ServerStream +} + +type providerListResourceServer struct { + grpc.ServerStream +} + +func (x *providerListResourceServer) Send(m *ListResource_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateListResourceConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ValidateListResourceConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFunctions_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetFunctions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/GetFunctions", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CallFunction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).CallFunction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/CallFunction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ValidateStateStoreConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateStateStore_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateStateStoreConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ValidateStateStoreConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateStateStoreConfig(ctx, req.(*ValidateStateStore_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_ConfigureStateStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ConfigureStateStore_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ConfigureStateStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ConfigureStateStore", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ConfigureStateStore(ctx, req.(*ConfigureStateStore_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_GetStates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStates_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).GetStates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/GetStates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).GetStates(ctx, req.(*GetStates_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_DeleteState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteState_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).DeleteState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/DeleteState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).DeleteState(ctx, req.(*DeleteState_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PlanAction_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).PlanAction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/PlanAction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(InvokeAction_Request) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) +} + +type Provider_InvokeActionServer interface { + Send(*InvokeAction_Event) error + grpc.ServerStream +} + +type providerInvokeActionServer struct { + grpc.ServerStream +} + +func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { + return x.ServerStream.SendMsg(m) +} + +func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ValidateActionConfig_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).ValidateActionConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/ValidateActionConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) + } + return interceptor(ctx, in, info, handler) +} + +func _Provider_StopProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopProvider_Request) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ProviderServer).StopProvider(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/tfplugin6.Provider/StopProvider", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ProviderServer).StopProvider(ctx, req.(*StopProvider_Request)) + } + return interceptor(ctx, in, info, handler) +} + +var _Provider_serviceDesc = grpc.ServiceDesc{ + ServiceName: "tfplugin6.Provider", + HandlerType: (*ProviderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetMetadata", + Handler: _Provider_GetMetadata_Handler, + }, + { + MethodName: "GetProviderSchema", + Handler: _Provider_GetProviderSchema_Handler, + }, + { + MethodName: "ValidateProviderConfig", + Handler: _Provider_ValidateProviderConfig_Handler, + }, + { + MethodName: "ValidateResourceConfig", + Handler: _Provider_ValidateResourceConfig_Handler, + }, + { + MethodName: "ValidateDataResourceConfig", + Handler: _Provider_ValidateDataResourceConfig_Handler, + }, + { + MethodName: "UpgradeResourceState", + Handler: _Provider_UpgradeResourceState_Handler, + }, + { + MethodName: "GetResourceIdentitySchemas", + Handler: _Provider_GetResourceIdentitySchemas_Handler, + }, + { + MethodName: "UpgradeResourceIdentity", + Handler: _Provider_UpgradeResourceIdentity_Handler, + }, + { + MethodName: "ConfigureProvider", + Handler: _Provider_ConfigureProvider_Handler, + }, + { + MethodName: "ReadResource", + Handler: _Provider_ReadResource_Handler, + }, + { + MethodName: "PlanResourceChange", + Handler: _Provider_PlanResourceChange_Handler, + }, + { + MethodName: "ApplyResourceChange", + Handler: _Provider_ApplyResourceChange_Handler, + }, + { + MethodName: "ImportResourceState", + Handler: _Provider_ImportResourceState_Handler, + }, + { + MethodName: "MoveResourceState", + Handler: _Provider_MoveResourceState_Handler, + }, + { + MethodName: "ReadDataSource", + Handler: _Provider_ReadDataSource_Handler, + }, + { + MethodName: "GenerateResourceConfig", + Handler: _Provider_GenerateResourceConfig_Handler, + }, + { + MethodName: "ValidateEphemeralResourceConfig", + Handler: _Provider_ValidateEphemeralResourceConfig_Handler, + }, + { + MethodName: "OpenEphemeralResource", + Handler: _Provider_OpenEphemeralResource_Handler, + }, + { + MethodName: "RenewEphemeralResource", + Handler: _Provider_RenewEphemeralResource_Handler, + }, + { + MethodName: "CloseEphemeralResource", + Handler: _Provider_CloseEphemeralResource_Handler, + }, + { + MethodName: "ValidateListResourceConfig", + Handler: _Provider_ValidateListResourceConfig_Handler, + }, + { + MethodName: "GetFunctions", + Handler: _Provider_GetFunctions_Handler, + }, + { + MethodName: "CallFunction", + Handler: _Provider_CallFunction_Handler, + }, + { + MethodName: "ValidateStateStoreConfig", + Handler: _Provider_ValidateStateStoreConfig_Handler, + }, + { + MethodName: "ConfigureStateStore", + Handler: _Provider_ConfigureStateStore_Handler, + }, + { + MethodName: "GetStates", + Handler: _Provider_GetStates_Handler, + }, + { + MethodName: "DeleteState", + Handler: _Provider_DeleteState_Handler, + }, + { + MethodName: "PlanAction", + Handler: _Provider_PlanAction_Handler, + }, + { + MethodName: "ValidateActionConfig", + Handler: _Provider_ValidateActionConfig_Handler, + }, + { + MethodName: "StopProvider", + Handler: _Provider_StopProvider_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListResource", + Handler: _Provider_ListResource_Handler, + ServerStreams: true, + }, + { + StreamName: "InvokeAction", + Handler: _Provider_InvokeAction_Handler, + ServerStreams: true, + }, + }, + Metadata: "tfplugin6.proto", +} diff --git a/internal/tfplugin6/tfplugin6_grpc.pb.go b/internal/tfplugin6/tfplugin6_grpc.pb.go deleted file mode 100644 index d1baecae02e1..000000000000 --- a/internal/tfplugin6/tfplugin6_grpc.pb.go +++ /dev/null @@ -1,1515 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -// Terraform Plugin RPC protocol version 6.10 -// -// This file defines version 6.10 of the RPC protocol. To implement a plugin -// against this protocol, copy this definition into your own codebase and -// use protoc to generate stubs for your target language. -// -// Any minor versions of protocol 6 to follow should modify this file while -// maintaining backwards compatibility. Breaking changes, if any are required, -// will come in a subsequent major version with its own separate proto definition. -// -// Note that only the proto files included in a release tag of Terraform are -// official protocol releases. Proto files taken from other commits may include -// incomplete changes or features that did not make it into a final release. -// In all reasonable cases, plugin developers should take the proto file from -// the tag of the most recent release of Terraform, and not from the main -// branch or any other development branch. -// - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc v3.15.6 -// source: tfplugin6.proto - -package tfplugin6 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Provider_GetMetadata_FullMethodName = "/tfplugin6.Provider/GetMetadata" - Provider_GetProviderSchema_FullMethodName = "/tfplugin6.Provider/GetProviderSchema" - Provider_ValidateProviderConfig_FullMethodName = "/tfplugin6.Provider/ValidateProviderConfig" - Provider_ValidateResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateResourceConfig" - Provider_ValidateDataResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateDataResourceConfig" - Provider_UpgradeResourceState_FullMethodName = "/tfplugin6.Provider/UpgradeResourceState" - Provider_GetResourceIdentitySchemas_FullMethodName = "/tfplugin6.Provider/GetResourceIdentitySchemas" - Provider_UpgradeResourceIdentity_FullMethodName = "/tfplugin6.Provider/UpgradeResourceIdentity" - Provider_ConfigureProvider_FullMethodName = "/tfplugin6.Provider/ConfigureProvider" - Provider_ReadResource_FullMethodName = "/tfplugin6.Provider/ReadResource" - Provider_PlanResourceChange_FullMethodName = "/tfplugin6.Provider/PlanResourceChange" - Provider_ApplyResourceChange_FullMethodName = "/tfplugin6.Provider/ApplyResourceChange" - Provider_ImportResourceState_FullMethodName = "/tfplugin6.Provider/ImportResourceState" - Provider_MoveResourceState_FullMethodName = "/tfplugin6.Provider/MoveResourceState" - Provider_ReadDataSource_FullMethodName = "/tfplugin6.Provider/ReadDataSource" - Provider_GenerateResourceConfig_FullMethodName = "/tfplugin6.Provider/GenerateResourceConfig" - Provider_ValidateEphemeralResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateEphemeralResourceConfig" - Provider_OpenEphemeralResource_FullMethodName = "/tfplugin6.Provider/OpenEphemeralResource" - Provider_RenewEphemeralResource_FullMethodName = "/tfplugin6.Provider/RenewEphemeralResource" - Provider_CloseEphemeralResource_FullMethodName = "/tfplugin6.Provider/CloseEphemeralResource" - Provider_ListResource_FullMethodName = "/tfplugin6.Provider/ListResource" - Provider_ValidateListResourceConfig_FullMethodName = "/tfplugin6.Provider/ValidateListResourceConfig" - Provider_GetFunctions_FullMethodName = "/tfplugin6.Provider/GetFunctions" - Provider_CallFunction_FullMethodName = "/tfplugin6.Provider/CallFunction" - Provider_ValidateStateStoreConfig_FullMethodName = "/tfplugin6.Provider/ValidateStateStoreConfig" - Provider_ConfigureStateStore_FullMethodName = "/tfplugin6.Provider/ConfigureStateStore" - Provider_ReadStateBytes_FullMethodName = "/tfplugin6.Provider/ReadStateBytes" - Provider_WriteStateBytes_FullMethodName = "/tfplugin6.Provider/WriteStateBytes" - Provider_GetStates_FullMethodName = "/tfplugin6.Provider/GetStates" - Provider_DeleteState_FullMethodName = "/tfplugin6.Provider/DeleteState" - Provider_PlanAction_FullMethodName = "/tfplugin6.Provider/PlanAction" - Provider_InvokeAction_FullMethodName = "/tfplugin6.Provider/InvokeAction" - Provider_ValidateActionConfig_FullMethodName = "/tfplugin6.Provider/ValidateActionConfig" - Provider_StopProvider_FullMethodName = "/tfplugin6.Provider/StopProvider" -) - -// ProviderClient is the client API for Provider service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type ProviderClient interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) - ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) - ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) - ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) - UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) - PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) - ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) - ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) - MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) - ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) - GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) - ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) - // ValidateStateStoreConfig performs configuration validation - ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) - // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider - ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) - // ReadStateBytes streams byte chunks of a given state file from a state store - ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) - // WriteStateBytes streams byte chunks of a given state file into a state store - WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) - // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store - GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) - // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) - DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) - // ////// Actions - PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) - InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) - ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) -} - -type providerClient struct { - cc grpc.ClientConnInterface -} - -func NewProviderClient(cc grpc.ClientConnInterface) ProviderClient { - return &providerClient{cc} -} - -func (c *providerClient) GetMetadata(ctx context.Context, in *GetMetadata_Request, opts ...grpc.CallOption) (*GetMetadata_Response, error) { - out := new(GetMetadata_Response) - err := c.cc.Invoke(ctx, Provider_GetMetadata_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetProviderSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) { - out := new(GetProviderSchema_Response) - err := c.cc.Invoke(ctx, Provider_GetProviderSchema_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateProviderConfig(ctx context.Context, in *ValidateProviderConfig_Request, opts ...grpc.CallOption) (*ValidateProviderConfig_Response, error) { - out := new(ValidateProviderConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateProviderConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateResourceConfig(ctx context.Context, in *ValidateResourceConfig_Request, opts ...grpc.CallOption) (*ValidateResourceConfig_Response, error) { - out := new(ValidateResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateDataResourceConfig(ctx context.Context, in *ValidateDataResourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataResourceConfig_Response, error) { - out := new(ValidateDataResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateDataResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) { - out := new(UpgradeResourceState_Response) - err := c.cc.Invoke(ctx, Provider_UpgradeResourceState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetResourceIdentitySchemas(ctx context.Context, in *GetResourceIdentitySchemas_Request, opts ...grpc.CallOption) (*GetResourceIdentitySchemas_Response, error) { - out := new(GetResourceIdentitySchemas_Response) - err := c.cc.Invoke(ctx, Provider_GetResourceIdentitySchemas_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) UpgradeResourceIdentity(ctx context.Context, in *UpgradeResourceIdentity_Request, opts ...grpc.CallOption) (*UpgradeResourceIdentity_Response, error) { - out := new(UpgradeResourceIdentity_Response) - err := c.cc.Invoke(ctx, Provider_UpgradeResourceIdentity_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ConfigureProvider(ctx context.Context, in *ConfigureProvider_Request, opts ...grpc.CallOption) (*ConfigureProvider_Response, error) { - out := new(ConfigureProvider_Response) - err := c.cc.Invoke(ctx, Provider_ConfigureProvider_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) { - out := new(ReadResource_Response) - err := c.cc.Invoke(ctx, Provider_ReadResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) { - out := new(PlanResourceChange_Response) - err := c.cc.Invoke(ctx, Provider_PlanResourceChange_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) { - out := new(ApplyResourceChange_Response) - err := c.cc.Invoke(ctx, Provider_ApplyResourceChange_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) { - out := new(ImportResourceState_Response) - err := c.cc.Invoke(ctx, Provider_ImportResourceState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) MoveResourceState(ctx context.Context, in *MoveResourceState_Request, opts ...grpc.CallOption) (*MoveResourceState_Response, error) { - out := new(MoveResourceState_Response) - err := c.cc.Invoke(ctx, Provider_MoveResourceState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) { - out := new(ReadDataSource_Response) - err := c.cc.Invoke(ctx, Provider_ReadDataSource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GenerateResourceConfig(ctx context.Context, in *GenerateResourceConfig_Request, opts ...grpc.CallOption) (*GenerateResourceConfig_Response, error) { - out := new(GenerateResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_GenerateResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateEphemeralResourceConfig(ctx context.Context, in *ValidateEphemeralResourceConfig_Request, opts ...grpc.CallOption) (*ValidateEphemeralResourceConfig_Response, error) { - out := new(ValidateEphemeralResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateEphemeralResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) OpenEphemeralResource(ctx context.Context, in *OpenEphemeralResource_Request, opts ...grpc.CallOption) (*OpenEphemeralResource_Response, error) { - out := new(OpenEphemeralResource_Response) - err := c.cc.Invoke(ctx, Provider_OpenEphemeralResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) RenewEphemeralResource(ctx context.Context, in *RenewEphemeralResource_Request, opts ...grpc.CallOption) (*RenewEphemeralResource_Response, error) { - out := new(RenewEphemeralResource_Response) - err := c.cc.Invoke(ctx, Provider_RenewEphemeralResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CloseEphemeralResource(ctx context.Context, in *CloseEphemeralResource_Request, opts ...grpc.CallOption) (*CloseEphemeralResource_Response, error) { - out := new(CloseEphemeralResource_Response) - err := c.cc.Invoke(ctx, Provider_CloseEphemeralResource_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ListResource(ctx context.Context, in *ListResource_Request, opts ...grpc.CallOption) (Provider_ListResourceClient, error) { - stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[0], Provider_ListResource_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &providerListResourceClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_ListResourceClient interface { - Recv() (*ListResource_Event, error) - grpc.ClientStream -} - -type providerListResourceClient struct { - grpc.ClientStream -} - -func (x *providerListResourceClient) Recv() (*ListResource_Event, error) { - m := new(ListResource_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateListResourceConfig(ctx context.Context, in *ValidateListResourceConfig_Request, opts ...grpc.CallOption) (*ValidateListResourceConfig_Response, error) { - out := new(ValidateListResourceConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateListResourceConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) GetFunctions(ctx context.Context, in *GetFunctions_Request, opts ...grpc.CallOption) (*GetFunctions_Response, error) { - out := new(GetFunctions_Response) - err := c.cc.Invoke(ctx, Provider_GetFunctions_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) CallFunction(ctx context.Context, in *CallFunction_Request, opts ...grpc.CallOption) (*CallFunction_Response, error) { - out := new(CallFunction_Response) - err := c.cc.Invoke(ctx, Provider_CallFunction_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ValidateStateStoreConfig(ctx context.Context, in *ValidateStateStore_Request, opts ...grpc.CallOption) (*ValidateStateStore_Response, error) { - out := new(ValidateStateStore_Response) - err := c.cc.Invoke(ctx, Provider_ValidateStateStoreConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ConfigureStateStore(ctx context.Context, in *ConfigureStateStore_Request, opts ...grpc.CallOption) (*ConfigureStateStore_Response, error) { - out := new(ConfigureStateStore_Response) - err := c.cc.Invoke(ctx, Provider_ConfigureStateStore_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) ReadStateBytes(ctx context.Context, in *ReadStateBytes_Request, opts ...grpc.CallOption) (Provider_ReadStateBytesClient, error) { - stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[1], Provider_ReadStateBytes_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &providerReadStateBytesClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_ReadStateBytesClient interface { - Recv() (*ReadStateBytes_Response, error) - grpc.ClientStream -} - -type providerReadStateBytesClient struct { - grpc.ClientStream -} - -func (x *providerReadStateBytesClient) Recv() (*ReadStateBytes_Response, error) { - m := new(ReadStateBytes_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) WriteStateBytes(ctx context.Context, opts ...grpc.CallOption) (Provider_WriteStateBytesClient, error) { - stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[2], Provider_WriteStateBytes_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &providerWriteStateBytesClient{stream} - return x, nil -} - -type Provider_WriteStateBytesClient interface { - Send(*WriteStateBytes_RequestChunk) error - CloseAndRecv() (*WriteStateBytes_Response, error) - grpc.ClientStream -} - -type providerWriteStateBytesClient struct { - grpc.ClientStream -} - -func (x *providerWriteStateBytesClient) Send(m *WriteStateBytes_RequestChunk) error { - return x.ClientStream.SendMsg(m) -} - -func (x *providerWriteStateBytesClient) CloseAndRecv() (*WriteStateBytes_Response, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(WriteStateBytes_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) GetStates(ctx context.Context, in *GetStates_Request, opts ...grpc.CallOption) (*GetStates_Response, error) { - out := new(GetStates_Response) - err := c.cc.Invoke(ctx, Provider_GetStates_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) DeleteState(ctx context.Context, in *DeleteState_Request, opts ...grpc.CallOption) (*DeleteState_Response, error) { - out := new(DeleteState_Response) - err := c.cc.Invoke(ctx, Provider_DeleteState_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) PlanAction(ctx context.Context, in *PlanAction_Request, opts ...grpc.CallOption) (*PlanAction_Response, error) { - out := new(PlanAction_Response) - err := c.cc.Invoke(ctx, Provider_PlanAction_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) InvokeAction(ctx context.Context, in *InvokeAction_Request, opts ...grpc.CallOption) (Provider_InvokeActionClient, error) { - stream, err := c.cc.NewStream(ctx, &Provider_ServiceDesc.Streams[3], Provider_InvokeAction_FullMethodName, opts...) - if err != nil { - return nil, err - } - x := &providerInvokeActionClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type Provider_InvokeActionClient interface { - Recv() (*InvokeAction_Event, error) - grpc.ClientStream -} - -type providerInvokeActionClient struct { - grpc.ClientStream -} - -func (x *providerInvokeActionClient) Recv() (*InvokeAction_Event, error) { - m := new(InvokeAction_Event) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *providerClient) ValidateActionConfig(ctx context.Context, in *ValidateActionConfig_Request, opts ...grpc.CallOption) (*ValidateActionConfig_Response, error) { - out := new(ValidateActionConfig_Response) - err := c.cc.Invoke(ctx, Provider_ValidateActionConfig_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *providerClient) StopProvider(ctx context.Context, in *StopProvider_Request, opts ...grpc.CallOption) (*StopProvider_Response, error) { - out := new(StopProvider_Response) - err := c.cc.Invoke(ctx, Provider_StopProvider_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ProviderServer is the server API for Provider service. -// All implementations should embed UnimplementedProviderServer -// for forward compatibility -type ProviderServer interface { - // GetMetadata returns upfront information about server capabilities and - // supported resource types without requiring the server to instantiate all - // schema information, which may be memory intensive. - // This method is CURRENTLY UNUSED and it serves mostly for convenience - // of code generation inside of terraform-plugin-mux. - GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) - // GetSchema returns schema information for the provider, data resources, - // and managed resources. - GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) - ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) - ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) - ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) - UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) - // GetResourceIdentitySchemas returns the identity schemas for all managed - // resources. - GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) - // UpgradeResourceIdentityData should return the upgraded resource identity - // data for a managed resource type. - UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) - // ////// One-time initialization, called before other functions below - ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) - // ////// Managed Resource Lifecycle - ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) - PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) - ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) - ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) - MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) - ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) - GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) - // ////// Ephemeral Resource Lifecycle - ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) - OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) - RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) - CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) - // ///// List - ListResource(*ListResource_Request, Provider_ListResourceServer) error - ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) - // GetFunctions returns the definitions of all functions. - GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) - // ////// Provider-contributed Functions - CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) - // ValidateStateStoreConfig performs configuration validation - ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) - // ConfigureStateStore configures the state store, such as S3 connection in the context of already configured provider - ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) - // ReadStateBytes streams byte chunks of a given state file from a state store - ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error - // WriteStateBytes streams byte chunks of a given state file into a state store - WriteStateBytes(Provider_WriteStateBytesServer) error - // GetStates returns a list of all states (i.e. CE workspaces) managed by a given state store - GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) - // DeleteState instructs a given state store to delete a specific state (i.e. a CE workspace) - DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) - // ////// Actions - PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) - InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error - ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) - // ////// Graceful Shutdown - StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) -} - -// UnimplementedProviderServer should be embedded to have forward compatible implementations. -type UnimplementedProviderServer struct { -} - -func (UnimplementedProviderServer) GetMetadata(context.Context, *GetMetadata_Request) (*GetMetadata_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMetadata not implemented") -} -func (UnimplementedProviderServer) GetProviderSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetProviderSchema not implemented") -} -func (UnimplementedProviderServer) ValidateProviderConfig(context.Context, *ValidateProviderConfig_Request) (*ValidateProviderConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateProviderConfig not implemented") -} -func (UnimplementedProviderServer) ValidateResourceConfig(context.Context, *ValidateResourceConfig_Request) (*ValidateResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceConfig not implemented") -} -func (UnimplementedProviderServer) ValidateDataResourceConfig(context.Context, *ValidateDataResourceConfig_Request) (*ValidateDataResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateDataResourceConfig not implemented") -} -func (UnimplementedProviderServer) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") -} -func (UnimplementedProviderServer) GetResourceIdentitySchemas(context.Context, *GetResourceIdentitySchemas_Request) (*GetResourceIdentitySchemas_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetResourceIdentitySchemas not implemented") -} -func (UnimplementedProviderServer) UpgradeResourceIdentity(context.Context, *UpgradeResourceIdentity_Request) (*UpgradeResourceIdentity_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceIdentity not implemented") -} -func (UnimplementedProviderServer) ConfigureProvider(context.Context, *ConfigureProvider_Request) (*ConfigureProvider_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigureProvider not implemented") -} -func (UnimplementedProviderServer) ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") -} -func (UnimplementedProviderServer) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") -} -func (UnimplementedProviderServer) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") -} -func (UnimplementedProviderServer) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") -} -func (UnimplementedProviderServer) MoveResourceState(context.Context, *MoveResourceState_Request) (*MoveResourceState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method MoveResourceState not implemented") -} -func (UnimplementedProviderServer) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") -} -func (UnimplementedProviderServer) GenerateResourceConfig(context.Context, *GenerateResourceConfig_Request) (*GenerateResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GenerateResourceConfig not implemented") -} -func (UnimplementedProviderServer) ValidateEphemeralResourceConfig(context.Context, *ValidateEphemeralResourceConfig_Request) (*ValidateEphemeralResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateEphemeralResourceConfig not implemented") -} -func (UnimplementedProviderServer) OpenEphemeralResource(context.Context, *OpenEphemeralResource_Request) (*OpenEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method OpenEphemeralResource not implemented") -} -func (UnimplementedProviderServer) RenewEphemeralResource(context.Context, *RenewEphemeralResource_Request) (*RenewEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method RenewEphemeralResource not implemented") -} -func (UnimplementedProviderServer) CloseEphemeralResource(context.Context, *CloseEphemeralResource_Request) (*CloseEphemeralResource_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CloseEphemeralResource not implemented") -} -func (UnimplementedProviderServer) ListResource(*ListResource_Request, Provider_ListResourceServer) error { - return status.Errorf(codes.Unimplemented, "method ListResource not implemented") -} -func (UnimplementedProviderServer) ValidateListResourceConfig(context.Context, *ValidateListResourceConfig_Request) (*ValidateListResourceConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateListResourceConfig not implemented") -} -func (UnimplementedProviderServer) GetFunctions(context.Context, *GetFunctions_Request) (*GetFunctions_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetFunctions not implemented") -} -func (UnimplementedProviderServer) CallFunction(context.Context, *CallFunction_Request) (*CallFunction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method CallFunction not implemented") -} -func (UnimplementedProviderServer) ValidateStateStoreConfig(context.Context, *ValidateStateStore_Request) (*ValidateStateStore_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateStateStoreConfig not implemented") -} -func (UnimplementedProviderServer) ConfigureStateStore(context.Context, *ConfigureStateStore_Request) (*ConfigureStateStore_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigureStateStore not implemented") -} -func (UnimplementedProviderServer) ReadStateBytes(*ReadStateBytes_Request, Provider_ReadStateBytesServer) error { - return status.Errorf(codes.Unimplemented, "method ReadStateBytes not implemented") -} -func (UnimplementedProviderServer) WriteStateBytes(Provider_WriteStateBytesServer) error { - return status.Errorf(codes.Unimplemented, "method WriteStateBytes not implemented") -} -func (UnimplementedProviderServer) GetStates(context.Context, *GetStates_Request) (*GetStates_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetStates not implemented") -} -func (UnimplementedProviderServer) DeleteState(context.Context, *DeleteState_Request) (*DeleteState_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteState not implemented") -} -func (UnimplementedProviderServer) PlanAction(context.Context, *PlanAction_Request) (*PlanAction_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method PlanAction not implemented") -} -func (UnimplementedProviderServer) InvokeAction(*InvokeAction_Request, Provider_InvokeActionServer) error { - return status.Errorf(codes.Unimplemented, "method InvokeAction not implemented") -} -func (UnimplementedProviderServer) ValidateActionConfig(context.Context, *ValidateActionConfig_Request) (*ValidateActionConfig_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateActionConfig not implemented") -} -func (UnimplementedProviderServer) StopProvider(context.Context, *StopProvider_Request) (*StopProvider_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method StopProvider not implemented") -} - -// UnsafeProviderServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ProviderServer will -// result in compilation errors. -type UnsafeProviderServer interface { - mustEmbedUnimplementedProviderServer() -} - -func RegisterProviderServer(s grpc.ServiceRegistrar, srv ProviderServer) { - s.RegisterService(&Provider_ServiceDesc, srv) -} - -func _Provider_GetMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMetadata_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetMetadata(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetMetadata_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetMetadata(ctx, req.(*GetMetadata_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetProviderSchema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetProviderSchema_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetProviderSchema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetProviderSchema_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetProviderSchema(ctx, req.(*GetProviderSchema_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateProviderConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateProviderConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateProviderConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateProviderConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateProviderConfig(ctx, req.(*ValidateProviderConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateResourceConfig(ctx, req.(*ValidateResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateDataResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateDataResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateDataResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateDataResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateDataResourceConfig(ctx, req.(*ValidateDataResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_UpgradeResourceState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceState(ctx, req.(*UpgradeResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetResourceIdentitySchemas_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetResourceIdentitySchemas_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetResourceIdentitySchemas_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetResourceIdentitySchemas(ctx, req.(*GetResourceIdentitySchemas_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_UpgradeResourceIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(UpgradeResourceIdentity_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_UpgradeResourceIdentity_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).UpgradeResourceIdentity(ctx, req.(*UpgradeResourceIdentity_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ConfigureProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigureProvider_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ConfigureProvider(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ConfigureProvider_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ConfigureProvider(ctx, req.(*ConfigureProvider_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ReadResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadResource(ctx, req.(*ReadResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_PlanResourceChange_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanResourceChange(ctx, req.(*PlanResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ApplyResourceChange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ApplyResourceChange_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ApplyResourceChange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ApplyResourceChange_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ApplyResourceChange(ctx, req.(*ApplyResourceChange_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ImportResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ImportResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ImportResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ImportResourceState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ImportResourceState(ctx, req.(*ImportResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_MoveResourceState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MoveResourceState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).MoveResourceState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_MoveResourceState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).MoveResourceState(ctx, req.(*MoveResourceState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadDataSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReadDataSource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ReadDataSource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ReadDataSource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ReadDataSource(ctx, req.(*ReadDataSource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GenerateResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GenerateResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GenerateResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GenerateResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GenerateResourceConfig(ctx, req.(*GenerateResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateEphemeralResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateEphemeralResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateEphemeralResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateEphemeralResourceConfig(ctx, req.(*ValidateEphemeralResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_OpenEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(OpenEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).OpenEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_OpenEphemeralResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).OpenEphemeralResource(ctx, req.(*OpenEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_RenewEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(RenewEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).RenewEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_RenewEphemeralResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).RenewEphemeralResource(ctx, req.(*RenewEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CloseEphemeralResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CloseEphemeralResource_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CloseEphemeralResource(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_CloseEphemeralResource_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CloseEphemeralResource(ctx, req.(*CloseEphemeralResource_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ListResource_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ListResource_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).ListResource(m, &providerListResourceServer{stream}) -} - -type Provider_ListResourceServer interface { - Send(*ListResource_Event) error - grpc.ServerStream -} - -type providerListResourceServer struct { - grpc.ServerStream -} - -func (x *providerListResourceServer) Send(m *ListResource_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateListResourceConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateListResourceConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateListResourceConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateListResourceConfig(ctx, req.(*ValidateListResourceConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_GetFunctions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetFunctions_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetFunctions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetFunctions_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetFunctions(ctx, req.(*GetFunctions_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_CallFunction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CallFunction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).CallFunction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_CallFunction_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).CallFunction(ctx, req.(*CallFunction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ValidateStateStoreConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateStateStore_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateStateStoreConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateStateStoreConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateStateStoreConfig(ctx, req.(*ValidateStateStore_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ConfigureStateStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ConfigureStateStore_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ConfigureStateStore(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ConfigureStateStore_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ConfigureStateStore(ctx, req.(*ConfigureStateStore_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_ReadStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(ReadStateBytes_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).ReadStateBytes(m, &providerReadStateBytesServer{stream}) -} - -type Provider_ReadStateBytesServer interface { - Send(*ReadStateBytes_Response) error - grpc.ServerStream -} - -type providerReadStateBytesServer struct { - grpc.ServerStream -} - -func (x *providerReadStateBytesServer) Send(m *ReadStateBytes_Response) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_WriteStateBytes_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ProviderServer).WriteStateBytes(&providerWriteStateBytesServer{stream}) -} - -type Provider_WriteStateBytesServer interface { - SendAndClose(*WriteStateBytes_Response) error - Recv() (*WriteStateBytes_RequestChunk, error) - grpc.ServerStream -} - -type providerWriteStateBytesServer struct { - grpc.ServerStream -} - -func (x *providerWriteStateBytesServer) SendAndClose(m *WriteStateBytes_Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *providerWriteStateBytesServer) Recv() (*WriteStateBytes_RequestChunk, error) { - m := new(WriteStateBytes_RequestChunk) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _Provider_GetStates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetStates_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).GetStates(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_GetStates_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).GetStates(ctx, req.(*GetStates_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_DeleteState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeleteState_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).DeleteState(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_DeleteState_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).DeleteState(ctx, req.(*DeleteState_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_PlanAction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PlanAction_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).PlanAction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_PlanAction_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).PlanAction(ctx, req.(*PlanAction_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_InvokeAction_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(InvokeAction_Request) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(ProviderServer).InvokeAction(m, &providerInvokeActionServer{stream}) -} - -type Provider_InvokeActionServer interface { - Send(*InvokeAction_Event) error - grpc.ServerStream -} - -type providerInvokeActionServer struct { - grpc.ServerStream -} - -func (x *providerInvokeActionServer) Send(m *InvokeAction_Event) error { - return x.ServerStream.SendMsg(m) -} - -func _Provider_ValidateActionConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ValidateActionConfig_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).ValidateActionConfig(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_ValidateActionConfig_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).ValidateActionConfig(ctx, req.(*ValidateActionConfig_Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _Provider_StopProvider_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(StopProvider_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ProviderServer).StopProvider(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Provider_StopProvider_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ProviderServer).StopProvider(ctx, req.(*StopProvider_Request)) - } - return interceptor(ctx, in, info, handler) -} - -// Provider_ServiceDesc is the grpc.ServiceDesc for Provider service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Provider_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "tfplugin6.Provider", - HandlerType: (*ProviderServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetMetadata", - Handler: _Provider_GetMetadata_Handler, - }, - { - MethodName: "GetProviderSchema", - Handler: _Provider_GetProviderSchema_Handler, - }, - { - MethodName: "ValidateProviderConfig", - Handler: _Provider_ValidateProviderConfig_Handler, - }, - { - MethodName: "ValidateResourceConfig", - Handler: _Provider_ValidateResourceConfig_Handler, - }, - { - MethodName: "ValidateDataResourceConfig", - Handler: _Provider_ValidateDataResourceConfig_Handler, - }, - { - MethodName: "UpgradeResourceState", - Handler: _Provider_UpgradeResourceState_Handler, - }, - { - MethodName: "GetResourceIdentitySchemas", - Handler: _Provider_GetResourceIdentitySchemas_Handler, - }, - { - MethodName: "UpgradeResourceIdentity", - Handler: _Provider_UpgradeResourceIdentity_Handler, - }, - { - MethodName: "ConfigureProvider", - Handler: _Provider_ConfigureProvider_Handler, - }, - { - MethodName: "ReadResource", - Handler: _Provider_ReadResource_Handler, - }, - { - MethodName: "PlanResourceChange", - Handler: _Provider_PlanResourceChange_Handler, - }, - { - MethodName: "ApplyResourceChange", - Handler: _Provider_ApplyResourceChange_Handler, - }, - { - MethodName: "ImportResourceState", - Handler: _Provider_ImportResourceState_Handler, - }, - { - MethodName: "MoveResourceState", - Handler: _Provider_MoveResourceState_Handler, - }, - { - MethodName: "ReadDataSource", - Handler: _Provider_ReadDataSource_Handler, - }, - { - MethodName: "GenerateResourceConfig", - Handler: _Provider_GenerateResourceConfig_Handler, - }, - { - MethodName: "ValidateEphemeralResourceConfig", - Handler: _Provider_ValidateEphemeralResourceConfig_Handler, - }, - { - MethodName: "OpenEphemeralResource", - Handler: _Provider_OpenEphemeralResource_Handler, - }, - { - MethodName: "RenewEphemeralResource", - Handler: _Provider_RenewEphemeralResource_Handler, - }, - { - MethodName: "CloseEphemeralResource", - Handler: _Provider_CloseEphemeralResource_Handler, - }, - { - MethodName: "ValidateListResourceConfig", - Handler: _Provider_ValidateListResourceConfig_Handler, - }, - { - MethodName: "GetFunctions", - Handler: _Provider_GetFunctions_Handler, - }, - { - MethodName: "CallFunction", - Handler: _Provider_CallFunction_Handler, - }, - { - MethodName: "ValidateStateStoreConfig", - Handler: _Provider_ValidateStateStoreConfig_Handler, - }, - { - MethodName: "ConfigureStateStore", - Handler: _Provider_ConfigureStateStore_Handler, - }, - { - MethodName: "GetStates", - Handler: _Provider_GetStates_Handler, - }, - { - MethodName: "DeleteState", - Handler: _Provider_DeleteState_Handler, - }, - { - MethodName: "PlanAction", - Handler: _Provider_PlanAction_Handler, - }, - { - MethodName: "ValidateActionConfig", - Handler: _Provider_ValidateActionConfig_Handler, - }, - { - MethodName: "StopProvider", - Handler: _Provider_StopProvider_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "ListResource", - Handler: _Provider_ListResource_Handler, - ServerStreams: true, - }, - { - StreamName: "ReadStateBytes", - Handler: _Provider_ReadStateBytes_Handler, - ServerStreams: true, - }, - { - StreamName: "WriteStateBytes", - Handler: _Provider_WriteStateBytes_Handler, - ClientStreams: true, - }, - { - StreamName: "InvokeAction", - Handler: _Provider_InvokeAction_Handler, - ServerStreams: true, - }, - }, - Metadata: "tfplugin6.proto", -} diff --git a/main.go b/main.go index fd4d88f137e6..cce3f5f998ad 100644 --- a/main.go +++ b/main.go @@ -5,8 +5,10 @@ package main import ( "context" + "encoding/json" "fmt" "log" + "net" "os" "path/filepath" "runtime" @@ -16,10 +18,10 @@ import ( "github.com/hashicorp/cli" "github.com/hashicorp/go-plugin" "github.com/hashicorp/terraform-svchost/disco" + "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/command/cliconfig" "github.com/hashicorp/terraform/internal/command/format" "github.com/hashicorp/terraform/internal/didyoumean" - "github.com/hashicorp/terraform/internal/getproviders/reattach" "github.com/hashicorp/terraform/internal/httpclient" "github.com/hashicorp/terraform/internal/logging" "github.com/hashicorp/terraform/internal/terminal" @@ -202,7 +204,7 @@ func realMain() int { // The user can declare that certain providers are being managed on // Terraform's behalf using this environment variable. This is used // primarily by the SDK's acceptance testing framework. - unmanagedProviders, err := reattach.ParseReattachProviders(os.Getenv(reattach.TF_REATTACH_PROVIDERS)) + unmanagedProviders, err := parseReattachProviders(os.Getenv("TF_REATTACH_PROVIDERS")) if err != nil { Ui.Error(err.Error()) return 1 @@ -400,6 +402,58 @@ func mergeEnvArgs(envName string, cmd string, args []string) ([]string, error) { return newArgs, nil } +// parse information on reattaching to unmanaged providers out of a +// JSON-encoded environment variable. +func parseReattachProviders(in string) (map[addrs.Provider]*plugin.ReattachConfig, error) { + unmanagedProviders := map[addrs.Provider]*plugin.ReattachConfig{} + if in != "" { + type reattachConfig struct { + Protocol string + ProtocolVersion int + Addr struct { + Network string + String string + } + Pid int + Test bool + } + var m map[string]reattachConfig + err := json.Unmarshal([]byte(in), &m) + if err != nil { + return unmanagedProviders, fmt.Errorf("Invalid format for TF_REATTACH_PROVIDERS: %w", err) + } + for p, c := range m { + a, diags := addrs.ParseProviderSourceString(p) + if diags.HasErrors() { + return unmanagedProviders, fmt.Errorf("Error parsing %q as a provider address: %w", a, diags.Err()) + } + var addr net.Addr + switch c.Addr.Network { + case "unix": + addr, err = net.ResolveUnixAddr("unix", c.Addr.String) + if err != nil { + return unmanagedProviders, fmt.Errorf("Invalid unix socket path %q for %q: %w", c.Addr.String, p, err) + } + case "tcp": + addr, err = net.ResolveTCPAddr("tcp", c.Addr.String) + if err != nil { + return unmanagedProviders, fmt.Errorf("Invalid TCP address %q for %q: %w", c.Addr.String, p, err) + } + default: + return unmanagedProviders, fmt.Errorf("Unknown address type %q for %q", c.Addr.Network, p) + } + unmanagedProviders[a] = &plugin.ReattachConfig{ + Protocol: plugin.Protocol(c.Protocol), + ProtocolVersion: c.ProtocolVersion, + Pid: c.Pid, + Test: c.Test, + Addr: addr, + } + } + } + return unmanagedProviders, nil +} + func extractChdirOption(args []string) (string, []string, error) { if len(args) == 0 { return "", args, nil diff --git a/tools/protobuf-compile/protobuf-compile.go b/tools/protobuf-compile/protobuf-compile.go index c3e950f8b130..f9bff7acac13 100644 --- a/tools/protobuf-compile/protobuf-compile.go +++ b/tools/protobuf-compile/protobuf-compile.go @@ -33,7 +33,7 @@ const protocVersion = "3.15.6" // in Go modules our version selection for these comes from our top-level // go.mod, as with all other Go dependencies. If you want to switch to a newer // version of either tool then you can upgrade their modules in the usual way. -const protocGenGoPackage = "google.golang.org/protobuf/cmd/protoc-gen-go" +const protocGenGoPackage = "github.com/golang/protobuf/protoc-gen-go" const protocGenGoGrpcPackage = "google.golang.org/grpc/cmd/protoc-gen-go-grpc" type protocStep struct { @@ -46,68 +46,30 @@ var protocSteps = []protocStep{ { "tfplugin5 (provider wire protocol version 5)", "internal/tfplugin5", - []string{ - "--go_out=.", - "--go_opt=paths=source_relative", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=require_unimplemented_servers=false", - "./tfplugin5.proto", - }, + []string{"--go_out=paths=source_relative,plugins=grpc:.", "./tfplugin5.proto"}, }, { "tfplugin6 (provider wire protocol version 6)", "internal/tfplugin6", - []string{ - "--go_out=.", - "--go_opt=paths=source_relative", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=require_unimplemented_servers=false", - "./tfplugin6.proto", - }, + []string{"--go_out=paths=source_relative,plugins=grpc:.", "./tfplugin6.proto"}, }, { "terraform1 (Terraform Core RPC API)", "internal/rpcapi/terraform1", - []string{ - "--go_out=.", - "--go_opt=paths=source_relative", - "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", - "--go-grpc_opt=require_unimplemented_servers=false", - "./terraform1.proto", - }, + []string{"--go_out=paths=source_relative,plugins=grpc:.", "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", "./terraform1.proto"}, }, { "terraform1 (Terraform Core RPC API) setup", "internal/rpcapi/terraform1/setup", - []string{ - "--go_out=.", - "--go_opt=paths=source_relative", - "--go_opt=Msetup.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/setup", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=Msetup.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/setup", - "--go-grpc_opt=require_unimplemented_servers=false", - "./setup.proto", - }, + []string{"--go_out=paths=source_relative,plugins=grpc:.", "--go_opt=Msetup.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/setup", "./setup.proto"}, }, { "terraform1 (Terraform Core RPC API) dependencies", "internal/rpcapi/terraform1/dependencies", []string{ - "--go_out=.", - "--go_opt=paths=source_relative", + "--go_out=paths=source_relative,plugins=grpc:.", "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", "--go_opt=Mdependencies.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/dependencies", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", - "--go-grpc_opt=Mdependencies.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/dependencies", - "--go-grpc_opt=require_unimplemented_servers=false", "-I.", "-I..", "./dependencies.proto", @@ -117,15 +79,9 @@ var protocSteps = []protocStep{ "terraform1 (Terraform Core RPC API) stacks", "internal/rpcapi/terraform1/stacks", []string{ - "--go_out=.", - "--go_opt=paths=source_relative", + "--go_out=paths=source_relative,plugins=grpc:.", "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", "--go_opt=Mstacks.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/stacks", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", - "--go-grpc_opt=Mstacks.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/stacks", - "--go-grpc_opt=require_unimplemented_servers=false", "-I.", "-I..", "./stacks.proto", @@ -135,15 +91,9 @@ var protocSteps = []protocStep{ "terraform1 (Terraform Core RPC API) packages", "internal/rpcapi/terraform1/packages", []string{ - "--go_out=.", - "--go_opt=paths=source_relative", - "--go_opt=Mpackages.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/packages", + "--go_out=paths=source_relative,plugins=grpc:.", "--go_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=Mpackages.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/packages", - "--go-grpc_opt=Mterraform1.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1", - "--go-grpc_opt=require_unimplemented_servers=false", + "--go_opt=Mpackages.proto=github.com/hashicorp/terraform/internal/rpcapi/terraform1/packages", "-I.", "-I..", "./packages.proto", @@ -152,45 +102,22 @@ var protocSteps = []protocStep{ { "tfplan (plan file serialization)", "internal/plans/planproto", - []string{ - "--go_out=paths=source_relative:.", - "planfile.proto", - }, + []string{"--go_out=paths=source_relative:.", "planfile.proto"}, }, { "tfstackdata1 (Internal data formats for Stack state and plan)", "internal/stacks/tfstackdata1", - []string{ - "--go_out=paths=source_relative:.", - "--go_opt=Mtfstackdata1.proto=github.com/hashicorp/terraform/internal/stacks/tfstackdata1", - "-I.", - "-I../../plans/planproto", - "./tfstackdata1.proto", - }, + []string{"--go_out=paths=source_relative:.", "--go_opt=Mtfstackdata1.proto=github.com/hashicorp/terraform/internal/stacks/tfstackdata1", "-I.", "-I../../plans/planproto", "./tfstackdata1.proto"}, }, { "cloudproto1 (cloud protocol version 1)", "internal/cloudplugin/cloudproto1", - []string{ - "--go_out=.", - "--go_opt=paths=source_relative", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=require_unimplemented_servers=false", - "cloudproto1.proto", - }, + []string{"--go_out=paths=source_relative,plugins=grpc:.", "cloudproto1.proto"}, }, { "stacksproto1 (stacks protocol version 1)", "internal/stacksplugin/stacksproto1", - []string{ - "--go_out=.", - "--go_opt=paths=source_relative", - "--go-grpc_out=.", - "--go-grpc_opt=paths=source_relative", - "--go-grpc_opt=require_unimplemented_servers=false", - "stacksproto1.proto", - }, + []string{"--go_out=paths=source_relative,plugins=grpc:.", "stacksproto1.proto"}, }, } @@ -217,7 +144,7 @@ func main() { if err != nil { log.Fatal(err) } - protocGenGoGrpcExec, err := buildProtocGenGoGrpc(workDir) + _, err = buildProtocGenGoGrpc(workDir) if err != nil { log.Fatal(err) } @@ -230,7 +157,7 @@ func main() { if err != nil { log.Fatal(err) } - protocGenGoGrpcExec, err = filepath.Abs(protocGenGoGrpcExec) + protocGenGoGrpcExec, err := filepath.Abs(protocGenGoExec) if err != nil { log.Fatal(err) } @@ -248,16 +175,12 @@ func main() { cmd := &exec.Cmd{ Path: cmdLine[0], - Args: cmdLine, + Args: cmdLine[1:], Dir: step.WorkDir, Env: os.Environ(), Stdout: os.Stdout, Stderr: os.Stderr, } - log.Printf("running command: %s", cmd.String()) - wd, _ := os.Getwd() - log.Printf("from directory: %s", wd) - err := cmd.Run() if err != nil { log.Printf("failed to compile: %s", err) diff --git a/version/VERSION b/version/VERSION index 9a4866bbcede..2f2e08cfa3bf 100644 --- a/version/VERSION +++ b/version/VERSION @@ -1 +1 @@ -1.15.0-dev +1.14.0-dev From f606451a4b8e19d2c72533b17e9a128cb915ee13 Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Wed, 1 Oct 2025 13:50:54 +0000 Subject: [PATCH 26/27] backport of commit 87ee7e393890987081fd4f8f1b5e30caa5afd355 --- internal/states/instance_object_src.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/states/instance_object_src.go b/internal/states/instance_object_src.go index 49600d9552dd..63b7963c2249 100644 --- a/internal/states/instance_object_src.go +++ b/internal/states/instance_object_src.go @@ -117,7 +117,7 @@ func (os *ResourceInstanceObjectSrc) Decode(schema providers.Schema) (*ResourceI var identity cty.Value if os.decodeIdentityCache != cty.NilVal { identity = os.decodeIdentityCache - } else if os.IdentityJSON != nil { + } else if os.IdentityJSON != nil && schema.Identity != nil { identity, err = ctyjson.Unmarshal(os.IdentityJSON, schema.Identity.ImpliedType()) if err != nil { return nil, fmt.Errorf("failed to decode identity: %s. This is most likely a bug in the Provider, providers must not change the identity schema without updating the identity schema version", err.Error()) From b2b8f62c1805ffde1b0716aca64c91bb1f99410e Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Wed, 1 Oct 2025 14:32:34 +0000 Subject: [PATCH 27/27] backport of commit a175b1750b3c3118721c4f2ad11f87c3723c3f08 --- .../terraform/context_plan_identity_test.go | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/internal/terraform/context_plan_identity_test.go b/internal/terraform/context_plan_identity_test.go index 1c6a573f7091..aa8535edc05a 100644 --- a/internal/terraform/context_plan_identity_test.go +++ b/internal/terraform/context_plan_identity_test.go @@ -309,6 +309,76 @@ func TestContext2Plan_resource_identity_refresh(t *testing.T) { } } +func TestContext2Plan_resource_identity_refresh_downgrade(t *testing.T) { + p := testProvider("aws") + m := testModule(t, "refresh-basic") + p.GetProviderSchemaResponse = getProviderSchemaResponseFromProviderSchema(&providerSchema{ + ResourceTypes: map[string]*configschema.Block{ + "aws_instance": { + Attributes: map[string]*configschema.Attribute{ + "id": { + Type: cty.String, + Computed: true, + }, + "foo": { + Type: cty.String, + Optional: true, + Computed: true, + }, + }, + }, + }, + }) + + state := states.NewState() + root := state.EnsureModule(addrs.RootModuleInstance) + + root.SetResourceInstanceCurrent( + mustResourceInstanceAddr("aws_instance.web").Resource, + &states.ResourceInstanceObjectSrc{ + Status: states.ObjectReady, + AttrsJSON: []byte(`{"id":"foo","foo":"bar"}`), + IdentitySchemaVersion: 0, + IdentityJSON: []byte(`{"id": "foo"}`), + }, + mustProviderConfig(`provider["registry.terraform.io/hashicorp/aws"]`), + ) + + ctx := testContext2(t, &ContextOpts{ + Providers: map[addrs.Provider]providers.Factory{ + addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p), + }, + }) + + schema := p.GetProviderSchemaResponse.ResourceTypes["aws_instance"] + + p.ReadResourceFn = func(req providers.ReadResourceRequest) providers.ReadResourceResponse { + return providers.ReadResourceResponse{ + NewState: req.PriorState, + } + } + + s, diags := ctx.Plan(m, state, &PlanOpts{Mode: plans.RefreshOnlyMode}) + + if diags.HasErrors() { + t.Fatal(diags.Err()) + } + + if !p.ReadResourceCalled { + t.Fatal("ReadResource should be called") + } + + mod := s.PriorState.RootModule() + fromState, err := mod.Resources["aws_instance.web"].Instances[addrs.NoKey].Current.Decode(schema) + if err != nil { + t.Fatal(err) + } + + if !fromState.Identity.IsNull() { + t.Fatalf("wrong identity\nwant: null\ngot: %s", fromState.Identity.GoString()) + } +} + // This test validates if a resource identity that is deposed and will be destroyed // can be refreshed with an identity during the plan. func TestContext2Plan_resource_identity_refresh_destroy_deposed(t *testing.T) {