diff --git a/docs/plugin-protocol/tfplugin6.proto b/docs/plugin-protocol/tfplugin6.proto index f001b4a4798f..50a08996b899 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,55 @@ 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 { + // TODO: Can we decouple this outside of the stream? + string type_name = 1; + string state_id = 3; + + bytes bytes = 2; + int64 total_length = 4; + StateRange range = 5; } message Response { repeated Diagnostic diagnostics = 1; } } +message StateRange { + int64 start = 1; + int64 end = 2; +} + message GetStates { message Request { string type_name = 1; diff --git a/internal/backend/pluggable/pluggable.go b/internal/backend/pluggable/pluggable.go index 23a412c6fd55..279d963becf9 100644 --- a/internal/backend/pluggable/pluggable.go +++ b/internal/backend/pluggable/pluggable.go @@ -68,6 +68,15 @@ func (p *Pluggable) ConfigSchema() *configschema.Block { return val.Body } +// ProviderSchema returns the schema for the provider implementing the state store. +// +// This isn't part of the backend.Backend interface but is needed in calling code. +// When it's used the backend.Backend will need to be cast to a Pluggable. +func (p *Pluggable) ProviderSchema() *configschema.Block { + schemaResp := p.provider.GetProviderSchema() + return schemaResp.Provider.Body +} + // PrepareConfig validates configuration for the state store in // the state storage provider. The configuration sent from Terraform core // will not include any values from environment variables; it is the 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/command/arguments/init.go b/internal/command/arguments/init.go index 6bb74473847a..91b2846b7456 100644 --- a/internal/command/arguments/init.go +++ b/internal/command/arguments/init.go @@ -78,6 +78,10 @@ type Init struct { // TODO(SarahFrench/radeksimko): Remove this once the feature is no longer // experimental EnablePssExperiment bool + + // CreateDefaultWorkspace indicates whether the default workspace should be created by + // Terraform when initializing a state store for the first time. + CreateDefaultWorkspace bool } // ParseInit processes CLI arguments, returning an Init value and errors. @@ -111,7 +115,7 @@ func ParseInit(args []string) (*Init, tfdiags.Diagnostics) { cmdFlags.BoolVar(&init.Json, "json", false, "json") cmdFlags.Var(&init.BackendConfig, "backend-config", "") cmdFlags.Var(&init.PluginPath, "plugin-dir", "plugin directory") - + cmdFlags.BoolVar(&init.CreateDefaultWorkspace, "create-default-workspace", true, "when -input=false, use this flag to block creation of the default workspace") // Used for enabling experimental code that's invoked before configuration is parsed. cmdFlags.BoolVar(&init.EnablePssExperiment, "enable-pluggable-state-storage-experiment", false, "Enable the pluggable state storage experiment") @@ -139,6 +143,14 @@ func ParseInit(args []string) (*Init, tfdiags.Diagnostics) { )) } + if init.InputEnabled && !init.CreateDefaultWorkspace { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Warning, + "Invalid init options", + "The flag -create-default-workspace=false is ignored when Terraform is configured to ask users for input. Instead, add -input=false or remove the -create-default-workspace flag", + )) + } + init.Args = cmdFlags.Args() backendFlagSet := FlagIsSet(cmdFlags, "backend") diff --git a/internal/command/arguments/init_test.go b/internal/command/arguments/init_test.go index 93e13b7b6281..2c78e97254fb 100644 --- a/internal/command/arguments/init_test.go +++ b/internal/command/arguments/init_test.go @@ -40,10 +40,11 @@ func TestParseInit_basicValid(t *testing.T) { FlagName: "-backend-config", Items: &flagNameValue, }, - Vars: &Vars{}, - InputEnabled: true, - CompactWarnings: false, - TargetFlags: nil, + Vars: &Vars{}, + InputEnabled: true, + CompactWarnings: false, + TargetFlags: nil, + CreateDefaultWorkspace: true, }, }, "setting multiple options": { @@ -72,11 +73,12 @@ func TestParseInit_basicValid(t *testing.T) { FlagName: "-backend-config", Items: &flagNameValue, }, - Vars: &Vars{}, - InputEnabled: true, - Args: []string{}, - CompactWarnings: true, - TargetFlags: nil, + Vars: &Vars{}, + InputEnabled: true, + Args: []string{}, + CompactWarnings: true, + TargetFlags: nil, + CreateDefaultWorkspace: true, }, }, "with cloud option": { @@ -101,11 +103,12 @@ func TestParseInit_basicValid(t *testing.T) { FlagName: "-backend-config", Items: &[]FlagNameValue{{Name: "-backend-config", Value: "backend.config"}}, }, - Vars: &Vars{}, - InputEnabled: false, - Args: []string{}, - CompactWarnings: false, - TargetFlags: []string{"foo_bar.baz"}, + Vars: &Vars{}, + InputEnabled: false, + Args: []string{}, + CompactWarnings: false, + TargetFlags: []string{"foo_bar.baz"}, + CreateDefaultWorkspace: true, }, }, } diff --git a/internal/command/init.go b/internal/command/init.go index 114ce62a291b..ca27ecbc7ebe 100644 --- a/internal/command/init.go +++ b/internal/command/init.go @@ -159,7 +159,11 @@ 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, initArgs *arguments.Init, locks *depsfile.Locks, view views.Init) (be backend.Backend, output bool, diags tfdiags.Diagnostics) { + // Temporary vars to account for refactoring the method's parameters + extraConfig := initArgs.BackendConfig + viewType := initArgs.ViewType + 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 +191,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, locks) + diags = diags.Append(fDiags) + if fDiags.HasErrors() { return nil, true, diags } @@ -271,11 +250,13 @@ func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, ext } opts = &BackendOpts{ - StateStoreConfig: root.StateStore, - ProviderFactory: factory, - ConfigOverride: configOverride, - Init: true, - ViewType: viewType, + StateStoreConfig: root.StateStore, + Locks: locks, + ProviderFactory: factory, + CreateDefaultWorkspace: initArgs.CreateDefaultWorkspace, + ConfigOverride: configOverride, + Init: true, + ViewType: viewType, } case root.Backend != nil: @@ -311,15 +292,19 @@ func (c *InitCommand) initBackend(ctx context.Context, root *configs.Module, ext backendSchema := b.ConfigSchema() backendConfig := root.Backend - backendConfigOverride, overrideDiags := c.backendConfigOverrideBody(extraConfig, backendSchema) - diags = diags.Append(overrideDiags) - if overrideDiags.HasErrors() { - return nil, true, diags + var configOverride hcl.Body + if len(*extraConfig.Items) > 0 { + var overrideDiags tfdiags.Diagnostics + configOverride, overrideDiags = c.backendConfigOverrideBody(extraConfig, backendSchema) + diags = diags.Append(overrideDiags) + if overrideDiags.HasErrors() { + return nil, true, diags + } } opts = &BackendOpts{ BackendConfig: backendConfig, - ConfigOverride: backendConfigOverride, + ConfigOverride: configOverride, Init: true, ViewType: viewType, } diff --git a/internal/command/init_run.go b/internal/command/init_run.go index a030e856d97d..be483db5a714 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,8 @@ 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) + var locks *depsfile.Locks // Empty locks- this value is unused when a `backend` is used (vs. a `state_store`) + back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs, locks, 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..f5a27e35a5c2 100644 --- a/internal/command/init_run_experiment.go +++ b/internal/command/init_run_experiment.go @@ -205,9 +205,10 @@ 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) + // This handles case when config contains either backend or state_store blocks. + // This is valid as either can be implementations of backend.Backend, which is what we + // obtain here. + back, backendOutput, backDiags = c.initBackend(ctx, rootModEarly, initArgs, configLocks, view) default: // load the previously-stored backend config back, backDiags = c.Meta.backendFromState(ctx) diff --git a/internal/command/init_test.go b/internal/command/init_test.go index 361702972b94..c3911a18621b 100644 --- a/internal/command/init_test.go +++ b/internal/command/init_test.go @@ -17,11 +17,15 @@ import ( "github.com/google/go-cmp/cmp" "github.com/hashicorp/cli" version "github.com/hashicorp/go-version" + tfaddr "github.com/hashicorp/terraform-registry-address" "github.com/zclconf/go-cty/cty" "github.com/hashicorp/terraform/internal/addrs" + "github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/command/arguments" + "github.com/hashicorp/terraform/internal/command/clistate" "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/configs/configschema" "github.com/hashicorp/terraform/internal/depsfile" @@ -3227,6 +3231,242 @@ func TestInit_testsWithModule(t *testing.T) { } } +// Testing init's behaviors when run in an empty working directory +func TestInit_stateStore_newWorkingDir(t *testing.T) { + t.Run("the init command creates a backend state file, and creates the default workspace by default", func(t *testing.T) { + // Create a temporary, uninitialized working directory with configuration including a state store + td := t.TempDir() + testCopyDir(t, testFixturePath("init-with-state-store"), td) + t.Chdir(td) + + mockProvider := mockPluggableStateStorageProvider() + mockProviderAddress := addrs.NewDefaultProvider("test") + providerSource, close := newMockProviderSource(t, map[string][]string{ + "hashicorp/test": {"1.0.0"}, + }) + defer close() + + ui := new(cli.MockUi) + view, done := testView(t) + meta := Meta{ + Ui: ui, + View: view, + AllowExperimentalFeatures: true, + testingOverrides: &testingOverrides{ + Providers: map[addrs.Provider]providers.Factory{ + mockProviderAddress: providers.FactoryFixed(mockProvider), + }, + }, + ProviderSource: providerSource, + } + c := &InitCommand{ + Meta: meta, + } + + args := []string{"-enable-pluggable-state-storage-experiment=true"} + code := c.Run(args) + testOutput := done(t) + if code != 0 { + t.Fatalf("expected code 0 exit code, got %d, output: \n%s", code, testOutput.All()) + } + + // Check output + output := testOutput.All() + expectedOutputs := []string{ + "Initializing the state store...", + "Terraform has been successfully initialized!", + } + for _, expected := range expectedOutputs { + if !strings.Contains(output, expected) { + t.Fatalf("expected output to include %q, but got':\n %s", expected, output) + } + } + + // Assert the default workspace was created + if _, exists := mockProvider.MockStates[backend.DefaultStateName]; !exists { + t.Fatal("expected the default workspace to be created during init, but it is missing") + } + + // Assert contents of the backend state file + statePath := filepath.Join(meta.DataDir(), DefaultStateFilename) + sMgr := &clistate.LocalState{Path: statePath} + if err := sMgr.RefreshState(); err != nil { + t.Fatal("Failed to load state:", err) + } + s := sMgr.State() + if s == nil { + t.Fatal("expected backend state file to be created, but there isn't one") + } + v1_0_0, _ := version.NewVersion("1.0.0") + expectedState := &workdir.StateStoreConfigState{ + Type: "test_store", + ConfigRaw: []byte("{\n \"value\": null\n }"), + Hash: uint64(3976463117), // Hash of empty config + Provider: &workdir.ProviderConfigState{ + Version: v1_0_0, + Source: &tfaddr.Provider{ + Hostname: tfaddr.DefaultProviderRegistryHost, + Namespace: "hashicorp", + Type: "test", + }, + ConfigRaw: []byte("{\n \"region\": null\n }"), + Hash: uint64(3976463117), // Hash of empty config + }, + } + if diff := cmp.Diff(s.StateStore, expectedState); diff != "" { + t.Fatalf("unexpected diff in backend state file's description of state store:\n%s", diff) + } + }) + + t.Run("an init command with the flag -create-default-workspace=false will not make the default workspace", func(t *testing.T) { + // Create a temporary, uninitialized working directory with configuration including a state store + td := t.TempDir() + testCopyDir(t, testFixturePath("init-with-state-store"), td) + t.Chdir(td) + + mockProvider := mockPluggableStateStorageProvider() + mockProviderAddress := addrs.NewDefaultProvider("test") + providerSource, close := newMockProviderSource(t, map[string][]string{ + "hashicorp/test": {"1.0.0"}, + }) + defer close() + + ui := new(cli.MockUi) + view, done := testView(t) + c := &InitCommand{ + Meta: Meta{ + Ui: ui, + View: view, + AllowExperimentalFeatures: true, + testingOverrides: &testingOverrides{ + Providers: map[addrs.Provider]providers.Factory{ + mockProviderAddress: providers.FactoryFixed(mockProvider), + }, + }, + ProviderSource: providerSource, + }, + } + + args := []string{"-enable-pluggable-state-storage-experiment=true", "-create-default-workspace=false"} + code := c.Run(args) + testOutput := done(t) + if code != 0 { + t.Fatalf("expected code 0 exit code, got %d, output: \n%s", code, testOutput.All()) + } + + // Check output + output := testOutput.All() + expectedOutput := `Terraform has been configured to skip creation of the default workspace` + if !strings.Contains(output, expectedOutput) { + t.Fatalf("expected output to include %q, but got':\n %s", expectedOutput, output) + } + + // Assert the default workspace was created + if _, exists := mockProvider.MockStates[backend.DefaultStateName]; exists { + t.Fatal("expected Terraform to skip creating the default workspace, but it has been created") + } + }) + + // TODO: Add test cases below once PSS feature isn't experimental. + // Currently these tests are handled at a lower level in `internal/command/meta_backend_test.go`: + // > "during a non-init command, the command ends in with an error telling the user to run an init command" +} + +// Testing init's behaviors when run in a working directory where the configuration +// doesn't match the backend state file. +func TestInit_stateStore_configChanges(t *testing.T) { + t.Run("the -reconfigure flag makes Terraform ignore the backend state file during initialization", func(t *testing.T) { + // Create a temporary working directory with state store configuration + // that doesn't match the backend state file + td := t.TempDir() + testCopyDir(t, testFixturePath("state-store-reconfigure"), td) + t.Chdir(td) + + mockProvider := mockPluggableStateStorageProvider() + mockProviderAddress := addrs.NewDefaultProvider("test") + providerSource, close := newMockProviderSource(t, map[string][]string{ + "hashicorp/test": {"1.0.0"}, + }) + defer close() + + ui := new(cli.MockUi) + view, done := testView(t) + meta := Meta{ + Ui: ui, + View: view, + AllowExperimentalFeatures: true, + testingOverrides: &testingOverrides{ + Providers: map[addrs.Provider]providers.Factory{ + mockProviderAddress: providers.FactoryFixed(mockProvider), + }, + }, + ProviderSource: providerSource, + } + c := &InitCommand{ + Meta: meta, + } + + args := []string{ + "-enable-pluggable-state-storage-experiment=true", + "-reconfigure", + } + code := c.Run(args) + testOutput := done(t) + if code != 0 { + t.Fatalf("expected code 0 exit code, got %d, output: \n%s", code, testOutput.All()) + } + + // Check output + output := testOutput.All() + expectedOutputs := []string{ + "Initializing the state store...", + "Terraform has been successfully initialized!", + } + for _, expected := range expectedOutputs { + if !strings.Contains(output, expected) { + t.Fatalf("expected output to include %q, but got':\n %s", expected, output) + } + } + + // Assert the default workspace was created + if _, exists := mockProvider.MockStates[backend.DefaultStateName]; !exists { + t.Fatal("expected the default workspace to be created during init, but it is missing") + } + + // Assert contents of the backend state file + statePath := filepath.Join(meta.DataDir(), DefaultStateFilename) + sMgr := &clistate.LocalState{Path: statePath} + if err := sMgr.RefreshState(); err != nil { + t.Fatal("Failed to load state:", err) + } + s := sMgr.State() + if s == nil { + t.Fatal("expected backend state file to be created, but there isn't one") + } + v1_0_0, _ := version.NewVersion("1.0.0") + expectedState := &workdir.StateStoreConfigState{ + Type: "test_store", + ConfigRaw: []byte("{\n \"value\": \"changed-value\"\n }"), + Hash: uint64(1417640992), // Hash affected by config + Provider: &workdir.ProviderConfigState{ + Version: v1_0_0, + Source: &tfaddr.Provider{ + Hostname: tfaddr.DefaultProviderRegistryHost, + Namespace: "hashicorp", + Type: "test", + }, + ConfigRaw: []byte("{\n \"region\": null\n }"), + Hash: uint64(3976463117), // Hash of empty config + }, + } + if diff := cmp.Diff(s.StateStore, expectedState); diff != "" { + t.Fatalf("unexpected diff in backend state file's description of state store:\n%s", diff) + } + }) + + // TODO - add more test cases, e.g. these context changes in the context of updating providers +} + // newMockProviderSource is a helper to succinctly construct a mock provider // source that contains a set of packages matching the given provider versions // that are available for installation (from temporary local files). @@ -3367,3 +3607,65 @@ func expectedPackageInstallPath(name, version string, exe bool) string { baseDir, fmt.Sprintf("registry.terraform.io/hashicorp/%s/%s/%s", name, version, platform), )) } + +func mockPluggableStateStorageProvider() *testing_provider.MockProvider { + // Create a mock provider to use for PSS + // Get mock provider factory to be used during init + // + // This imagines a provider called `test` that contains + // a pluggable state store implementation called `store`. + pssName := "test_store" + mock := testing_provider.MockProvider{ + GetProviderSchemaResponse: &providers.GetProviderSchemaResponse{ + Provider: providers.Schema{ + Body: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "region": {Type: cty.String, Optional: true}, + }, + }, + }, + DataSources: map[string]providers.Schema{}, + ResourceTypes: map[string]providers.Schema{}, + ListResourceTypes: map[string]providers.Schema{}, + StateStores: map[string]providers.Schema{ + pssName: { + Body: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "value": { + Type: cty.String, + Required: true, + }, + }, + }, + }, + }, + }, + } + mock.WriteStateBytesFn = func(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + // Workspaces exist once the artefact representing it is written + if _, exist := mock.MockStates[req.StateId]; !exist { + // Ensure non-nil map + if mock.MockStates == nil { + mock.MockStates = make(map[string]interface{}) + } + + mock.MockStates[req.StateId] = req.Bytes + } + return providers.WriteStateBytesResponse{ + Diagnostics: nil, // success + } + } + mock.ReadStateBytesFn = func(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + state := []byte{} + if v, exist := mock.MockStates[req.StateId]; exist { + if s, ok := v.([]byte); ok { + state = s + } + } + return providers.ReadStateBytesResponse{ + Bytes: state, + Diagnostics: nil, // success + } + } + return &mock +} 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..df6914025ad0 100644 --- a/internal/command/meta_backend.go +++ b/internal/command/meta_backend.go @@ -14,31 +14,53 @@ import ( "fmt" "log" "maps" + "os" "path/filepath" "slices" "strconv" "strings" + version "github.com/hashicorp/go-version" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hcldec" "github.com/zclconf/go-cty/cty" + "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/backend/backendrun" backendInit "github.com/hashicorp/terraform/internal/backend/init" backendLocal "github.com/hashicorp/terraform/internal/backend/local" + backendPluggable "github.com/hashicorp/terraform/internal/backend/pluggable" "github.com/hashicorp/terraform/internal/cloud" "github.com/hashicorp/terraform/internal/command/arguments" "github.com/hashicorp/terraform/internal/command/clistate" "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/getproviders/providerreqs" "github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/providers" + "github.com/hashicorp/terraform/internal/states" "github.com/hashicorp/terraform/internal/states/statemgr" "github.com/hashicorp/terraform/internal/terraform" "github.com/hashicorp/terraform/internal/tfdiags" + tfversion "github.com/hashicorp/terraform/version" +) + +const ( + // defaultStateStoreChunkSize is the default chunk size proposed + // to the provider. + // This can be tweaked but should provide reasonable performance + // trade-offs for average network conditions and state file sizes. + defaultStateStoreChunkSize int64 = 8 << 20 // 8 MB + + // maxStateStoreChunkSize is the highest chunk size provider may choose + // which we still consider reasonable/safe. + // This reflects terraform-plugin-go's max. RPC message size of 256MB + // and leaves plenty of space for other variable data like diagnostics. + maxStateStoreChunkSize int64 = 128 << 20 // 128 MB ) // BackendOpts are the options used to initialize a backendrun.OperationsBackend. @@ -58,6 +80,13 @@ type BackendOpts struct { // This will only be set if the configuration contains a state_store block. ProviderFactory providers.Factory + // Locks allows state-migration logic to detect when the provider used for pluggable state storage + // during the last init (i.e. what's in the backend state file) is mismatched with the provider + // version in use currently. + // + // This will only be set if the configuration contains a state_store block. + Locks *depsfile.Locks + // ConfigOverride is an hcl.Body that, if non-nil, will be used with // configs.MergeBodies to override the type-specific backend configuration // arguments in Config. @@ -75,6 +104,10 @@ type BackendOpts struct { // ViewType will set console output format for the // initialization operation (JSON or human-readable). ViewType arguments.ViewType + + // CreateDefaultWorkspace signifies whether the operations backend should create + // the default workspace or not + CreateDefaultWorkspace bool } // BackendWithRemoteTerraformVersion is a shared interface between the 'remote' and 'cloud' backends @@ -222,7 +255,7 @@ func (m *Meta) Backend(opts *BackendOpts) (backendrun.OperationsBackend, tfdiags } } - return local, nil + return local, diags } // selectWorkspace gets a list of existing workspaces and then checks @@ -631,11 +664,13 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di // Get the local 'backend' or 'state_store' configuration. var backendConfig *configs.Backend var stateStoreConfig *configs.StateStore - var cHash int + var cHash int // backend hash + var stateStoreHash int + var stateStoreProviderHash int if opts.StateStoreConfig != nil { // state store has been parsed from config and is included in opts var ssDiags tfdiags.Diagnostics - stateStoreConfig, cHash, _, ssDiags = m.stateStoreConfig(opts) + stateStoreConfig, stateStoreHash, stateStoreProviderHash, ssDiags = m.stateStoreConfig(opts) diags = diags.Append(ssDiags) if ssDiags.HasErrors() { return nil, diags @@ -674,7 +709,7 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di statePath := filepath.Join(m.DataDir(), DefaultStateFilename) sMgr := &clistate.LocalState{Path: statePath} if err := sMgr.RefreshState(); err != nil { - diags = diags.Append(fmt.Errorf("Failed to load state: %s", err)) + diags = diags.Append(fmt.Errorf("Failed to load the backend state file: %s", err)) return nil, diags } @@ -787,11 +822,22 @@ func (m *Meta) backendFromConfig(opts *BackendOpts) (backend.Backend, tfdiags.Di stateStoreConfig.Provider.Name, stateStoreConfig.ProviderAddr, ) - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Not implemented yet", - Detail: "Configuring a state store for the first time is not implemented yet", - }) + + if !opts.Init { + initReason := fmt.Sprintf("Initial configuration of the requested state_store %q in provider %s (%q)", + stateStoreConfig.Type, + stateStoreConfig.Provider.Name, + stateStoreConfig.ProviderAddr, + ) + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "State store initialization required, please run \"terraform init\"", + fmt.Sprintf(strings.TrimSpace(errStateStoreInit), initReason), + )) + return nil, diags + } + + return m.stateStore_C_s(stateStoreConfig, stateStoreHash, stateStoreProviderHash, sMgr, opts) // Migration from state store to backend case backendConfig != nil && s.Backend.Empty() && @@ -1075,7 +1121,7 @@ func (m *Meta) backendFromState(_ context.Context) (backend.Backend, tfdiags.Dia // Unconfiguring a backend (moving from backend => local). func (m *Meta) backend_c_r_S( - c *configs.Backend, cHash int, sMgr *clistate.LocalState, output bool, opts *BackendOpts) (backend.Backend, tfdiags.Diagnostics) { + c *configs.Backend, cHash int, backendSMgr *clistate.LocalState, output bool, opts *BackendOpts) (backend.Backend, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics @@ -1086,7 +1132,8 @@ func (m *Meta) backend_c_r_S( vt = arguments.ViewHuman } - s := sMgr.State() + // Get backend state file data + s := backendSMgr.State() cloudMode := cloud.DetectConfigChangeType(s.Backend, c, false) diags = diags.Append(m.assertSupportedCloudInitOptions(cloudMode)) @@ -1111,7 +1158,7 @@ func (m *Meta) backend_c_r_S( } // Initialize the configured backend - b, moreDiags := m.savedBackend(sMgr) + b, moreDiags := m.savedBackend(backendSMgr) diags = diags.Append(moreDiags) if moreDiags.HasErrors() { return nil, diags @@ -1132,11 +1179,11 @@ func (m *Meta) backend_c_r_S( // Remove the stored metadata s.Backend = nil - if err := sMgr.WriteState(s); err != nil { + if err := backendSMgr.WriteState(s); err != nil { diags = diags.Append(fmt.Errorf(strings.TrimSpace(errBackendClearSaved), err)) return nil, diags } - if err := sMgr.PersistState(); err != nil { + if err := backendSMgr.PersistState(); err != nil { diags = diags.Append(fmt.Errorf(strings.TrimSpace(errBackendClearSaved), err)) return nil, diags } @@ -1152,7 +1199,7 @@ func (m *Meta) backend_c_r_S( } // Configuring a backend for the first time. -func (m *Meta) backend_C_r_s(c *configs.Backend, cHash int, sMgr *clistate.LocalState, opts *BackendOpts) (backend.Backend, tfdiags.Diagnostics) { +func (m *Meta) backend_C_r_s(c *configs.Backend, cHash int, backendSMgr *clistate.LocalState, opts *BackendOpts) (backend.Backend, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics vt := arguments.ViewJSON @@ -1257,15 +1304,15 @@ func (m *Meta) backend_C_r_s(c *configs.Backend, cHash int, sMgr *clistate.Local if m.stateLock { view := views.NewStateLocker(vt, m.View) stateLocker := clistate.NewLocker(m.stateLockTimeout, view) - if err := stateLocker.Lock(sMgr, "backend from plan"); err != nil { + if err := stateLocker.Lock(backendSMgr, "backend from plan"); err != nil { diags = diags.Append(fmt.Errorf("Error locking state: %s", err)) return nil, diags } defer stateLocker.Unlock() } - // Store the metadata in our saved state location - s := sMgr.State() + // Store the backend's metadata in our the backend state file location + s := backendSMgr.State() if s == nil { s = workdir.NewBackendStateFile() } @@ -1300,11 +1347,12 @@ func (m *Meta) backend_C_r_s(c *configs.Backend, cHash int, sMgr *clistate.Local } } - if err := sMgr.WriteState(s); err != nil { + // Update backend state file + if err := backendSMgr.WriteState(s); err != nil { diags = diags.Append(fmt.Errorf(errBackendWriteSaved, err)) return nil, diags } - if err := sMgr.PersistState(); err != nil { + if err := backendSMgr.PersistState(); err != nil { diags = diags.Append(fmt.Errorf(errBackendWriteSaved, err)) return nil, diags } @@ -1320,7 +1368,7 @@ func (m *Meta) backend_C_r_s(c *configs.Backend, cHash int, sMgr *clistate.Local } // Changing a previously saved backend. -func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clistate.LocalState, output bool, opts *BackendOpts) (backend.Backend, tfdiags.Diagnostics) { +func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, backendSMgr *clistate.LocalState, output bool, opts *BackendOpts) (backend.Backend, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics vt := arguments.ViewJSON @@ -1330,8 +1378,8 @@ func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clista vt = arguments.ViewHuman } - // Get the old state - s := sMgr.State() + // Get the old backend state file data + s := backendSMgr.State() cloudMode := cloud.DetectConfigChangeType(s.Backend, c, false) diags = diags.Append(m.assertSupportedCloudInitOptions(cloudMode)) @@ -1377,7 +1425,7 @@ func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clista // state lives. if cloudMode != cloud.ConfigChangeInPlace { // Grab the existing backend - oldB, oldBDiags := m.savedBackend(sMgr) + oldB, oldBDiags := m.savedBackend(backendSMgr) diags = diags.Append(oldBDiags) if oldBDiags.HasErrors() { return nil, diags @@ -1399,7 +1447,7 @@ func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clista if m.stateLock { view := views.NewStateLocker(vt, m.View) stateLocker := clistate.NewLocker(m.stateLockTimeout, view) - if err := stateLocker.Lock(sMgr, "backend from plan"); err != nil { + if err := stateLocker.Lock(backendSMgr, "backend from plan"); err != nil { diags = diags.Append(fmt.Errorf("Error locking state: %s", err)) return nil, diags } @@ -1408,7 +1456,7 @@ func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clista } // Update the backend state - s = sMgr.State() + s = backendSMgr.State() if s == nil { s = workdir.NewBackendStateFile() } @@ -1430,11 +1478,12 @@ func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clista } } - if err := sMgr.WriteState(s); err != nil { + // Save data to backend state file + if err := backendSMgr.WriteState(s); err != nil { diags = diags.Append(fmt.Errorf(errBackendWriteSaved, err)) return nil, diags } - if err := sMgr.PersistState(); err != nil { + if err := backendSMgr.PersistState(); err != nil { diags = diags.Append(fmt.Errorf(errBackendWriteSaved, err)) return nil, diags } @@ -1451,15 +1500,323 @@ func (m *Meta) backend_C_r_S_changed(c *configs.Backend, cHash int, sMgr *clista return b, diags } +//------------------------------------------------------------------- +// State Store Config Scenarios +// The functions below cover handling all the various scenarios that +// can exist when loading a state store. They are named in the format of +// "stateStore_C_S" where C and S may be upper or lowercase. Lowercase +// means it is false, uppercase means it is true. +// +// The fields are: +// +// * C - State store configuration is set and changed in TF files +// * S - State store configuration is set in the state +// +//------------------------------------------------------------------- + +// Configuring a state_store for the first time. +func (m *Meta) stateStore_C_s(c *configs.StateStore, stateStoreHash int, providerHash int, backendSMgr *clistate.LocalState, opts *BackendOpts) (backend.Backend, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + + vt := arguments.ViewJSON + // Set default viewtype if none was set as the StateLocker needs to know exactly + // what viewType we want to have. + if opts == nil || opts.ViewType != vt { + vt = arguments.ViewHuman + } + + // Grab a purely local backend to get the local state if it exists + localB, localBDiags := m.Backend(&BackendOpts{ForceLocal: true, Init: true}) + if localBDiags.HasErrors() { + diags = diags.Append(localBDiags) + return nil, diags + } + + workspaces, err := localB.Workspaces() + if err != nil { + diags = diags.Append(fmt.Errorf(errBackendLocalRead, err)) + return nil, diags + } + + var localStates []statemgr.Full + for _, workspace := range workspaces { + localState, err := localB.StateMgr(workspace) + if err != nil { + diags = diags.Append(fmt.Errorf(errBackendLocalRead, err)) + return nil, diags + } + if err := localState.RefreshState(); err != nil { + diags = diags.Append(fmt.Errorf(errBackendLocalRead, err)) + return nil, diags + } + + // We only care about non-empty states. + if localS := localState.State(); !localS.Empty() { + log.Printf("[TRACE] Meta.Backend: will need to migrate workspace states because of existing %q workspace", workspace) + localStates = append(localStates, localState) + } else { + log.Printf("[TRACE] Meta.Backend: ignoring local %q workspace because its state is empty", workspace) + } + } + + // Get the state store as an instance of backend.Backend + b, storeConfigVal, providerConfigVal, moreDiags := m.stateStoreInitFromConfig(c, opts) + diags = diags.Append(moreDiags) + if diags.HasErrors() { + return nil, diags + } + + if len(localStates) > 0 { + // Migrate any local states into the new state store + err := m.backendMigrateState(&backendMigrateOpts{ + SourceType: "local", + DestinationType: c.Type, + Source: localB, + Destination: b, + ViewType: vt, + }) + if err != nil { + diags = diags.Append(err) + return nil, diags + } + + // We remove the local state after migration to prevent confusion + // As we're migrating to a state store we don't have insight into whether it stores + // files locally at all, and whether those local files conflict with the location of + // the old local state. + log.Printf("[TRACE] Meta.Backend: removing old state snapshots from old backend") + for _, localState := range localStates { + // We always delete the local state, unless that was our new state too. + if err := localState.WriteState(nil); err != nil { + diags = diags.Append(fmt.Errorf(errBackendMigrateLocalDelete, err)) + return nil, diags + } + if err := localState.PersistState(nil); err != nil { + diags = diags.Append(fmt.Errorf(errBackendMigrateLocalDelete, err)) + return nil, diags + } + } + } + + if m.stateLock { + view := views.NewStateLocker(vt, m.View) + stateLocker := clistate.NewLocker(m.stateLockTimeout, view) + if err := stateLocker.Lock(backendSMgr, "init is initializing state_store first time"); err != nil { + diags = diags.Append(fmt.Errorf("Error locking state: %s", err)) + return nil, diags + } + defer stateLocker.Unlock() + } + + // Store the state_store metadata in our saved state location + s := backendSMgr.State() + if s == nil { + s = workdir.NewBackendStateFile() + } + + var pVersion *version.Version + if c.ProviderAddr.Equals(addrs.NewBuiltInProvider("terraform")) { + // If we're handling the builtin "terraform" provider then there's no version information to store in the dependency lock file, so don't access it. + // We must record a value into the backend state file, and we cannot include a value that changes (e.g. the Terraform core binary version) as migration + // is impossible with builtin providers. + // So, we use an arbitrary stand-in version. + standInVersion, err := version.NewVersion("0.0.1") + if err != nil { + diags = diags.Append(fmt.Errorf("Error when creating a backend state file. This is a bug in Terraform and should be reported: %w", + err)) + return nil, diags + } + pVersion = standInVersion + } else { + isReattached, err := isProviderReattached(c.ProviderAddr) + if err != nil { + diags = diags.Append(fmt.Errorf("Error determining if the state storage provider is reattached or not. This is a bug in Terraform and should be reported: %w", + err)) + return nil, diags + } + if isReattached { + // If the provider is unmanaged then it won't be in the locks. + // If there are no locks then there's no version information to for us to access and use when creating the backend state file. + // So, we use an arbitrary stand-in version. + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagWarning, + Summary: "State storage provider is not managed by Terraform", + Detail: "Terraform is using a provider supplied via TF_REATTACH_PROVIDERS for initializing state storage. This will affect Terraform's ability to detect when state migrations are required.", + }) + standInVersion, err := version.NewVersion("0.0.1") + if err != nil { + diags = diags.Append(fmt.Errorf("Error when creating a backend state file. This is a bug in Terraform and should be reported: %w", + err)) + return nil, diags + } + pVersion = standInVersion + } else { + // The provider is not built in and is being managed by Terraform + // This is the most common scenario, by far. + pLock := opts.Locks.Provider(c.ProviderAddr) + if pLock == nil { + diags = diags.Append(fmt.Errorf("The provider %s (%q) is not present in the lockfile, despite being used for state store %q. This is a bug in Terraform and should be reported.", + c.Provider.Name, + c.ProviderAddr, + c.Type)) + return nil, diags + } + pVersion, err = providerreqs.GoVersionFromVersion(pLock.Version()) + if err != nil { + diags = diags.Append(fmt.Errorf("Failed obtain the in-use version of provider %s (%q) when recording backend state for state store %q. This is a bug in Terraform and should be reported: %w", + c.Provider.Name, + c.ProviderAddr, + c.Type, + err)) + return nil, diags + } + } + } + s.StateStore = &workdir.StateStoreConfigState{ + Type: c.Type, + Hash: uint64(stateStoreHash), + Provider: &workdir.ProviderConfigState{ + Source: &c.ProviderAddr, + Version: pVersion, + Hash: uint64(providerHash), + }, + } + s.StateStore.SetConfig(storeConfigVal, b.ConfigSchema()) + if plug, ok := b.(*backendPluggable.Pluggable); ok { + // We need to convert away from backend.Backend interface to use the method + // for accessing the provider schema. + s.StateStore.Provider.SetConfig(providerConfigVal, plug.ProviderSchema()) + } + + // Verify that selected workspace exists in the state store. + if opts.Init && b != nil { + err := m.selectWorkspace(b) + if err != nil { + if strings.Contains(err.Error(), "No existing workspaces") { + // If there are no workspaces, Terraform either needs to create the default workspace here, + // or instruct the user to run a `terraform workspace new` command. + ws, err := m.Workspace() + if err != nil { + diags = diags.Append(fmt.Errorf("Failed to check current workspace: %w", err)) + return nil, diags + } + + switch { + case ws != backend.DefaultStateName: + // User needs to run a `terraform workspace new` command. + diags = append(diags, tfdiags.Sourceless( + tfdiags.Error, + fmt.Sprintf("Workspace %q has not been created yet", ws), + fmt.Sprintf("State store %q in provider %s (%q) reports that no workspaces currently exist. To create the custom workspace %q use the command `terraform workspace new %s`.", + c.Type, + c.Provider.Name, + c.ProviderAddr, + ws, + ws, + ), + )) + return nil, diags + + case ws == backend.DefaultStateName: + // Users control if the default workspace is created through the -create-default-workspace flag (defaults to true) + if opts.CreateDefaultWorkspace { + diags = diags.Append(m.createDefaultWorkspace(c, b)) + } else { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagWarning, + Summary: "The default workspace does not exist", + Detail: "Terraform has been configured to skip creation of the default workspace in the state store. To create it, either run an 'init' command without `-create-default-workspace=true`, or create it using a 'workspace new' command", + }) + } + default: + diags = diags.Append(err) + return nil, diags + } + } else { + // For all other errors, report via diagnostics + diags = diags.Append(fmt.Errorf("Failed to select a workspace: %w", err)) + } + } + } + if diags.HasErrors() { + return nil, diags + } + + // Update backend state file + if err := backendSMgr.WriteState(s); err != nil { + diags = diags.Append(fmt.Errorf(errBackendWriteSaved, err)) + return nil, diags + } + if err := backendSMgr.PersistState(); err != nil { + diags = diags.Append(fmt.Errorf(errBackendWriteSaved, err)) + return nil, diags + } + + return b, diags +} + +// isProviderReattached determines if a given provider is being supplied to Terraform via the TF_REATTACH_PROVIDERS +// environment variable. +func isProviderReattached(provider addrs.Provider) (bool, error) { + in := os.Getenv("TF_REATTACH_PROVIDERS") + if in != "" { + var m map[string]any + err := json.Unmarshal([]byte(in), &m) + if err != nil { + return false, fmt.Errorf("Invalid format for TF_REATTACH_PROVIDERS: %w", err) + } + for p, _ := range m { + a, diags := addrs.ParseProviderSourceString(p) + if diags.HasErrors() { + return false, fmt.Errorf("Error parsing %q as a provider address: %w", a, diags.Err()) + } + if a.Equals(provider) { + return true, nil + } + } + } + return false, nil +} + +// createDefaultWorkspace receives a backend made using a pluggable state store, and details about that store's config, +// and persists an empty state file in the default workspace. By creating this artifact we ensure that the default +// workspace is created and usable by Terraform in later operations. +func (m *Meta) createDefaultWorkspace(c *configs.StateStore, b backend.Backend) tfdiags.Diagnostics { + var diags tfdiags.Diagnostics + + defaultSMgr, sDiags := b.StateMgr(backend.DefaultStateName) + diags = diags.Append(sDiags) + if sDiags.HasErrors() { + diags = diags.Append(fmt.Errorf("Failed to create a state manager for state store %q in provider %s (%q). This is a bug in Terraform and should be reported: %w", + c.Type, + c.Provider.Name, + c.ProviderAddr, + sDiags.Err())) + return diags + } + emptyState := states.NewState() + if err := defaultSMgr.WriteState(emptyState); err != nil { + diags = diags.Append(fmt.Errorf(errStateStoreWorkspaceCreate, c.Type, err)) + return diags + } + // TODO - implement Read/Write state RPC methods + if err := defaultSMgr.PersistState(nil); err != nil { + diags = diags.Append(fmt.Errorf(errStateStoreWorkspaceCreate, c.Type, err)) + return diags + } + + return diags +} + // Initializing a saved backend from the cache file (legacy state file) // // TODO: This is extremely similar to Meta.backendFromState() but for legacy reasons this is the // function used by the migration APIs within this file. The other handles 'init -backend=false', // specifically. -func (m *Meta) savedBackend(sMgr *clistate.LocalState) (backend.Backend, tfdiags.Diagnostics) { +func (m *Meta) savedBackend(backendSMgr *clistate.LocalState) (backend.Backend, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics - s := sMgr.State() + s := backendSMgr.State() // Get the backend f := backendInit.Backend(s.Backend.Type) @@ -1648,6 +2005,200 @@ func (m *Meta) backendInitFromConfig(c *configs.Backend) (backend.Backend, cty.V return b, configVal, diags } +// stateStoreInitFromConfig returns an initialized and configured state store, using the backend.Backend interface. +// During this process: +// > Users are prompted for input if required attributes are missing. +// > The provider is configured, after validating provider config +// > The state store is configured, after validating state_store config +func (m *Meta) stateStoreInitFromConfig(c *configs.StateStore, opts *BackendOpts) (backend.Backend, cty.Value, cty.Value, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + + provider, err := opts.ProviderFactory() + if err != nil { + diags = diags.Append(fmt.Errorf("error when obtaining provider instance during state store initialization: %w", err)) + return nil, cty.NilVal, cty.NilVal, diags + } + // We purposefully don't have a deferred call to the provider's Close method here because the calling code needs a + // running provider instance inside the returned backend.Backend instance. + // Stopping the provider process is the responsibility of the calling code. + + resp := provider.GetProviderSchema() + + if len(resp.StateStores) == 0 { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Provider does not support pluggable state storage", + Detail: fmt.Sprintf("There are no state stores implemented by provider %s (%q)", + c.Provider.Name, + c.ProviderAddr), + Subject: &c.DeclRange, + }) + return nil, cty.NilVal, cty.NilVal, diags + } + + schema, exists := resp.StateStores[c.Type] + if !exists { + suggestions := slices.Sorted(maps.Keys(resp.StateStores)) + suggestion := didyoumean.NameSuggestion(c.Type, suggestions) + if suggestion != "" { + suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) + } + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "State store not implemented by the provider", + Detail: fmt.Sprintf("State store %q is not implemented by provider %s (%q)%s", + c.Type, c.Provider.Name, + c.ProviderAddr, suggestion), + Subject: &c.DeclRange, + }) + return nil, cty.NilVal, cty.NilVal, diags + } + + // Handle the nested provider block. + pDecSpec := resp.Provider.Body.NoneRequired().DecoderSpec() + pConfig := c.Provider.Config + providerConfigVal, pDecDiags := hcldec.Decode(pConfig, pDecSpec, nil) + diags = diags.Append(pDecDiags) + + if !providerConfigVal.IsWhollyKnown() { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Unknown values within state_store's nested provider block", + "The `terraform` configuration block should contain only concrete and static values. Another diagnostic should contain more information about which part of the configuration is problematic.")) + return nil, cty.NilVal, cty.NilVal, diags + } + + if m.Input() { + var err error + // TODO (SarahFrench/radeksimko) - Should we allow input to the provider block? + providerConfigVal, err = m.inputForSchema(providerConfigVal, resp.Provider.Body) + if err != nil { + diags = diags.Append( + fmt.Errorf("Error asking for input to configure provider %s (%q) for state store %q: %s", + c.Provider.Name, + c.ProviderAddr, + c.Type, + err, + ), + ) + return nil, cty.NilVal, cty.NilVal, diags + } + + // We get an unknown here if the if the user aborted input, but we can't + // turn that into a config value, so set it to null and let the provider + // handle it in PrepareConfig. + if !providerConfigVal.IsKnown() { + providerConfigVal = cty.NullVal(providerConfigVal.Type()) + } + } + + // Handle the schema for the state store itself, excluding the provider block. + ssdecSpec := schema.Body.NoneRequired().DecoderSpec() + stateStoreConfigVal, ssDecDiags := hcldec.Decode(c.Config, ssdecSpec, nil) + diags = diags.Append(ssDecDiags) + if ssDecDiags.HasErrors() { + return nil, cty.NilVal, cty.NilVal, diags + } + + if !stateStoreConfigVal.IsWhollyKnown() { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Unknown values within state_store definition", + "The `terraform` configuration block should contain only concrete and static values. Another diagnostic should contain more information about which part of the configuration is problematic.")) + return nil, cty.NilVal, cty.NilVal, diags + } + + if m.Input() { + var err error + // TODO (SarahFrench/radeksimko) + // > Should we do this? + // > Could this accidentally prompt users to supply values in the nested provider block? + stateStoreConfigVal, err = m.inputForSchema(stateStoreConfigVal, schema.Body) + if err != nil { + diags = diags.Append(fmt.Errorf("Error asking for input to configure state store %q: %s", c.Type, err)) + return nil, cty.NilVal, cty.NilVal, diags + } + + // We get an unknown here if the if the user aborted input, but we can't + // turn that into a config value, so set it to null and let the provider + // handle it in PrepareConfig. + if !stateStoreConfigVal.IsKnown() { + stateStoreConfigVal = cty.NullVal(stateStoreConfigVal.Type()) + } + } + + // Validate and configure the provider + + // TODO (SarahFrench/radeksimko) : deal with marks + validateResp := provider.ValidateProviderConfig(providers.ValidateProviderConfigRequest{ + Config: providerConfigVal, + }) + diags = diags.Append(validateResp.Diagnostics) + if validateResp.Diagnostics.HasErrors() { + return nil, cty.NilVal, cty.NilVal, diags + } + + configureResp := provider.ConfigureProvider(providers.ConfigureProviderRequest{ + TerraformVersion: tfversion.String(), + Config: providerConfigVal, + }) + diags = diags.Append(configureResp.Diagnostics) + if configureResp.Diagnostics.HasErrors() { + return nil, cty.NilVal, cty.NilVal, diags + } + + // Validate Store Config + // TODO (SarahFrench/radeksimko) : deal with marks + validateStoreResp := provider.ValidateStateStoreConfig(providers.ValidateStateStoreConfigRequest{ + TypeName: c.Type, + Config: stateStoreConfigVal, + }) + diags = diags.Append(validateStoreResp.Diagnostics) + if validateStoreResp.Diagnostics.HasErrors() { + return nil, cty.NilVal, cty.NilVal, diags + } + + // Configure State Store + cfgStoreResp := provider.ConfigureStateStore(providers.ConfigureStateStoreRequest{ + TypeName: c.Type, + Config: stateStoreConfigVal, + Capabilities: providers.StateStoreClientCapabilities{ + ChunkSize: defaultStateStoreChunkSize, + }, + }) + diags = diags.Append(cfgStoreResp.Diagnostics) + if cfgStoreResp.Diagnostics.HasErrors() { + return nil, cty.NilVal, cty.NilVal, diags + } + + chunkSize := cfgStoreResp.Capabilities.ChunkSize + if chunkSize > maxStateStoreChunkSize { + diags = diags.Append(fmt.Errorf("Failed to negotiate acceptable chunk size. "+ + "Expected size <= %d bytes, provider wants %d bytes", + maxStateStoreChunkSize, chunkSize, + )) + return nil, cty.NilVal, cty.NilVal, diags + } + + p, ok := provider.(providers.StateStoreChunkSizeSetter) + if !ok { + msg := fmt.Sprintf("Unable to set chunk size for provider %s; this is a bug in Terraform - please report it", c.Type) + panic(msg) + } + // casting to int here is okay because the number should never exceed int32 + p.SetStateStoreChunkSize(c.Type, int(chunkSize)) + + // Now we have a fully configured state store, ready to be used. + // To make it usable we need to return it in a backend.Backend interface. + b, err := backendPluggable.NewPluggable(provider, c.Type) + if err != nil { + diags = diags.Append(err) + return nil, cty.NilVal, cty.NilVal, diags + } + + return b, stateStoreConfigVal, providerConfigVal, diags +} + // Helper method to get aliases from the enhanced backend and alias them // in the Meta service discovery. It's unfortunate that the Meta backend // is modifying the service discovery at this level, but the owner @@ -1746,6 +2297,40 @@ func (m *Meta) assertSupportedCloudInitOptions(mode cloud.ConfigChangeMode) tfdi return diags } +func (m *Meta) getStateStoreProviderFactory(config *configs.StateStore, configLocks *depsfile.Locks) (providers.Factory, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + + if config.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", + config.Type, + config.Provider.Name)) + } + + factories, err := m.ProviderFactoriesFromLocks(configLocks) + if err != nil { + return nil, diags.Append(fmt.Errorf("error when retrieving provider factories: %w", err)) + } + + factory, exists := factories[config.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.", + config.Provider.Name, + config.ProviderAddr, + config.Type, + ), + Subject: &config.TypeRange, + }) + return nil, diags + } + + return factory, diags +} + //------------------------------------------------------------------- // Output constants and initialization code //------------------------------------------------------------------- @@ -1829,6 +2414,21 @@ hasn't changed and try again. At this point, no changes to your existing configuration or state have been made. ` +const errStateStoreInit = ` +Reason: %s +The "state store" is the interface that Terraform uses to store state when +performing operations on the local machine. If this message is showing up, +it means that the Terraform configuration you're using is using a custom +configuration for state storage in Terraform. +Changes to state store configurations require reinitialization. This allows +Terraform to set up the new configuration, copy existing state, etc. Please run +"terraform init" with either the "-reconfigure" or "-migrate-state" flags to +use the current configuration. +If the change reason above is incorrect, please verify your configuration +hasn't changed and try again. At this point, no changes to your existing +configuration or state have been made. +` + const errBackendInitCloud = ` Reason: %s. @@ -1849,6 +2449,14 @@ are usually due to simple file permission errors. Please look at the error above, resolve it, and try again. ` +const errStateStoreWorkspaceCreate = ` +Error creating the default workspace using pluggable state store %s: %s + +This could be a bug in the provider used for state storage, or a bug in +Terraform. Please file an issue with the provider developers before reporting +a bug for Terraform. +` + const outputBackendMigrateChange = ` Terraform detected that the backend type changed from %q to %q. ` diff --git a/internal/command/meta_backend_test.go b/internal/command/meta_backend_test.go index 9f049ccf0871..32a1ca88cbf4 100644 --- a/internal/command/meta_backend_test.go +++ b/internal/command/meta_backend_test.go @@ -5,6 +5,7 @@ package command import ( "context" + "fmt" "io/ioutil" "os" "path/filepath" @@ -13,6 +14,7 @@ import ( "strings" "testing" + "github.com/apparentlymart/go-versions/versions" "github.com/hashicorp/cli" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/backend" @@ -21,6 +23,10 @@ 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/e2e" + "github.com/hashicorp/terraform/internal/getproviders" + "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" @@ -626,7 +632,7 @@ func TestMetaBackend_configureNewBackendWithStateExistingNoMigrate(t *testing.T) } // Saved backend state matching config -func TestMetaBackend_configuredUnchanged(t *testing.T) { +func TestMetaBackend_configuredBackendUnchanged(t *testing.T) { td := t.TempDir() testCopyDir(t, testFixturePath("backend-unchanged"), td) t.Chdir(td) @@ -2077,10 +2083,11 @@ func Test_determineInitReason(t *testing.T) { } // Newly configured state store +// Working directory has state_store in config but no preexisting backend state file // -// TODO(SarahFrench/radeksimko): currently this test only confirms that we're hitting the switch -// case for this scenario, and will need to be updated when that init feature is implemented. -func TestMetaBackend_configureNewStateStore(t *testing.T) { +// Tests that, during a non-init command, the command ends in with an error telling the user to run an init command +func TestMetaBackend_nonInitCommandInterrupted_uninitializedStateStore(t *testing.T) { + td := t.TempDir() testCopyDir(t, testFixturePath("state-store-new"), td) t.Chdir(td) @@ -2099,25 +2106,92 @@ func TestMetaBackend_configureNewStateStore(t *testing.T) { // // This imagines a provider called foo that contains // a pluggable state store implementation called bar. - mock := testStateStoreMock(t) + pssName := "test_store" + mock := &testing_provider.MockProvider{ + GetProviderSchemaResponse: &providers.GetProviderSchemaResponse{ + Provider: providers.Schema{ + Body: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "region": {Type: cty.String, Optional: true}, + }, + }, + }, + DataSources: map[string]providers.Schema{}, + ResourceTypes: map[string]providers.Schema{}, + ListResourceTypes: map[string]providers.Schema{}, + StateStores: map[string]providers.Schema{ + pssName: { + Body: &configschema.Block{ + Attributes: map[string]*configschema.Attribute{ + "value": { + Type: cty.String, + Required: true, + }, + }, + }, + }, + }, + }, + } + mock.WriteStateBytesFn = func(req providers.WriteStateBytesRequest) providers.WriteStateBytesResponse { + // Workspaces exist once the artefact representing it is written + if _, exist := mock.MockStates[req.StateId]; !exist { + // Ensure non-nil map + if mock.MockStates == nil { + mock.MockStates = make(map[string]interface{}) + } + + mock.MockStates[req.StateId] = req.Bytes + } + return providers.WriteStateBytesResponse{ + Diagnostics: nil, // success + } + } + mock.ReadStateBytesFn = func(req providers.ReadStateBytesRequest) providers.ReadStateBytesResponse { + state := []byte{} + if v, exist := mock.MockStates[req.StateId]; exist { + if s, ok := v.([]byte); ok { + state = s + } + } + return providers.ReadStateBytesResponse{ + Bytes: state, + Diagnostics: nil, // success + } + } factory := func() (providers.Interface, error) { return mock, nil } - // Get the operations backend + // Create locks - these would normally be the locks derived from config + locks := depsfile.NewLocks() + constraint, err := providerreqs.ParseVersionConstraints(">9.0.0") + if err != nil { + t.Fatalf("test setup failed when making constraint: %s", err) + } + expectedVersionString := "9.9.9" + expectedProviderSource := "registry.terraform.io/hashicorp/test" + locks.SetProvider( + addrs.MustParseProviderSourceString(expectedProviderSource), + versions.MustParseVersion(expectedVersionString), + constraint, + []providerreqs.Hash{"h1:foo"}, + ) + + // Act - get the operations backend _, beDiags := m.Backend(&BackendOpts{ - Init: true, + Init: false, StateStoreConfig: mod.StateStore, ProviderFactory: factory, + Locks: locks, }) if !beDiags.HasErrors() { - t.Fatal("expected an error to be returned during partial implementation of PSS") + t.Fatal("expected an error but got none") } - wantErr := "Configuring a state store for the first time is not implemented yet" - if !strings.Contains(beDiags.Err().Error(), wantErr) { - t.Fatalf("expected the returned error to contain %q, but got: %s", wantErr, beDiags.Err()) + expectedError := "State store initialization required, please run \"terraform init\": Reason: Initial configuration of the requested state_store \"test_store\" in provider test (\"registry.terraform.io/hashicorp/test\")" + if !strings.Contains(cleanString(beDiags.Err().Error()), expectedError) { + t.Fatalf("expected error to contain %s, but instead got: %s", expectedError, cleanString(beDiags.Err().Error())) } - } // Unsetting a saved state store @@ -2158,59 +2232,6 @@ func TestMetaBackend_configuredStateStoreUnset(t *testing.T) { } } -// Reconfiguring with an already configured state store. -// This should ignore the existing state_store config, and configure the new -// state store is if this is the first time. -// -// TODO(SarahFrench/radeksimko): currently this test only confirms that we're hitting the switch -// case for this scenario, and will need to be updated when that init feature is implemented. -func TestMetaBackend_reconfigureStateStoreChange(t *testing.T) { - td := t.TempDir() - testCopyDir(t, testFixturePath("state-store-reconfigure"), td) - t.Chdir(td) - - // Setup the meta - m := testMetaBackend(t, nil) - m.AllowExperimentalFeatures = true - - // this should not ask for input - m.input = false - - // cli flag -reconfigure - m.reconfigure = true - - // Get the state store's config - mod, loadDiags := m.loadSingleModule(td) - if loadDiags.HasErrors() { - t.Fatalf("unexpected error when loading test config: %s", loadDiags.Err()) - } - - // Get mock provider factory to be used during init - // - // This imagines a provider called foo that contains - // a pluggable state store implementation called bar. - mock := testStateStoreMock(t) - factory := func() (providers.Interface, error) { - return mock, nil - } - - // Get the operations backend - _, beDiags := m.Backend(&BackendOpts{ - Init: true, - StateStoreConfig: mod.StateStore, - ProviderFactory: factory, - }) - - if !beDiags.HasErrors() { - t.Fatal("expected an error to be returned during partial implementation of PSS") - } - wantErr := "Configuring a state store for the first time is not implemented yet" - if !strings.Contains(beDiags.Err().Error(), wantErr) { - t.Fatalf("expected the returned error to contain %q, but got: %s", wantErr, beDiags.Err()) - } - -} - // Changing a configured state store // // TODO(SarahFrench/radeksimko): currently this test only confirms that we're hitting the switch @@ -2397,6 +2418,55 @@ func TestMetaBackend_configureStateStoreVariableUse(t *testing.T) { } } +func TestMetaBackend_getStateStoreProviderFactory(t *testing.T) { + // Reused in tests + constraint, err := providerreqs.ParseVersionConstraints(">1.0.0") + if err != nil { + t.Fatalf("test setup failed when making constraint: %s", err) + } + + t.Run("gets factories from locks", func(t *testing.T) { + // Set up locks + locks := depsfile.NewLocks() + providerAddr := addrs.MustParseProviderSourceString("registry.terraform.io/hashicorp/simple") + locks.SetProvider( + providerAddr, + versions.MustParseVersion("9.9.9"), + constraint, + []providerreqs.Hash{"h1:foo"}, + ) + + // 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)) + + // Setup the meta and test providerFactoriesDuringInit + m := testMetaBackend(t, nil) + factories, err := m.ProviderFactoriesFromLocks(locks) + if err != nil { + t.Fatalf("unexpected error : %s", err) + } + + if len(factories) != 1 { + t.Fatalf("expected 1 factory but got %d: %#v", len(factories), factories) + } + if _, ok := factories[providerAddr]; !ok { + t.Fatalf("expected to find factory for %s but its missing", providerAddr) + } + }) +} + 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/command/testdata/init-with-state-store/main.tf b/internal/command/testdata/init-with-state-store/main.tf index 9939e9dece2b..604feb44fed7 100644 --- a/internal/command/testdata/init-with-state-store/main.tf +++ b/internal/command/testdata/init-with-state-store/main.tf @@ -1,11 +1,11 @@ terraform { required_providers { - foo = { - source = "my-org/foo" + test = { + source = "hashicorp/test" } } - state_store "foo_foo" { - provider "foo" {} + state_store "test_store" { + provider "test" {} } } diff --git a/internal/command/testdata/state-store-new/main.tf b/internal/command/testdata/state-store-new/main.tf index 37fb2ac835a6..b62d81df6447 100644 --- a/internal/command/testdata/state-store-new/main.tf +++ b/internal/command/testdata/state-store-new/main.tf @@ -5,7 +5,9 @@ terraform { } } state_store "test_store" { - provider "test" {} + provider "test" { + region = "mars" + } value = "foobar" } diff --git a/internal/command/views/init.go b/internal/command/views/init.go index 35d79e1ba815..c97d2f7ffcf5 100644 --- a/internal/command/views/init.go +++ b/internal/command/views/init.go @@ -182,6 +182,10 @@ var MessageRegistry map[InitMessageCode]InitMessage = map[InitMessageCode]InitMe HumanValue: "\n[reset][bold]Initializing the backend...", JSONValue: "Initializing the backend...", }, + "initializing_state_store_message": { + HumanValue: "\n[reset][bold]Initializing the state store...", + JSONValue: "Initializing the state store...", + }, "initializing_provider_plugin_message": { HumanValue: "\n[reset][bold]Initializing provider plugins...", JSONValue: "Initializing provider plugins...", @@ -194,10 +198,6 @@ var MessageRegistry map[InitMessageCode]InitMessage = map[InitMessageCode]InitMe HumanValue: "\n[reset][bold]Initializing provider plugins found in the state...", JSONValue: "Initializing provider plugins found in the state...", }, - "initializing_state_store_message": { - HumanValue: "\n[reset][bold]Initializing the state store...", - JSONValue: "Initializing the state store...", - }, "dependencies_lock_changes_info": { HumanValue: dependenciesLockChangesInfo, JSONValue: dependenciesLockChangesInfo, diff --git a/internal/configs/state_store.go b/internal/configs/state_store.go index aa12509095c3..16da71827daa 100644 --- a/internal/configs/state_store.go +++ b/internal/configs/state_store.go @@ -116,8 +116,9 @@ func resolveStateStoreProviderType(requiredProviders map[string]*RequiredProvide diags = append(diags, &hcl.Diagnostic{ Severity: hcl.DiagError, Summary: "Missing entry in required_providers", - Detail: fmt.Sprintf("The provider used for state storage must have a matching entry in required_providers. Please add an entry for provider %q", - stateStore.Provider.Name), + Detail: fmt.Sprintf("The provider used for state storage must have a matching entry in required_providers. Please add an entry for provider %s (%q)", + stateStore.Provider.Name, + stateStore.ProviderAddr), Subject: &stateStore.DeclRange, }) return tfaddr.Provider{}, diags diff --git a/internal/getproviders/providerreqs/version.go b/internal/getproviders/providerreqs/version.go index 579eceb9ac4c..2fc15fc499de 100644 --- a/internal/getproviders/providerreqs/version.go +++ b/internal/getproviders/providerreqs/version.go @@ -20,6 +20,8 @@ import ( "github.com/apparentlymart/go-versions/versions" "github.com/apparentlymart/go-versions/versions/constraints" + "github.com/hashicorp/go-version" + "github.com/hashicorp/terraform/internal/addrs" ) @@ -86,6 +88,12 @@ func ParseVersion(str string) (Version, error) { return versions.ParseVersion(str) } +// GoVersionFromVersion converts a Version from the providerreqs package +// into a Version from the hashicorp/go-version module. +func GoVersionFromVersion(v Version) (*version.Version, error) { + return version.NewVersion(v.String()) +} + // MustParseVersion is a variant of ParseVersion that panics if it encounters // an error while parsing. func MustParseVersion(str string) Version { 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 c3c0793dc27c..0dbd6d9d91be 100644 --- a/internal/plugin/grpc_provider.go +++ b/internal/plugin/grpc_provider.go @@ -1458,6 +1458,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 b991ed6b8d0f..505dbe10cba4 100644 --- a/internal/plugin6/grpc_provider.go +++ b/internal/plugin6/grpc_provider.go @@ -4,6 +4,7 @@ package plugin6 import ( + "bytes" "context" "errors" "fmt" @@ -47,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 @@ -74,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 { @@ -1502,11 +1512,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) @@ -1514,10 +1528,202 @@ 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 + // TODO: Send warning if client misbehaves and uses (lower) chunk size that we didn't agree on + 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) + + 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 + } + + // There is more data to write + protoReq := &proto6.WriteStateBytes_RequestChunk{ + TypeName: r.TypeName, + StateId: r.StateId, + 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") @@ -1771,3 +1977,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 5e375c66ce53..481dfb2bdb91 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() { @@ -2549,3 +2561,668 @@ func TestGRPCProvider_DeleteState(t *testing.T) { } }) } + +func TestGRPCProvider_ReadStateBytes(t *testing.T) { + t.Run("can process multiple chunks", func(t *testing.T) { + client := mockProviderClient(t) + p := &GRPCProvider{ + client: client, + ctx: context.Background(), + } + + // 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), + ).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(), + } + + // 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), + ).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(), + } + + // 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(), + } + + // 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), + ).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(), + } + + // 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), + ).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(), + } + + // 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), + ).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(), + } + + // 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), + ).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)) + } + }) +} + +func TestGRPCProvider_WriteStateBytes(t *testing.T) { + 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(), + } + + // 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{ + 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(), + } + + // 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{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + Bytes: dataFirstChunk, + TotalLength: int64(len(data)), + Range: &proto.StateRange{ + Start: 0, + End: int64(chunkSize), + }, + } + req2 := &proto.WriteStateBytes_RequestChunk{ + TypeName: "mock_store", + StateId: backend.DefaultStateName, + 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(), + } + + // 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(), + } + + // 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{ + 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(), + } + + // 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{ + 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 45462d08bb39..c1883d7f0410 100644 --- a/internal/provider-simple-v6/provider.go +++ b/internal/provider-simple-v6/provider.go @@ -315,6 +315,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 1da26521350d..6399d8cae314 100644 --- a/internal/provider-simple/provider.go +++ b/internal/provider-simple/provider.go @@ -275,6 +275,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 b19c1451a501..948e442b9f51 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 @@ -834,11 +843,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..953577a58973 100644 --- a/internal/providers/testing/provider_mock.go +++ b/internal/providers/testing/provider_mock.go @@ -5,12 +5,15 @@ package testing import ( "fmt" + "maps" + "slices" "sync" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" "github.com/zclconf/go-cty/cty/msgpack" + "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform/internal/configs/hcl2shim" "github.com/hashicorp/terraform/internal/providers" ) @@ -146,6 +149,20 @@ 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 + + // MockStates is an internal field that tracks which workspaces have been created in a test + // The map keys are state ids (workspaces) and the value depends on the test. + MockStates map[string]interface{} + GetStatesCalled bool GetStatesResponse *providers.GetStatesResponse GetStatesRequest providers.GetStatesRequest @@ -304,6 +321,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()() @@ -996,11 +1039,8 @@ func (p *MockProvider) GetStates(r providers.GetStatesRequest) (resp providers.G return p.GetStatesFn(r) } - // If the mock has no further inputs, return an empty list. - // The state store should be reporting a minimum of the default workspace usually, - // but this should be achieved by querying data storage and identifying the artifact - // for that workspace, and reporting that the workspace exists. - resp.States = []string{} + // If the mock has no further inputs, return the internal states list + resp.States = slices.Sorted(maps.Keys(p.MockStates)) return resp } @@ -1027,7 +1067,15 @@ func (p *MockProvider) DeleteState(r providers.DeleteStateRequest) (resp provide return p.DeleteStateFn(r) } - // There's no logic we can include here in the absence of other fields on the mock. + if _, match := p.MockStates[r.StateId]; match { + delete(p.MockStates, r.StateId) + } else { + resp.Diagnostics.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Workspace cannot be deleted", + Detail: fmt.Sprintf("The workspace %q does not exist, so cannot be deleted", r.StateId), + }) + } // If the response contains no diagnostics then the deletion is assumed to be successful. return resp 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/states/remote/remote_grpc.go b/internal/states/remote/remote_grpc.go index cc3d1ce7d57c..4c9f9c1b2cc5 100644 --- a/internal/states/remote/remote_grpc.go +++ b/internal/states/remote/remote_grpc.go @@ -54,7 +54,23 @@ type grpcClient struct { // // Implementation of remote.Client func (g *grpcClient) Get() (*Payload, tfdiags.Diagnostics) { - panic("not implemented yet") + // TODO - replace with method implementation added to main branch + req := providers.ReadStateBytesRequest{ + TypeName: g.typeName, + StateId: g.stateId, + } + resp := g.provider.ReadStateBytes(req) + + if len(resp.Bytes) == 0 { + // No state to return + return nil, resp.Diagnostics + } + + payload := &Payload{ + Data: resp.Bytes, + MD5: []byte("foobar"), + } + return payload, resp.Diagnostics } // Put invokes the WriteStateBytes gRPC method in the plugin protocol @@ -62,7 +78,15 @@ func (g *grpcClient) Get() (*Payload, tfdiags.Diagnostics) { // // Implementation of remote.Client func (g *grpcClient) Put(state []byte) tfdiags.Diagnostics { - panic("not implemented yet") + // TODO - replace with method implementation added to main branch + req := providers.WriteStateBytesRequest{ + TypeName: g.typeName, + StateId: g.stateId, + Bytes: state, + } + resp := g.provider.WriteStateBytes(req) + + return resp.Diagnostics } // Delete invokes the DeleteState gRPC method in the plugin protocol diff --git a/internal/tfplugin6/tfplugin6.pb.go b/internal/tfplugin6/tfplugin6.pb.go index c40bb14b33be..d6d664cf4932 100644 --- a/internal/tfplugin6/tfplugin6.pb.go +++ b/internal/tfplugin6/tfplugin6.pb.go @@ -2074,6 +2074,218 @@ 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 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[44] + 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[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 StateRange.ProtoReflect.Descriptor instead. +func (*StateRange) Descriptor() ([]byte, []int) { + return file_tfplugin6_proto_rawDescGZIP(), []int{44} +} + +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 +2294,7 @@ type GetStates struct { func (x *GetStates) Reset() { *x = GetStates{} - mi := &file_tfplugin6_proto_msgTypes[40] + mi := &file_tfplugin6_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2094,7 +2306,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[45] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2107,7 +2319,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{45} } type DeleteState struct { @@ -2118,7 +2330,7 @@ type DeleteState struct { func (x *DeleteState) Reset() { *x = DeleteState{} - mi := &file_tfplugin6_proto_msgTypes[41] + mi := &file_tfplugin6_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2130,7 +2342,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[46] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2143,7 +2355,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{46} } type PlanAction struct { @@ -2154,7 +2366,7 @@ type PlanAction struct { func (x *PlanAction) Reset() { *x = PlanAction{} - mi := &file_tfplugin6_proto_msgTypes[42] + mi := &file_tfplugin6_proto_msgTypes[47] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2166,7 +2378,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[47] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2179,7 +2391,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{47} } type InvokeAction struct { @@ -2190,7 +2402,7 @@ type InvokeAction struct { func (x *InvokeAction) Reset() { *x = InvokeAction{} - mi := &file_tfplugin6_proto_msgTypes[43] + mi := &file_tfplugin6_proto_msgTypes[48] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2202,7 +2414,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[48] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2215,7 +2427,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{48} } type ValidateActionConfig struct { @@ -2226,7 +2438,7 @@ type ValidateActionConfig struct { func (x *ValidateActionConfig) Reset() { *x = ValidateActionConfig{} - mi := &file_tfplugin6_proto_msgTypes[44] + mi := &file_tfplugin6_proto_msgTypes[49] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2238,7 +2450,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[49] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2251,7 +2463,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{49} } type AttributePath_Step struct { @@ -2268,7 +2480,7 @@ type AttributePath_Step struct { func (x *AttributePath_Step) Reset() { *x = AttributePath_Step{} - mi := &file_tfplugin6_proto_msgTypes[45] + mi := &file_tfplugin6_proto_msgTypes[50] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2280,7 +2492,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[50] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2364,7 +2576,7 @@ type StopProvider_Request struct { func (x *StopProvider_Request) Reset() { *x = StopProvider_Request{} - mi := &file_tfplugin6_proto_msgTypes[46] + mi := &file_tfplugin6_proto_msgTypes[51] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2376,7 +2588,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[51] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2401,7 +2613,7 @@ type StopProvider_Response struct { func (x *StopProvider_Response) Reset() { *x = StopProvider_Response{} - mi := &file_tfplugin6_proto_msgTypes[47] + mi := &file_tfplugin6_proto_msgTypes[52] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2413,7 +2625,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[52] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2459,7 +2671,7 @@ type ResourceIdentitySchema_IdentityAttribute struct { func (x *ResourceIdentitySchema_IdentityAttribute) Reset() { *x = ResourceIdentitySchema_IdentityAttribute{} - mi := &file_tfplugin6_proto_msgTypes[49] + mi := &file_tfplugin6_proto_msgTypes[54] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2471,7 +2683,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[54] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2536,7 +2748,7 @@ type Schema_Block struct { func (x *Schema_Block) Reset() { *x = Schema_Block{} - mi := &file_tfplugin6_proto_msgTypes[50] + mi := &file_tfplugin6_proto_msgTypes[55] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2548,7 +2760,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[55] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2625,7 +2837,7 @@ type Schema_Attribute struct { func (x *Schema_Attribute) Reset() { *x = Schema_Attribute{} - mi := &file_tfplugin6_proto_msgTypes[51] + mi := &file_tfplugin6_proto_msgTypes[56] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2637,7 +2849,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[56] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2743,7 +2955,7 @@ type Schema_NestedBlock struct { func (x *Schema_NestedBlock) Reset() { *x = Schema_NestedBlock{} - mi := &file_tfplugin6_proto_msgTypes[52] + mi := &file_tfplugin6_proto_msgTypes[57] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2755,7 +2967,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[57] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2823,7 +3035,7 @@ type Schema_Object struct { func (x *Schema_Object) Reset() { *x = Schema_Object{} - mi := &file_tfplugin6_proto_msgTypes[53] + mi := &file_tfplugin6_proto_msgTypes[58] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2835,7 +3047,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[58] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2906,7 +3118,7 @@ type Function_Parameter struct { func (x *Function_Parameter) Reset() { *x = Function_Parameter{} - mi := &file_tfplugin6_proto_msgTypes[54] + mi := &file_tfplugin6_proto_msgTypes[59] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2918,7 +3130,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[59] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2986,7 +3198,7 @@ type Function_Return struct { func (x *Function_Return) Reset() { *x = Function_Return{} - mi := &file_tfplugin6_proto_msgTypes[55] + mi := &file_tfplugin6_proto_msgTypes[60] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2998,7 +3210,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[60] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3029,7 +3241,7 @@ type GetMetadata_Request struct { func (x *GetMetadata_Request) Reset() { *x = GetMetadata_Request{} - mi := &file_tfplugin6_proto_msgTypes[56] + mi := &file_tfplugin6_proto_msgTypes[61] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3041,7 +3253,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[61] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3075,7 +3287,7 @@ type GetMetadata_Response struct { func (x *GetMetadata_Response) Reset() { *x = GetMetadata_Response{} - mi := &file_tfplugin6_proto_msgTypes[57] + mi := &file_tfplugin6_proto_msgTypes[62] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3087,7 +3299,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[62] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3175,7 +3387,7 @@ type GetMetadata_EphemeralMetadata struct { func (x *GetMetadata_EphemeralMetadata) Reset() { *x = GetMetadata_EphemeralMetadata{} - mi := &file_tfplugin6_proto_msgTypes[58] + mi := &file_tfplugin6_proto_msgTypes[63] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3187,7 +3399,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[63] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3220,7 +3432,7 @@ type GetMetadata_FunctionMetadata struct { func (x *GetMetadata_FunctionMetadata) Reset() { *x = GetMetadata_FunctionMetadata{} - mi := &file_tfplugin6_proto_msgTypes[59] + mi := &file_tfplugin6_proto_msgTypes[64] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3232,7 +3444,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[64] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3264,7 +3476,7 @@ type GetMetadata_DataSourceMetadata struct { func (x *GetMetadata_DataSourceMetadata) Reset() { *x = GetMetadata_DataSourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[60] + mi := &file_tfplugin6_proto_msgTypes[65] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3276,7 +3488,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[65] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3308,7 +3520,7 @@ type GetMetadata_ResourceMetadata struct { func (x *GetMetadata_ResourceMetadata) Reset() { *x = GetMetadata_ResourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[61] + mi := &file_tfplugin6_proto_msgTypes[66] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3320,7 +3532,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[66] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3352,7 +3564,7 @@ type GetMetadata_ListResourceMetadata struct { func (x *GetMetadata_ListResourceMetadata) Reset() { *x = GetMetadata_ListResourceMetadata{} - mi := &file_tfplugin6_proto_msgTypes[62] + mi := &file_tfplugin6_proto_msgTypes[67] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3364,7 +3576,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[67] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3396,7 +3608,7 @@ type GetMetadata_StateStoreMetadata struct { func (x *GetMetadata_StateStoreMetadata) Reset() { *x = GetMetadata_StateStoreMetadata{} - mi := &file_tfplugin6_proto_msgTypes[63] + mi := &file_tfplugin6_proto_msgTypes[68] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3408,7 +3620,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[68] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3440,7 +3652,7 @@ type GetMetadata_ActionMetadata struct { func (x *GetMetadata_ActionMetadata) Reset() { *x = GetMetadata_ActionMetadata{} - mi := &file_tfplugin6_proto_msgTypes[64] + mi := &file_tfplugin6_proto_msgTypes[69] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3452,7 +3664,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[69] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3483,7 +3695,7 @@ type GetProviderSchema_Request struct { func (x *GetProviderSchema_Request) Reset() { *x = GetProviderSchema_Request{} - mi := &file_tfplugin6_proto_msgTypes[65] + mi := &file_tfplugin6_proto_msgTypes[70] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3495,7 +3707,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[70] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3530,7 +3742,7 @@ type GetProviderSchema_Response struct { func (x *GetProviderSchema_Response) Reset() { *x = GetProviderSchema_Response{} - mi := &file_tfplugin6_proto_msgTypes[66] + mi := &file_tfplugin6_proto_msgTypes[71] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3542,7 +3754,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[71] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3644,7 +3856,7 @@ type ValidateProviderConfig_Request struct { func (x *ValidateProviderConfig_Request) Reset() { *x = ValidateProviderConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[74] + mi := &file_tfplugin6_proto_msgTypes[79] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3656,7 +3868,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[79] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3688,7 +3900,7 @@ type ValidateProviderConfig_Response struct { func (x *ValidateProviderConfig_Response) Reset() { *x = ValidateProviderConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[75] + mi := &file_tfplugin6_proto_msgTypes[80] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3700,7 +3912,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[80] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3749,7 +3961,7 @@ type UpgradeResourceState_Request struct { func (x *UpgradeResourceState_Request) Reset() { *x = UpgradeResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[76] + mi := &file_tfplugin6_proto_msgTypes[81] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3761,7 +3973,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[81] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3814,7 +4026,7 @@ type UpgradeResourceState_Response struct { func (x *UpgradeResourceState_Response) Reset() { *x = UpgradeResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[77] + mi := &file_tfplugin6_proto_msgTypes[82] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3826,7 +4038,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[82] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3864,7 +4076,7 @@ type GetResourceIdentitySchemas_Request struct { func (x *GetResourceIdentitySchemas_Request) Reset() { *x = GetResourceIdentitySchemas_Request{} - mi := &file_tfplugin6_proto_msgTypes[78] + mi := &file_tfplugin6_proto_msgTypes[83] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3876,7 +4088,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[83] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3904,7 +4116,7 @@ type GetResourceIdentitySchemas_Response struct { func (x *GetResourceIdentitySchemas_Response) Reset() { *x = GetResourceIdentitySchemas_Response{} - mi := &file_tfplugin6_proto_msgTypes[79] + mi := &file_tfplugin6_proto_msgTypes[84] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3916,7 +4128,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[84] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3963,7 +4175,7 @@ type UpgradeResourceIdentity_Request struct { func (x *UpgradeResourceIdentity_Request) Reset() { *x = UpgradeResourceIdentity_Request{} - mi := &file_tfplugin6_proto_msgTypes[81] + mi := &file_tfplugin6_proto_msgTypes[86] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -3975,7 +4187,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[86] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4024,7 +4236,7 @@ type UpgradeResourceIdentity_Response struct { func (x *UpgradeResourceIdentity_Response) Reset() { *x = UpgradeResourceIdentity_Response{} - mi := &file_tfplugin6_proto_msgTypes[82] + mi := &file_tfplugin6_proto_msgTypes[87] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4036,7 +4248,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[87] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4077,7 +4289,7 @@ type ValidateResourceConfig_Request struct { func (x *ValidateResourceConfig_Request) Reset() { *x = ValidateResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[83] + mi := &file_tfplugin6_proto_msgTypes[88] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4089,7 +4301,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[88] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4135,7 +4347,7 @@ type ValidateResourceConfig_Response struct { func (x *ValidateResourceConfig_Response) Reset() { *x = ValidateResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[84] + mi := &file_tfplugin6_proto_msgTypes[89] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4147,7 +4359,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[89] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4180,7 +4392,7 @@ type ValidateDataResourceConfig_Request struct { func (x *ValidateDataResourceConfig_Request) Reset() { *x = ValidateDataResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[85] + mi := &file_tfplugin6_proto_msgTypes[90] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4192,7 +4404,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[90] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4231,7 +4443,7 @@ type ValidateDataResourceConfig_Response struct { func (x *ValidateDataResourceConfig_Response) Reset() { *x = ValidateDataResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[86] + mi := &file_tfplugin6_proto_msgTypes[91] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4243,7 +4455,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[91] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4276,7 +4488,7 @@ type ValidateEphemeralResourceConfig_Request struct { func (x *ValidateEphemeralResourceConfig_Request) Reset() { *x = ValidateEphemeralResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[87] + mi := &file_tfplugin6_proto_msgTypes[92] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4288,7 +4500,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[92] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4327,7 +4539,7 @@ type ValidateEphemeralResourceConfig_Response struct { func (x *ValidateEphemeralResourceConfig_Response) Reset() { *x = ValidateEphemeralResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[88] + mi := &file_tfplugin6_proto_msgTypes[93] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4339,7 +4551,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[93] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4373,7 +4585,7 @@ type ConfigureProvider_Request struct { func (x *ConfigureProvider_Request) Reset() { *x = ConfigureProvider_Request{} - mi := &file_tfplugin6_proto_msgTypes[89] + mi := &file_tfplugin6_proto_msgTypes[94] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4385,7 +4597,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[94] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4431,7 +4643,7 @@ type ConfigureProvider_Response struct { func (x *ConfigureProvider_Response) Reset() { *x = ConfigureProvider_Response{} - mi := &file_tfplugin6_proto_msgTypes[90] + mi := &file_tfplugin6_proto_msgTypes[95] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4443,7 +4655,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[95] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4488,7 +4700,7 @@ type ReadResource_Request struct { func (x *ReadResource_Request) Reset() { *x = ReadResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[91] + mi := &file_tfplugin6_proto_msgTypes[96] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4500,7 +4712,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[96] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4573,7 +4785,7 @@ type ReadResource_Response struct { func (x *ReadResource_Response) Reset() { *x = ReadResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[92] + mi := &file_tfplugin6_proto_msgTypes[97] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4585,7 +4797,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[97] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4652,7 +4864,7 @@ type PlanResourceChange_Request struct { func (x *PlanResourceChange_Request) Reset() { *x = PlanResourceChange_Request{} - mi := &file_tfplugin6_proto_msgTypes[93] + mi := &file_tfplugin6_proto_msgTypes[98] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4664,7 +4876,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[98] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4764,7 +4976,7 @@ type PlanResourceChange_Response struct { func (x *PlanResourceChange_Response) Reset() { *x = PlanResourceChange_Response{} - mi := &file_tfplugin6_proto_msgTypes[94] + mi := &file_tfplugin6_proto_msgTypes[99] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4776,7 +4988,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[99] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4856,7 +5068,7 @@ type ApplyResourceChange_Request struct { func (x *ApplyResourceChange_Request) Reset() { *x = ApplyResourceChange_Request{} - mi := &file_tfplugin6_proto_msgTypes[95] + mi := &file_tfplugin6_proto_msgTypes[100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4868,7 +5080,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[100] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4957,7 +5169,7 @@ type ApplyResourceChange_Response struct { func (x *ApplyResourceChange_Response) Reset() { *x = ApplyResourceChange_Response{} - mi := &file_tfplugin6_proto_msgTypes[96] + mi := &file_tfplugin6_proto_msgTypes[101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4969,7 +5181,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[101] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5032,7 +5244,7 @@ type ImportResourceState_Request struct { func (x *ImportResourceState_Request) Reset() { *x = ImportResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[97] + mi := &file_tfplugin6_proto_msgTypes[102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5044,7 +5256,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[102] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5100,7 +5312,7 @@ type ImportResourceState_ImportedResource struct { func (x *ImportResourceState_ImportedResource) Reset() { *x = ImportResourceState_ImportedResource{} - mi := &file_tfplugin6_proto_msgTypes[98] + mi := &file_tfplugin6_proto_msgTypes[103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5112,7 +5324,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[103] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5169,7 +5381,7 @@ type ImportResourceState_Response struct { func (x *ImportResourceState_Response) Reset() { *x = ImportResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[99] + mi := &file_tfplugin6_proto_msgTypes[104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5181,7 +5393,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[104] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5228,7 +5440,7 @@ type GenerateResourceConfig_Request struct { func (x *GenerateResourceConfig_Request) Reset() { *x = GenerateResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[100] + mi := &file_tfplugin6_proto_msgTypes[105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5240,7 +5452,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[105] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5281,7 +5493,7 @@ type GenerateResourceConfig_Response struct { func (x *GenerateResourceConfig_Response) Reset() { *x = GenerateResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[101] + mi := &file_tfplugin6_proto_msgTypes[106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5293,7 +5505,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[106] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5353,7 +5565,7 @@ type MoveResourceState_Request struct { func (x *MoveResourceState_Request) Reset() { *x = MoveResourceState_Request{} - mi := &file_tfplugin6_proto_msgTypes[102] + mi := &file_tfplugin6_proto_msgTypes[107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5365,7 +5577,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[107] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5452,7 +5664,7 @@ type MoveResourceState_Response struct { func (x *MoveResourceState_Response) Reset() { *x = MoveResourceState_Response{} - mi := &file_tfplugin6_proto_msgTypes[103] + mi := &file_tfplugin6_proto_msgTypes[108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5464,7 +5676,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[108] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5520,7 +5732,7 @@ type ReadDataSource_Request struct { func (x *ReadDataSource_Request) Reset() { *x = ReadDataSource_Request{} - mi := &file_tfplugin6_proto_msgTypes[104] + mi := &file_tfplugin6_proto_msgTypes[109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5532,7 +5744,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[109] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5589,7 +5801,7 @@ type ReadDataSource_Response struct { func (x *ReadDataSource_Response) Reset() { *x = ReadDataSource_Response{} - mi := &file_tfplugin6_proto_msgTypes[105] + mi := &file_tfplugin6_proto_msgTypes[110] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5601,7 +5813,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[110] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5649,7 +5861,7 @@ type OpenEphemeralResource_Request struct { func (x *OpenEphemeralResource_Request) Reset() { *x = OpenEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[106] + mi := &file_tfplugin6_proto_msgTypes[111] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5661,7 +5873,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[111] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5711,7 +5923,7 @@ type OpenEphemeralResource_Response struct { func (x *OpenEphemeralResource_Response) Reset() { *x = OpenEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[107] + mi := &file_tfplugin6_proto_msgTypes[112] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5723,7 +5935,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[112] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5784,7 +5996,7 @@ type RenewEphemeralResource_Request struct { func (x *RenewEphemeralResource_Request) Reset() { *x = RenewEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[108] + mi := &file_tfplugin6_proto_msgTypes[113] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5796,7 +6008,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[113] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5837,7 +6049,7 @@ type RenewEphemeralResource_Response struct { func (x *RenewEphemeralResource_Response) Reset() { *x = RenewEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[109] + mi := &file_tfplugin6_proto_msgTypes[114] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5849,7 +6061,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[114] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5896,7 +6108,7 @@ type CloseEphemeralResource_Request struct { func (x *CloseEphemeralResource_Request) Reset() { *x = CloseEphemeralResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[110] + mi := &file_tfplugin6_proto_msgTypes[115] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5908,7 +6120,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[115] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5947,7 +6159,7 @@ type CloseEphemeralResource_Response struct { func (x *CloseEphemeralResource_Response) Reset() { *x = CloseEphemeralResource_Response{} - mi := &file_tfplugin6_proto_msgTypes[111] + mi := &file_tfplugin6_proto_msgTypes[116] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -5959,7 +6171,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[116] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5990,7 +6202,7 @@ type GetFunctions_Request struct { func (x *GetFunctions_Request) Reset() { *x = GetFunctions_Request{} - mi := &file_tfplugin6_proto_msgTypes[112] + mi := &file_tfplugin6_proto_msgTypes[117] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6002,7 +6214,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[117] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6030,7 +6242,7 @@ type GetFunctions_Response struct { func (x *GetFunctions_Response) Reset() { *x = GetFunctions_Response{} - mi := &file_tfplugin6_proto_msgTypes[113] + mi := &file_tfplugin6_proto_msgTypes[118] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6042,7 +6254,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[118] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6082,7 +6294,7 @@ type CallFunction_Request struct { func (x *CallFunction_Request) Reset() { *x = CallFunction_Request{} - mi := &file_tfplugin6_proto_msgTypes[115] + mi := &file_tfplugin6_proto_msgTypes[120] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6094,7 +6306,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[120] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6134,7 +6346,7 @@ type CallFunction_Response struct { func (x *CallFunction_Response) Reset() { *x = CallFunction_Response{} - mi := &file_tfplugin6_proto_msgTypes[116] + mi := &file_tfplugin6_proto_msgTypes[121] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6146,7 +6358,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[121] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6194,7 +6406,7 @@ type ListResource_Request struct { func (x *ListResource_Request) Reset() { *x = ListResource_Request{} - mi := &file_tfplugin6_proto_msgTypes[117] + mi := &file_tfplugin6_proto_msgTypes[122] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6206,7 +6418,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[122] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6266,7 +6478,7 @@ type ListResource_Event struct { func (x *ListResource_Event) Reset() { *x = ListResource_Event{} - mi := &file_tfplugin6_proto_msgTypes[118] + mi := &file_tfplugin6_proto_msgTypes[123] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6278,7 +6490,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[123] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6334,7 +6546,7 @@ type ValidateListResourceConfig_Request struct { func (x *ValidateListResourceConfig_Request) Reset() { *x = ValidateListResourceConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[119] + mi := &file_tfplugin6_proto_msgTypes[124] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6346,7 +6558,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[124] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6399,19 +6611,220 @@ type ValidateListResourceConfig_Response struct { func (x *ValidateListResourceConfig_Response) Reset() { *x = ValidateListResourceConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[120] + mi := &file_tfplugin6_proto_msgTypes[125] + 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[125] + 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[126] + 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[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 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[127] + 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[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_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[128] + 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[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 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 *ConfigureStateStore_Response) Reset() { + *x = ConfigureStateStore_Response{} + mi := &file_tfplugin6_proto_msgTypes[129] 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[129] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6422,41 +6835,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[130] 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[130] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6467,47 +6887,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[131] 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[131] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6518,41 +6941,66 @@ 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"` + // TODO: Can we decouple this outside of the stream? + TypeName string `protobuf:"bytes,1,opt,name=type_name,json=typeName,proto3" json:"type_name,omitempty"` + StateId string `protobuf:"bytes,3,opt,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` + Bytes []byte `protobuf:"bytes,2,opt,name=bytes,proto3" json:"bytes,omitempty"` + TotalLength int64 `protobuf:"varint,4,opt,name=total_length,json=totalLength,proto3" json:"total_length,omitempty"` + Range *StateRange `protobuf:"bytes,5,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[132] 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[132] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6563,47 +7011,68 @@ 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) GetTypeName() string { if x != nil { return x.TypeName } return "" } -func (x *ConfigureStateStore_Request) GetConfig() *DynamicValue { +func (x *WriteStateBytes_RequestChunk) GetStateId() string { if x != nil { - return x.Config + return x.StateId + } + return "" +} + +func (x *WriteStateBytes_RequestChunk) GetBytes() []byte { + if x != nil { + 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[133] 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[133] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6614,12 +7083,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 +7104,7 @@ type GetStates_Request struct { func (x *GetStates_Request) Reset() { *x = GetStates_Request{} - mi := &file_tfplugin6_proto_msgTypes[125] + mi := &file_tfplugin6_proto_msgTypes[134] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6647,7 +7116,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[134] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6660,7 +7129,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{45, 0} } func (x *GetStates_Request) GetTypeName() string { @@ -6680,7 +7149,7 @@ type GetStates_Response struct { func (x *GetStates_Response) Reset() { *x = GetStates_Response{} - mi := &file_tfplugin6_proto_msgTypes[126] + mi := &file_tfplugin6_proto_msgTypes[135] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6692,7 +7161,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[135] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6705,7 +7174,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{45, 1} } func (x *GetStates_Response) GetStateId() []string { @@ -6732,7 +7201,7 @@ type DeleteState_Request struct { func (x *DeleteState_Request) Reset() { *x = DeleteState_Request{} - mi := &file_tfplugin6_proto_msgTypes[127] + mi := &file_tfplugin6_proto_msgTypes[136] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6744,7 +7213,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[136] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6757,7 +7226,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{46, 0} } func (x *DeleteState_Request) GetTypeName() string { @@ -6783,7 +7252,7 @@ type DeleteState_Response struct { func (x *DeleteState_Response) Reset() { *x = DeleteState_Response{} - mi := &file_tfplugin6_proto_msgTypes[128] + mi := &file_tfplugin6_proto_msgTypes[137] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6795,7 +7264,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[137] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6808,7 +7277,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{46, 1} } func (x *DeleteState_Response) GetDiagnostics() []*Diagnostic { @@ -6831,7 +7300,7 @@ type PlanAction_Request struct { func (x *PlanAction_Request) Reset() { *x = PlanAction_Request{} - mi := &file_tfplugin6_proto_msgTypes[129] + mi := &file_tfplugin6_proto_msgTypes[138] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6843,7 +7312,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[138] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6856,7 +7325,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{47, 0} } func (x *PlanAction_Request) GetActionType() string { @@ -6891,7 +7360,7 @@ type PlanAction_Response struct { func (x *PlanAction_Response) Reset() { *x = PlanAction_Response{} - mi := &file_tfplugin6_proto_msgTypes[130] + mi := &file_tfplugin6_proto_msgTypes[139] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6903,7 +7372,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[139] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6916,7 +7385,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{47, 1} } func (x *PlanAction_Response) GetDiagnostics() []*Diagnostic { @@ -6946,7 +7415,7 @@ type InvokeAction_Request struct { func (x *InvokeAction_Request) Reset() { *x = InvokeAction_Request{} - mi := &file_tfplugin6_proto_msgTypes[131] + mi := &file_tfplugin6_proto_msgTypes[140] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6958,7 +7427,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[140] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6971,7 +7440,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{48, 0} } func (x *InvokeAction_Request) GetActionType() string { @@ -7008,7 +7477,7 @@ type InvokeAction_Event struct { func (x *InvokeAction_Event) Reset() { *x = InvokeAction_Event{} - mi := &file_tfplugin6_proto_msgTypes[132] + mi := &file_tfplugin6_proto_msgTypes[141] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7020,7 +7489,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[141] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7033,7 +7502,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{48, 1} } func (x *InvokeAction_Event) GetType() isInvokeAction_Event_Type { @@ -7087,7 +7556,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[142] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7099,7 +7568,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[142] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7112,7 +7581,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{48, 1, 0} } func (x *InvokeAction_Event_Progress) GetMessage() string { @@ -7131,7 +7600,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[143] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7143,7 +7612,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[143] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7156,7 +7625,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{48, 1, 1} } func (x *InvokeAction_Event_Completed) GetDiagnostics() []*Diagnostic { @@ -7176,7 +7645,7 @@ type ValidateActionConfig_Request struct { func (x *ValidateActionConfig_Request) Reset() { *x = ValidateActionConfig_Request{} - mi := &file_tfplugin6_proto_msgTypes[135] + mi := &file_tfplugin6_proto_msgTypes[144] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7188,7 +7657,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[144] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7201,7 +7670,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{49, 0} } func (x *ValidateActionConfig_Request) GetTypeName() string { @@ -7227,7 +7696,7 @@ type ValidateActionConfig_Response struct { func (x *ValidateActionConfig_Response) Reset() { *x = ValidateActionConfig_Response{} - mi := &file_tfplugin6_proto_msgTypes[136] + mi := &file_tfplugin6_proto_msgTypes[145] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -7239,7 +7708,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[145] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7252,7 +7721,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{49, 1} } func (x *ValidateActionConfig_Response) GetDiagnostics() []*Diagnostic { @@ -7700,13 +8169,43 @@ 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\"\x85\x02\n" + + "\x0fWriteStateBytes\x1a\xac\x01\n" + + "\fRequestChunk\x12\x1b\n" + + "\ttype_name\x18\x01 \x01(\tR\btypeName\x12\x19\n" + + "\bstate_id\x18\x03 \x01(\tR\astateId\x12\x14\n" + + "\x05bytes\x18\x02 \x01(\fR\x05bytes\x12!\n" + + "\ftotal_length\x18\x04 \x01(\x03R\vtotalLength\x12+\n" + + "\x05range\x18\x05 \x01(\v2\x15.tfplugin6.StateRangeR\x05range\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\"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 +8251,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 +8278,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 +8302,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, 146) var file_tfplugin6_proto_goTypes = []any{ (StringKind)(0), // 0: tfplugin6.StringKind (Diagnostic_Severity)(0), // 1: tfplugin6.Diagnostic.Severity @@ -7848,146 +8349,155 @@ 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 + (*StateRange)(nil), // 49: tfplugin6.StateRange + (*GetStates)(nil), // 50: tfplugin6.GetStates + (*DeleteState)(nil), // 51: tfplugin6.DeleteState + (*PlanAction)(nil), // 52: tfplugin6.PlanAction + (*InvokeAction)(nil), // 53: tfplugin6.InvokeAction + (*ValidateActionConfig)(nil), // 54: tfplugin6.ValidateActionConfig + (*AttributePath_Step)(nil), // 55: tfplugin6.AttributePath.Step + (*StopProvider_Request)(nil), // 56: tfplugin6.StopProvider.Request + (*StopProvider_Response)(nil), // 57: tfplugin6.StopProvider.Response + nil, // 58: tfplugin6.RawState.FlatmapEntry + (*ResourceIdentitySchema_IdentityAttribute)(nil), // 59: tfplugin6.ResourceIdentitySchema.IdentityAttribute + (*Schema_Block)(nil), // 60: tfplugin6.Schema.Block + (*Schema_Attribute)(nil), // 61: tfplugin6.Schema.Attribute + (*Schema_NestedBlock)(nil), // 62: tfplugin6.Schema.NestedBlock + (*Schema_Object)(nil), // 63: tfplugin6.Schema.Object + (*Function_Parameter)(nil), // 64: tfplugin6.Function.Parameter + (*Function_Return)(nil), // 65: tfplugin6.Function.Return + (*GetMetadata_Request)(nil), // 66: tfplugin6.GetMetadata.Request + (*GetMetadata_Response)(nil), // 67: tfplugin6.GetMetadata.Response + (*GetMetadata_EphemeralMetadata)(nil), // 68: tfplugin6.GetMetadata.EphemeralMetadata + (*GetMetadata_FunctionMetadata)(nil), // 69: tfplugin6.GetMetadata.FunctionMetadata + (*GetMetadata_DataSourceMetadata)(nil), // 70: tfplugin6.GetMetadata.DataSourceMetadata + (*GetMetadata_ResourceMetadata)(nil), // 71: tfplugin6.GetMetadata.ResourceMetadata + (*GetMetadata_ListResourceMetadata)(nil), // 72: tfplugin6.GetMetadata.ListResourceMetadata + (*GetMetadata_StateStoreMetadata)(nil), // 73: tfplugin6.GetMetadata.StateStoreMetadata + (*GetMetadata_ActionMetadata)(nil), // 74: tfplugin6.GetMetadata.ActionMetadata + (*GetProviderSchema_Request)(nil), // 75: tfplugin6.GetProviderSchema.Request + (*GetProviderSchema_Response)(nil), // 76: tfplugin6.GetProviderSchema.Response + nil, // 77: tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry + nil, // 78: tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry + nil, // 79: tfplugin6.GetProviderSchema.Response.FunctionsEntry + nil, // 80: tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry + nil, // 81: tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry + nil, // 82: tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry + nil, // 83: tfplugin6.GetProviderSchema.Response.ActionSchemasEntry + (*ValidateProviderConfig_Request)(nil), // 84: tfplugin6.ValidateProviderConfig.Request + (*ValidateProviderConfig_Response)(nil), // 85: tfplugin6.ValidateProviderConfig.Response + (*UpgradeResourceState_Request)(nil), // 86: tfplugin6.UpgradeResourceState.Request + (*UpgradeResourceState_Response)(nil), // 87: tfplugin6.UpgradeResourceState.Response + (*GetResourceIdentitySchemas_Request)(nil), // 88: tfplugin6.GetResourceIdentitySchemas.Request + (*GetResourceIdentitySchemas_Response)(nil), // 89: tfplugin6.GetResourceIdentitySchemas.Response + nil, // 90: tfplugin6.GetResourceIdentitySchemas.Response.IdentitySchemasEntry + (*UpgradeResourceIdentity_Request)(nil), // 91: tfplugin6.UpgradeResourceIdentity.Request + (*UpgradeResourceIdentity_Response)(nil), // 92: tfplugin6.UpgradeResourceIdentity.Response + (*ValidateResourceConfig_Request)(nil), // 93: tfplugin6.ValidateResourceConfig.Request + (*ValidateResourceConfig_Response)(nil), // 94: tfplugin6.ValidateResourceConfig.Response + (*ValidateDataResourceConfig_Request)(nil), // 95: tfplugin6.ValidateDataResourceConfig.Request + (*ValidateDataResourceConfig_Response)(nil), // 96: tfplugin6.ValidateDataResourceConfig.Response + (*ValidateEphemeralResourceConfig_Request)(nil), // 97: tfplugin6.ValidateEphemeralResourceConfig.Request + (*ValidateEphemeralResourceConfig_Response)(nil), // 98: tfplugin6.ValidateEphemeralResourceConfig.Response + (*ConfigureProvider_Request)(nil), // 99: tfplugin6.ConfigureProvider.Request + (*ConfigureProvider_Response)(nil), // 100: tfplugin6.ConfigureProvider.Response + (*ReadResource_Request)(nil), // 101: tfplugin6.ReadResource.Request + (*ReadResource_Response)(nil), // 102: tfplugin6.ReadResource.Response + (*PlanResourceChange_Request)(nil), // 103: tfplugin6.PlanResourceChange.Request + (*PlanResourceChange_Response)(nil), // 104: tfplugin6.PlanResourceChange.Response + (*ApplyResourceChange_Request)(nil), // 105: tfplugin6.ApplyResourceChange.Request + (*ApplyResourceChange_Response)(nil), // 106: tfplugin6.ApplyResourceChange.Response + (*ImportResourceState_Request)(nil), // 107: tfplugin6.ImportResourceState.Request + (*ImportResourceState_ImportedResource)(nil), // 108: tfplugin6.ImportResourceState.ImportedResource + (*ImportResourceState_Response)(nil), // 109: tfplugin6.ImportResourceState.Response + (*GenerateResourceConfig_Request)(nil), // 110: tfplugin6.GenerateResourceConfig.Request + (*GenerateResourceConfig_Response)(nil), // 111: tfplugin6.GenerateResourceConfig.Response + (*MoveResourceState_Request)(nil), // 112: tfplugin6.MoveResourceState.Request + (*MoveResourceState_Response)(nil), // 113: tfplugin6.MoveResourceState.Response + (*ReadDataSource_Request)(nil), // 114: tfplugin6.ReadDataSource.Request + (*ReadDataSource_Response)(nil), // 115: tfplugin6.ReadDataSource.Response + (*OpenEphemeralResource_Request)(nil), // 116: tfplugin6.OpenEphemeralResource.Request + (*OpenEphemeralResource_Response)(nil), // 117: tfplugin6.OpenEphemeralResource.Response + (*RenewEphemeralResource_Request)(nil), // 118: tfplugin6.RenewEphemeralResource.Request + (*RenewEphemeralResource_Response)(nil), // 119: tfplugin6.RenewEphemeralResource.Response + (*CloseEphemeralResource_Request)(nil), // 120: tfplugin6.CloseEphemeralResource.Request + (*CloseEphemeralResource_Response)(nil), // 121: tfplugin6.CloseEphemeralResource.Response + (*GetFunctions_Request)(nil), // 122: tfplugin6.GetFunctions.Request + (*GetFunctions_Response)(nil), // 123: tfplugin6.GetFunctions.Response + nil, // 124: tfplugin6.GetFunctions.Response.FunctionsEntry + (*CallFunction_Request)(nil), // 125: tfplugin6.CallFunction.Request + (*CallFunction_Response)(nil), // 126: tfplugin6.CallFunction.Response + (*ListResource_Request)(nil), // 127: tfplugin6.ListResource.Request + (*ListResource_Event)(nil), // 128: tfplugin6.ListResource.Event + (*ValidateListResourceConfig_Request)(nil), // 129: tfplugin6.ValidateListResourceConfig.Request + (*ValidateListResourceConfig_Response)(nil), // 130: tfplugin6.ValidateListResourceConfig.Response + (*ValidateStateStore_Request)(nil), // 131: tfplugin6.ValidateStateStore.Request + (*ValidateStateStore_Response)(nil), // 132: tfplugin6.ValidateStateStore.Response + (*ConfigureStateStore_Request)(nil), // 133: tfplugin6.ConfigureStateStore.Request + (*ConfigureStateStore_Response)(nil), // 134: tfplugin6.ConfigureStateStore.Response + (*ReadStateBytes_Request)(nil), // 135: tfplugin6.ReadStateBytes.Request + (*ReadStateBytes_Response)(nil), // 136: tfplugin6.ReadStateBytes.Response + (*WriteStateBytes_RequestChunk)(nil), // 137: tfplugin6.WriteStateBytes.RequestChunk + (*WriteStateBytes_Response)(nil), // 138: tfplugin6.WriteStateBytes.Response + (*GetStates_Request)(nil), // 139: tfplugin6.GetStates.Request + (*GetStates_Response)(nil), // 140: tfplugin6.GetStates.Response + (*DeleteState_Request)(nil), // 141: tfplugin6.DeleteState.Request + (*DeleteState_Response)(nil), // 142: tfplugin6.DeleteState.Response + (*PlanAction_Request)(nil), // 143: tfplugin6.PlanAction.Request + (*PlanAction_Response)(nil), // 144: tfplugin6.PlanAction.Response + (*InvokeAction_Request)(nil), // 145: tfplugin6.InvokeAction.Request + (*InvokeAction_Event)(nil), // 146: tfplugin6.InvokeAction.Event + (*InvokeAction_Event_Progress)(nil), // 147: tfplugin6.InvokeAction.Event.Progress + (*InvokeAction_Event_Completed)(nil), // 148: tfplugin6.InvokeAction.Event.Completed + (*ValidateActionConfig_Request)(nil), // 149: tfplugin6.ValidateActionConfig.Request + (*ValidateActionConfig_Response)(nil), // 150: tfplugin6.ValidateActionConfig.Response + (*timestamppb.Timestamp)(nil), // 151: 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 + 55, // 2: tfplugin6.AttributePath.steps:type_name -> tfplugin6.AttributePath.Step + 58, // 3: tfplugin6.RawState.flatmap:type_name -> tfplugin6.RawState.FlatmapEntry + 59, // 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 + 60, // 7: tfplugin6.Schema.block:type_name -> tfplugin6.Schema.Block + 64, // 8: tfplugin6.Function.parameters:type_name -> tfplugin6.Function.Parameter + 64, // 9: tfplugin6.Function.variadic_parameter:type_name -> tfplugin6.Function.Parameter + 65, // 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 + 61, // 13: tfplugin6.Schema.Block.attributes:type_name -> tfplugin6.Schema.Attribute + 62, // 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 + 63, // 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 + 60, // 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 + 61, // 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 + 70, // 25: tfplugin6.GetMetadata.Response.data_sources:type_name -> tfplugin6.GetMetadata.DataSourceMetadata + 71, // 26: tfplugin6.GetMetadata.Response.resources:type_name -> tfplugin6.GetMetadata.ResourceMetadata + 69, // 27: tfplugin6.GetMetadata.Response.functions:type_name -> tfplugin6.GetMetadata.FunctionMetadata + 68, // 28: tfplugin6.GetMetadata.Response.ephemeral_resources:type_name -> tfplugin6.GetMetadata.EphemeralMetadata + 72, // 29: tfplugin6.GetMetadata.Response.list_resources:type_name -> tfplugin6.GetMetadata.ListResourceMetadata + 73, // 30: tfplugin6.GetMetadata.Response.state_stores:type_name -> tfplugin6.GetMetadata.StateStoreMetadata + 74, // 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 + 77, // 33: tfplugin6.GetProviderSchema.Response.resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ResourceSchemasEntry + 78, // 34: tfplugin6.GetProviderSchema.Response.data_source_schemas:type_name -> tfplugin6.GetProviderSchema.Response.DataSourceSchemasEntry + 79, // 35: tfplugin6.GetProviderSchema.Response.functions:type_name -> tfplugin6.GetProviderSchema.Response.FunctionsEntry + 80, // 36: tfplugin6.GetProviderSchema.Response.ephemeral_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.EphemeralResourceSchemasEntry + 81, // 37: tfplugin6.GetProviderSchema.Response.list_resource_schemas:type_name -> tfplugin6.GetProviderSchema.Response.ListResourceSchemasEntry + 82, // 38: tfplugin6.GetProviderSchema.Response.state_store_schemas:type_name -> tfplugin6.GetProviderSchema.Response.StateStoreSchemasEntry + 83, // 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 +8513,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 + 90, // 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 +8560,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 + 108, // 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 +8580,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 + 151, // 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 + 151, // 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 + 124, // 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 +8603,99 @@ 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 + 49, // 148: tfplugin6.ReadStateBytes.Response.range:type_name -> tfplugin6.StateRange + 6, // 149: tfplugin6.ReadStateBytes.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 49, // 150: tfplugin6.WriteStateBytes.RequestChunk.range:type_name -> tfplugin6.StateRange + 6, // 151: tfplugin6.WriteStateBytes.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 6, // 152: tfplugin6.GetStates.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 6, // 153: tfplugin6.DeleteState.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 5, // 154: tfplugin6.PlanAction.Request.config:type_name -> tfplugin6.DynamicValue + 17, // 155: tfplugin6.PlanAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities + 6, // 156: tfplugin6.PlanAction.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 18, // 157: tfplugin6.PlanAction.Response.deferred:type_name -> tfplugin6.Deferred + 5, // 158: tfplugin6.InvokeAction.Request.config:type_name -> tfplugin6.DynamicValue + 17, // 159: tfplugin6.InvokeAction.Request.client_capabilities:type_name -> tfplugin6.ClientCapabilities + 147, // 160: tfplugin6.InvokeAction.Event.progress:type_name -> tfplugin6.InvokeAction.Event.Progress + 148, // 161: tfplugin6.InvokeAction.Event.completed:type_name -> tfplugin6.InvokeAction.Event.Completed + 6, // 162: tfplugin6.InvokeAction.Event.Completed.diagnostics:type_name -> tfplugin6.Diagnostic + 5, // 163: tfplugin6.ValidateActionConfig.Request.config:type_name -> tfplugin6.DynamicValue + 6, // 164: tfplugin6.ValidateActionConfig.Response.diagnostics:type_name -> tfplugin6.Diagnostic + 66, // 165: tfplugin6.Provider.GetMetadata:input_type -> tfplugin6.GetMetadata.Request + 75, // 166: tfplugin6.Provider.GetProviderSchema:input_type -> tfplugin6.GetProviderSchema.Request + 84, // 167: tfplugin6.Provider.ValidateProviderConfig:input_type -> tfplugin6.ValidateProviderConfig.Request + 93, // 168: tfplugin6.Provider.ValidateResourceConfig:input_type -> tfplugin6.ValidateResourceConfig.Request + 95, // 169: tfplugin6.Provider.ValidateDataResourceConfig:input_type -> tfplugin6.ValidateDataResourceConfig.Request + 86, // 170: tfplugin6.Provider.UpgradeResourceState:input_type -> tfplugin6.UpgradeResourceState.Request + 88, // 171: tfplugin6.Provider.GetResourceIdentitySchemas:input_type -> tfplugin6.GetResourceIdentitySchemas.Request + 91, // 172: tfplugin6.Provider.UpgradeResourceIdentity:input_type -> tfplugin6.UpgradeResourceIdentity.Request + 99, // 173: tfplugin6.Provider.ConfigureProvider:input_type -> tfplugin6.ConfigureProvider.Request + 101, // 174: tfplugin6.Provider.ReadResource:input_type -> tfplugin6.ReadResource.Request + 103, // 175: tfplugin6.Provider.PlanResourceChange:input_type -> tfplugin6.PlanResourceChange.Request + 105, // 176: tfplugin6.Provider.ApplyResourceChange:input_type -> tfplugin6.ApplyResourceChange.Request + 107, // 177: tfplugin6.Provider.ImportResourceState:input_type -> tfplugin6.ImportResourceState.Request + 112, // 178: tfplugin6.Provider.MoveResourceState:input_type -> tfplugin6.MoveResourceState.Request + 114, // 179: tfplugin6.Provider.ReadDataSource:input_type -> tfplugin6.ReadDataSource.Request + 110, // 180: tfplugin6.Provider.GenerateResourceConfig:input_type -> tfplugin6.GenerateResourceConfig.Request + 97, // 181: tfplugin6.Provider.ValidateEphemeralResourceConfig:input_type -> tfplugin6.ValidateEphemeralResourceConfig.Request + 116, // 182: tfplugin6.Provider.OpenEphemeralResource:input_type -> tfplugin6.OpenEphemeralResource.Request + 118, // 183: tfplugin6.Provider.RenewEphemeralResource:input_type -> tfplugin6.RenewEphemeralResource.Request + 120, // 184: tfplugin6.Provider.CloseEphemeralResource:input_type -> tfplugin6.CloseEphemeralResource.Request + 127, // 185: tfplugin6.Provider.ListResource:input_type -> tfplugin6.ListResource.Request + 129, // 186: tfplugin6.Provider.ValidateListResourceConfig:input_type -> tfplugin6.ValidateListResourceConfig.Request + 122, // 187: tfplugin6.Provider.GetFunctions:input_type -> tfplugin6.GetFunctions.Request + 125, // 188: tfplugin6.Provider.CallFunction:input_type -> tfplugin6.CallFunction.Request + 131, // 189: tfplugin6.Provider.ValidateStateStoreConfig:input_type -> tfplugin6.ValidateStateStore.Request + 133, // 190: tfplugin6.Provider.ConfigureStateStore:input_type -> tfplugin6.ConfigureStateStore.Request + 135, // 191: tfplugin6.Provider.ReadStateBytes:input_type -> tfplugin6.ReadStateBytes.Request + 137, // 192: tfplugin6.Provider.WriteStateBytes:input_type -> tfplugin6.WriteStateBytes.RequestChunk + 139, // 193: tfplugin6.Provider.GetStates:input_type -> tfplugin6.GetStates.Request + 141, // 194: tfplugin6.Provider.DeleteState:input_type -> tfplugin6.DeleteState.Request + 143, // 195: tfplugin6.Provider.PlanAction:input_type -> tfplugin6.PlanAction.Request + 145, // 196: tfplugin6.Provider.InvokeAction:input_type -> tfplugin6.InvokeAction.Request + 149, // 197: tfplugin6.Provider.ValidateActionConfig:input_type -> tfplugin6.ValidateActionConfig.Request + 56, // 198: tfplugin6.Provider.StopProvider:input_type -> tfplugin6.StopProvider.Request + 67, // 199: tfplugin6.Provider.GetMetadata:output_type -> tfplugin6.GetMetadata.Response + 76, // 200: tfplugin6.Provider.GetProviderSchema:output_type -> tfplugin6.GetProviderSchema.Response + 85, // 201: tfplugin6.Provider.ValidateProviderConfig:output_type -> tfplugin6.ValidateProviderConfig.Response + 94, // 202: tfplugin6.Provider.ValidateResourceConfig:output_type -> tfplugin6.ValidateResourceConfig.Response + 96, // 203: tfplugin6.Provider.ValidateDataResourceConfig:output_type -> tfplugin6.ValidateDataResourceConfig.Response + 87, // 204: tfplugin6.Provider.UpgradeResourceState:output_type -> tfplugin6.UpgradeResourceState.Response + 89, // 205: tfplugin6.Provider.GetResourceIdentitySchemas:output_type -> tfplugin6.GetResourceIdentitySchemas.Response + 92, // 206: tfplugin6.Provider.UpgradeResourceIdentity:output_type -> tfplugin6.UpgradeResourceIdentity.Response + 100, // 207: tfplugin6.Provider.ConfigureProvider:output_type -> tfplugin6.ConfigureProvider.Response + 102, // 208: tfplugin6.Provider.ReadResource:output_type -> tfplugin6.ReadResource.Response + 104, // 209: tfplugin6.Provider.PlanResourceChange:output_type -> tfplugin6.PlanResourceChange.Response + 106, // 210: tfplugin6.Provider.ApplyResourceChange:output_type -> tfplugin6.ApplyResourceChange.Response + 109, // 211: tfplugin6.Provider.ImportResourceState:output_type -> tfplugin6.ImportResourceState.Response + 113, // 212: tfplugin6.Provider.MoveResourceState:output_type -> tfplugin6.MoveResourceState.Response + 115, // 213: tfplugin6.Provider.ReadDataSource:output_type -> tfplugin6.ReadDataSource.Response + 111, // 214: tfplugin6.Provider.GenerateResourceConfig:output_type -> tfplugin6.GenerateResourceConfig.Response + 98, // 215: tfplugin6.Provider.ValidateEphemeralResourceConfig:output_type -> tfplugin6.ValidateEphemeralResourceConfig.Response + 117, // 216: tfplugin6.Provider.OpenEphemeralResource:output_type -> tfplugin6.OpenEphemeralResource.Response + 119, // 217: tfplugin6.Provider.RenewEphemeralResource:output_type -> tfplugin6.RenewEphemeralResource.Response + 121, // 218: tfplugin6.Provider.CloseEphemeralResource:output_type -> tfplugin6.CloseEphemeralResource.Response + 128, // 219: tfplugin6.Provider.ListResource:output_type -> tfplugin6.ListResource.Event + 130, // 220: tfplugin6.Provider.ValidateListResourceConfig:output_type -> tfplugin6.ValidateListResourceConfig.Response + 123, // 221: tfplugin6.Provider.GetFunctions:output_type -> tfplugin6.GetFunctions.Response + 126, // 222: tfplugin6.Provider.CallFunction:output_type -> tfplugin6.CallFunction.Response + 132, // 223: tfplugin6.Provider.ValidateStateStoreConfig:output_type -> tfplugin6.ValidateStateStore.Response + 134, // 224: tfplugin6.Provider.ConfigureStateStore:output_type -> tfplugin6.ConfigureStateStore.Response + 136, // 225: tfplugin6.Provider.ReadStateBytes:output_type -> tfplugin6.ReadStateBytes.Response + 138, // 226: tfplugin6.Provider.WriteStateBytes:output_type -> tfplugin6.WriteStateBytes.Response + 140, // 227: tfplugin6.Provider.GetStates:output_type -> tfplugin6.GetStates.Response + 142, // 228: tfplugin6.Provider.DeleteState:output_type -> tfplugin6.DeleteState.Response + 144, // 229: tfplugin6.Provider.PlanAction:output_type -> tfplugin6.PlanAction.Response + 146, // 230: tfplugin6.Provider.InvokeAction:output_type -> tfplugin6.InvokeAction.Event + 150, // 231: tfplugin6.Provider.ValidateActionConfig:output_type -> tfplugin6.ValidateActionConfig.Response + 57, // 232: tfplugin6.Provider.StopProvider:output_type -> tfplugin6.StopProvider.Response + 199, // [199:233] is the sub-list for method output_type + 165, // [165:199] is the sub-list for method input_type + 165, // [165:165] is the sub-list for extension type_name + 165, // [165:165] is the sub-list for extension extendee + 0, // [0:165] is the sub-list for field type_name } func init() { file_tfplugin6_proto_init() } @@ -8184,17 +8704,17 @@ func file_tfplugin6_proto_init() { return } file_tfplugin6_proto_msgTypes[2].OneofWrappers = []any{} - file_tfplugin6_proto_msgTypes[45].OneofWrappers = []any{ + file_tfplugin6_proto_msgTypes[50].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[112].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[123].OneofWrappers = []any{} + file_tfplugin6_proto_msgTypes[141].OneofWrappers = []any{ (*InvokeAction_Event_Progress_)(nil), (*InvokeAction_Event_Completed_)(nil), } @@ -8204,7 +8724,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: 146, NumExtensions: 0, NumServices: 1, }, @@ -8275,6 +8795,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 +9076,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 +9170,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 +9266,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 +9364,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 +9864,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 +10153,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,