Frontend uudelleenrakennettu: Astro-komponentit, Wasm pääsäikeessä, ei Workeria
Vanha frontend siirretty temp/. Uusi rakenne: - StatusBar.astro, Terminal.astro, Editor.astro, Guide.astro - global.css erillinen - Wasm pääsäikeessä (ei Worker — yksinkertainen, debugattava) - Tab-completion, dropdown, projektikortti, Monaco, GUIDE.md - Ei tokenisointia eikä koodilaboratoriota Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,213 @@
|
||||
# OpenTofu Plugin Protocol
|
||||
|
||||
This directory contains documentation about the physical wire protocol that
|
||||
OpenTofu Core uses to communicate with provider plugins.
|
||||
|
||||
Most providers are not written directly against this protocol. Instead, prefer
|
||||
to use an SDK that implements this protocol and write the provider against
|
||||
the SDK's API.
|
||||
|
||||
----
|
||||
|
||||
**If you want to write a plugin for OpenTofu, please refer to
|
||||
[Extending OpenTofu](https://github.com/hashicorp/terraform-docs-common) instead.**
|
||||
|
||||
This documentation is for those who are developing _OpenTofu SDKs_, rather
|
||||
than those implementing plugins.
|
||||
|
||||
----
|
||||
|
||||
From OpenTofu v0.12.0 onwards, OpenTofu's plugin protocol is built on
|
||||
[gRPC](https://grpc.io/). This directory contains `.proto` definitions of
|
||||
different versions of OpenTofu's protocol.
|
||||
|
||||
Only `.proto` files published as part of OpenTofu release tags are actually
|
||||
official protocol versions. If you are reading this directory on the `main`
|
||||
branch or any other development branch then it may contain protocol definitions
|
||||
that are not yet finalized and that may change before final release.
|
||||
|
||||
## RPC Plugin Model
|
||||
|
||||
OpenTofu plugins are normal executable programs that, when launched, expose
|
||||
gRPC services on a server accessed via the loopback interface. OpenTofu Core
|
||||
discovers and launches plugins, waits for a handshake to be printed on the
|
||||
plugin's `stdout`, and then connects to the indicated port number as a
|
||||
gRPC client.
|
||||
|
||||
For this reason, we commonly refer to OpenTofu Core itself as the plugin
|
||||
"client" and the plugin program itself as the plugin "server". Both of these
|
||||
processes run locally, with the server process appearing as a child process
|
||||
of the client. OpenTofu Core controls the lifecycle of these server processes
|
||||
and will terminate them when they are no longer required.
|
||||
|
||||
The startup and handshake protocol is not currently documented. We hope to
|
||||
document it here or to link to external documentation on it in future.
|
||||
|
||||
## Versioning Strategy
|
||||
|
||||
The Plugin Protocol uses a versioning strategy that aims to allow gradual
|
||||
enhancements to the protocol while retaining compatibility, but also to allow
|
||||
more significant breaking changes from time to time while allowing old and
|
||||
new plugins to be used together for some period.
|
||||
|
||||
The versioning strategy described below was introduced with protocol version
|
||||
5.0 in OpenTofu v0.12. Prior versions of OpenTofu and prior protocol versions
|
||||
do not follow this strategy.
|
||||
|
||||
The authoritative definition for each protocol version is in this directory
|
||||
as a Protocol Buffers (protobuf) service definition. The files follow the
|
||||
naming pattern `tfpluginX.Y.proto`, where X is the major version and Y
|
||||
is the minor version.
|
||||
|
||||
### Major and minor versioning
|
||||
|
||||
The minor version increases for each change introducing optional new
|
||||
functionality that can be ignored by implementations of prior versions. For
|
||||
example, if a new field were added to an response message, it could be a minor
|
||||
release as long as OpenTofu Core can provide some default behavior when that
|
||||
field is not populated.
|
||||
|
||||
The major version increases for any significant change to the protocol where
|
||||
compatibility is broken. However, OpenTofu Core and an SDK may both choose
|
||||
to support multiple major versions at once: the plugin handshake includes a
|
||||
negotiation step where client and server can work together to select a
|
||||
mutually-supported major version.
|
||||
|
||||
The major version number is encoded into the protobuf package name: major
|
||||
version 5 uses the package name `tfplugin5`, and one day major version 6
|
||||
will switch to `tfplugin6`. This change of name allows a plugin server to
|
||||
implement multiple major versions at once, by exporting multiple gRPC services.
|
||||
Minor version differences rely instead on feature-detection mechanisms, so they
|
||||
are not represented directly on the wire and exist primarily as a human
|
||||
communication tool to help us easily talk about which software supports which
|
||||
features.
|
||||
|
||||
## Version compatibility for Core, SDK, and Providers
|
||||
|
||||
A particular version of OpenTofu Core has both a minimum minor version it
|
||||
requires and a maximum major version that it supports. A particular version of
|
||||
OpenTofu Core may also be able to optionally use a newer minor version when
|
||||
available, but fall back on older behavior when that functionality is not
|
||||
available.
|
||||
|
||||
Likewise, each provider plugin release is compatible with a set of versions.
|
||||
The compatible versions for a provider are a list of major and minor version
|
||||
pairs, such as "4.0", "5.2", which indicates that the provider supports the
|
||||
baseline features of major version 4 and supports major version 5 including
|
||||
the enhancements from both minor versions 1 and 2. This provider would
|
||||
therefore be compatible with a OpenTofu Core release that supports only
|
||||
protocol version 5.0, since major version 5 is supported and the optional
|
||||
5.1 and 5.2 enhancements will be ignored.
|
||||
|
||||
If OpenTofu Core and the plugin do not have at least one mutually-supported
|
||||
major version, OpenTofu Core will return an error from `tofu init`
|
||||
during plugin installation:
|
||||
|
||||
```
|
||||
Provider "aws" v1.0.0 is not compatible with OpenTofu v0.12.0.
|
||||
|
||||
Provider version v2.0.0 is the earliest compatible version.
|
||||
Select it with the following version constraint:
|
||||
|
||||
version = "~> 2.0.0"
|
||||
```
|
||||
|
||||
```
|
||||
Provider "aws" v3.0.0 is not compatible with OpenTofu v0.12.0.
|
||||
Provider version v2.34.0 is the latest compatible version. Select
|
||||
it with the following constraint:
|
||||
|
||||
version = "~> 2.34.0"
|
||||
|
||||
Alternatively, upgrade to the latest version of OpenTofu for compatibility with newer provider releases.
|
||||
```
|
||||
|
||||
The above messages are for plugins installed via `tofu init` from a
|
||||
OpenTofu registry, where the registry API allows OpenTofu Core to recognize
|
||||
the protocol compatibility for each provider release. For plugins that are
|
||||
installed manually to a local plugin directory, OpenTofu Core has no way to
|
||||
suggest specific versions to upgrade or downgrade to, and so the error message
|
||||
is more generic:
|
||||
|
||||
```
|
||||
The installed version of provider "example" is not compatible with OpenTofu v0.12.0.
|
||||
|
||||
This provider was loaded from:
|
||||
/usr/local/bin/terraform-provider-example_v0.1.0
|
||||
```
|
||||
|
||||
## Adding/removing major version support in SDK and Providers
|
||||
|
||||
The set of supported major versions is decided by the SDK used by the plugin.
|
||||
Over time, SDKs will add support for new major versions and phase out support
|
||||
for older major versions.
|
||||
|
||||
In doing so, the SDK developer passes those capabilities and constraints on to
|
||||
any provider using their SDK, and that will in turn affect the compatibility
|
||||
of the plugin in ways that affect its semver-based version numbering:
|
||||
|
||||
- If an SDK upgrade adds support for a new provider protocol, that will usually
|
||||
be considered a new feature and thus warrant a new minor version.
|
||||
- If an SDK upgrade removes support for an old provider protocol, that is
|
||||
always a breaking change and thus requires a major release of the provider.
|
||||
|
||||
For this reason, SDK developers must be clear in their release notes about
|
||||
the addition and removal of support for major versions.
|
||||
|
||||
OpenTofu Core also makes an assumption about major version support when
|
||||
it produces actionable error messages for users about incompatibilities:
|
||||
a particular protocol major version is supported for a single consecutive
|
||||
range of provider releases, with no "gaps".
|
||||
|
||||
## Using the protobuf specifications in an SDK
|
||||
|
||||
If you wish to build an SDK for OpenTofu plugins, an early step will be to
|
||||
copy one or more `.proto` files from this directory into your own repository
|
||||
(depending on which protocol versions you intend to support) and use the
|
||||
`protoc` protocol buffers compiler (with gRPC extensions) to generate suitable
|
||||
RPC stubs and types for your target language.
|
||||
|
||||
For example, if you happen to be targeting Python, you might generate the
|
||||
stubs using a command like this:
|
||||
|
||||
```
|
||||
protoc --python_out=. --grpc_python_out=. tfplugin5.1.proto
|
||||
```
|
||||
|
||||
You can find out more about the tool usage for each target language in
|
||||
[the gRPC Quick Start guides](https://grpc.io/docs/quickstart/).
|
||||
|
||||
The protobuf specification for a version is immutable after it has been
|
||||
included in at least one OpenTofu release. Any changes will be documented in
|
||||
a new `.proto` file establishing a new protocol version.
|
||||
|
||||
The protocol buffer compiler will produce some sort of library object appropriate
|
||||
for the target language, which depending on the language might be called a
|
||||
module, or a package, or something else. We recommend to include the protocol
|
||||
major version in your module or package name so that you can potentially
|
||||
support multiple versions concurrently in future. For example, if you are
|
||||
targeting major version 5 you might call your package or module `tfplugin5`.
|
||||
|
||||
To upgrade to a newer minor protocol version, copy the new `.proto` file
|
||||
from this directory into the same location as your previous version, delete
|
||||
the previous version, and then run the protocol buffers compiler again
|
||||
against the new `.proto` file. Because minor releases are backward-compatible,
|
||||
you can simply update your previous stubs in-place rather than creating a
|
||||
new set alongside.
|
||||
|
||||
To support a new _major_ protocol version, create a new package or module
|
||||
and copy the relevant `.proto` file into it, creating a separate set of stubs
|
||||
that can in principle allow your SDK to support both major versions at the
|
||||
same time. We recommend supporting both the previous and current major versions
|
||||
together for a while across a major version upgrade so that users can avoid
|
||||
having to upgrade both OpenTofu Core and all of their providers at the same
|
||||
time, but you can delete the previous major version stubs once you remove
|
||||
support for that version.
|
||||
|
||||
**Note:** Some of the `.proto` files contain statements about being updated
|
||||
in-place for minor versions. This reflects an earlier version management
|
||||
strategy which is no longer followed. The current process is to create a
|
||||
new file in this directory for each new minor version and consider all
|
||||
previously-tagged definitions as immutable. The outdated comments in those
|
||||
files are retained in order to keep the promise of immutability, even though
|
||||
it is now incorrect.
|
||||
@@ -0,0 +1,267 @@
|
||||
# Wire Format for OpenTofu Objects and Associated Values
|
||||
|
||||
The provider wire protocol (as of major version 5) includes a protobuf message
|
||||
type `DynamicValue` which OpenTofu uses to represent values from the OpenTofu
|
||||
Language type system, which result from evaluating the content of `resource`,
|
||||
`data`, and `provider` blocks, based on a schema defined by the corresponding
|
||||
provider.
|
||||
|
||||
Because the structure of these values is determined at runtime, `DynamicValue`
|
||||
uses one of two possible dynamic serialization formats for the values
|
||||
themselves: MessagePack or JSON. OpenTofu most commonly uses MessagePack,
|
||||
because it offers a compact binary representation of a value. However, a server
|
||||
implementation of the provider protocol should fall back to JSON if the
|
||||
MessagePack field is not populated, in order to support both formats.
|
||||
|
||||
The remainder of this document describes how OpenTofu translates from its own
|
||||
type system into the type system of the two supported serialization formats.
|
||||
A server implementation of the OpenTofu provider protocol can use this
|
||||
information to decode `DynamicValue` values from incoming messages into
|
||||
whatever representation is convenient for the provider implementation.
|
||||
|
||||
A server implementation must also be able to _produce_ `DynamicValue` messages
|
||||
as part of various response messages. When doing so, servers should always
|
||||
use MessagePack encoding, because OpenTofu does not consistently support
|
||||
JSON responses across all request types and all OpenTofu versions.
|
||||
|
||||
Both the MessagePack and JSON serializations are driven by information the
|
||||
provider previously returned in a `Schema` message. OpenTofu will encode each
|
||||
value depending on the type constraint given for it in the corresponding schema,
|
||||
using the closest possible MessagePack or JSON type to the OpenTofu language
|
||||
type. Therefore a server implementation can decode a serialized value using a
|
||||
standard MessagePack or JSON library and assume it will conform to the
|
||||
serialization rules described below.
|
||||
|
||||
## MessagePack Serialization Rules
|
||||
|
||||
The MessagePack types referenced in this section are those defined in
|
||||
[The MessagePack type system specification](https://github.com/msgpack/msgpack/blob/master/spec.md#type-system).
|
||||
|
||||
Note that MessagePack defines several possible serialization formats for each
|
||||
type, and OpenTofu may choose any of the formats of a specified type.
|
||||
The exact serialization chosen for a given value may vary between OpenTofu
|
||||
versions, but the types given here are contractual.
|
||||
|
||||
Conversely, server implementations that are _producing_ MessagePack-encoded
|
||||
values are free to use any of the valid serialization formats for a particular
|
||||
type. However, we recommend choosing the most compact format that can represent
|
||||
the value without a loss of range.
|
||||
|
||||
### `Schema.Block` Mapping Rules for MessagePack
|
||||
|
||||
To represent the content of a block as MessagePack, OpenTofu constructs a
|
||||
MessagePack map that contains one key-value pair per attribute and one
|
||||
key-value pair per distinct nested block described in the `Schema.Block` message.
|
||||
|
||||
The key-value pairs representing attributes have values based on
|
||||
[the `Schema.Attribute` mapping rules](#Schema.Attribute-mapping-rules-for-messagepack).
|
||||
The key-value pairs representing nested block types have values based on
|
||||
[the `Schema.NestedBlock` mapping rules](#Schema.NestedBlock-mapping-rules-for-messagepack).
|
||||
|
||||
### `Schema.Attribute` Mapping Rules for MessagePack
|
||||
|
||||
The MessagePack serialization of an attribute value depends on the value of the
|
||||
`type` field of the corresponding `Schema.Attribute` message. The `type` field is
|
||||
a compact JSON serialization of a
|
||||
[OpenTofu type constraint](https://opentofu.org/docs/language/expressions/type-constraints/),
|
||||
which consists either of a single
|
||||
string value (for primitive types) or a two-element array giving a type kind
|
||||
and a type argument.
|
||||
|
||||
The following table describes the type-specific mapping rules. Along with those
|
||||
type-specific rules there are two special rules that override the mappings
|
||||
in the table below, regardless of type:
|
||||
|
||||
* A null value is represented as a MessagePack nil value.
|
||||
* An unknown value (that is, a placeholder for a value that will be decided
|
||||
only during the apply operation) is represented as a
|
||||
[MessagePack extension](https://github.com/msgpack/msgpack/blob/master/spec.md#extension-types)
|
||||
value, described in more detail below.
|
||||
|
||||
| `type` Pattern | MessagePack Representation |
|
||||
|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `"string"` | A MessagePack string containing the Unicode characters from the string value serialized as normalized UTF-8. |
|
||||
| `"number"` | Either MessagePack integer, MessagePack float, or MessagePack string representing the number. If a number is represented as a string then the string contains a decimal representation of the number which may have a larger mantissa than can be represented by a 64-bit float. |
|
||||
| `"bool"` | A MessagePack boolean value corresponding to the value. |
|
||||
| `["list",T]` | A MessagePack array with the same number of elements as the list value, each of which is represented by the result of applying these same mapping rules to the nested type `T`. |
|
||||
| `["set",T]` | Identical in representation to `["list",T]`, but the order of elements is undefined because OpenTofu sets are unordered. |
|
||||
| `["map",T]` | A MessagePack map with one key-value pair per element of the map value, where the element key is serialized as the map key (always a MessagePack string) and the element value is represented by a value constructed by applying these same mapping rules to the nested type `T`. |
|
||||
| `["object",ATTRS]` | A MessagePack map with one key-value pair per attribute defined in the `ATTRS` object. The attribute name is serialized as the map key (always a MessagePack string) and the attribute value is represented by a value constructed by applying these same mapping rules to each attribute's own type. |
|
||||
| `["tuple",TYPES]` | A MessagePack array with one element per element described by the `TYPES` array. The element values are constructed by applying these same mapping rules to the corresponding element of `TYPES`. |
|
||||
| `"dynamic"` | A MessagePack array with exactly two elements. The first element is a MessagePack binary value containing a JSON-serialized type constraint in the same format described in this table. The second element is the result of applying these same mapping rules to the value with the type given in the first element. This special type constraint represents values whose types will be decided only at runtime. |
|
||||
|
||||
Unknown values have two possible representations, both using
|
||||
[MessagePack extension](https://github.com/msgpack/msgpack/blob/master/spec.md#extension-types)
|
||||
values.
|
||||
|
||||
The older encoding is for unrefined unknown values and uses an extension
|
||||
code of zero, with the extension value payload completely ignored.
|
||||
|
||||
Newer OpenTofu versions can produce "refined" unknown values which carry some
|
||||
additional information that constrains the possible range of the final value/
|
||||
Refined unknown values have extension code 12 and then the extension object's
|
||||
payload is a MessagePack-encoded map using integer keys to represent different
|
||||
kinds of refinement:
|
||||
|
||||
* `1` represents "nullness", and the value of that key will be a boolean
|
||||
value that is true if the value is definitely null or false if it is
|
||||
definitely not null. If this key isn't present at all then the value may or
|
||||
may not be null. It's not actually useful to encode that an unknown value
|
||||
is null; use a known null value instead in that case, because there is only
|
||||
one null value of each type.
|
||||
* `2` represents string prefix, and the value is a string that the final
|
||||
value is known to begin with. This is valid only for unknown values of string
|
||||
type.
|
||||
* `3` and `4` represent the lower and upper bounds respectively of a number
|
||||
value, and the value of both is a two-element msgpack array whose
|
||||
first element is a valid encoding of a number (as in the table above)
|
||||
and whose second element is a boolean value that is true for an inclusive
|
||||
bound and false for an exclusive bound. This is valid only for unknown values
|
||||
of number type.
|
||||
* `5` and `6` represent the lower and upper bounds respectively of the length
|
||||
of a collection value. The value of both is an integer representing an
|
||||
inclusive bound. This is valid only for unknown values of the three kinds of
|
||||
collection types: list, set, and map.
|
||||
|
||||
Unknown value refinements are an optional way to reduce the range of possible
|
||||
values for situations where that makes it possible to produce a known result
|
||||
for unknown inputs or where it allows detecting an error during the planning
|
||||
phase that would otherwise be detected only during the apply phase. It's always
|
||||
safe to ignore refinements and just treat an unknown value as wholly unknown,
|
||||
but considering refinements may allow a more precise answer. A provider that
|
||||
produces refined values in its planned new state (from `PlanResourceChange`)
|
||||
_must_ honor those refinements in the final state (from `ApplyResourceChange`).
|
||||
|
||||
Unmarshalling code should ignore refinement map keys that they don't know about,
|
||||
because future versions of the protocol might define additional refinements.
|
||||
|
||||
When encoding an unknown value without any refinements, always use the older
|
||||
format with extension code zero instead of using extension code 12 with an
|
||||
empty refinement map. Any refined unknown value _must_ have at least one
|
||||
refinement map entry. This rule ensures backward compatibility with older
|
||||
implementations that predate the value refinements concept.
|
||||
|
||||
A server implementation of the protocol should treat _any_ MessagePack extension
|
||||
code as representing an unknown value, but should ignore the payload of that
|
||||
extension value entirely unless the extension code is 12 to indicate that
|
||||
the body represents refinements. Future versions of this protocol may define
|
||||
specific formats for other extension codes, but they will always represent
|
||||
unknown values.
|
||||
|
||||
### `Schema.NestedBlock` Mapping Rules for MessagePack
|
||||
|
||||
The MessagePack serialization of a collection of blocks of a particular type
|
||||
depends on the `nesting` field of the corresponding `Schema.NestedBlock` message.
|
||||
The `nesting` field is a value from the `Schema.NestingBlock.NestingMode`
|
||||
enumeration.
|
||||
|
||||
All `nesting` values cause the individual blocks of a type to be represented
|
||||
by applying
|
||||
[the `Schema.Block` mapping rules](#Schema.Block-mapping-rules-for-messagepack)
|
||||
to the block's contents based on the `block` field, producing what we'll call
|
||||
a _block value_ in the table below.
|
||||
|
||||
The `nesting` value then in turn defines how OpenTofu will collect all of the
|
||||
individual block values together to produce a single property value representing
|
||||
the nested block type. For all `nesting` values other than `MAP`, blocks may
|
||||
not have any labels. For the `nesting` value `MAP`, blocks must have exactly
|
||||
one label, which is a string we'll call a _block label_ in the table below.
|
||||
|
||||
| `nesting` Value | MessagePack Representation |
|
||||
|---|---|
|
||||
| `SINGLE` | The block value of the single block of this type, or nil if there is no block of that type. |
|
||||
| `LIST` | A MessagePack array of all of the block values, preserving the order of definition of the blocks in the configuration. |
|
||||
| `SET` | A MessagePack array of all of the block values in no particular order. |
|
||||
| `MAP` | A MessagePack map with one key-value pair per block value, where the key is the block label and the value is the block value. |
|
||||
| `GROUP` | The same as with `SINGLE`, except that if there is no block of that type OpenTofu will synthesize a block value by pretending that all of the declared attributes are null and that there are zero blocks of each declared block type. |
|
||||
|
||||
For the `LIST` and `SET` nesting modes, OpenTofu guarantees that the
|
||||
MessagePack array will have a number of elements between the `min_items` and
|
||||
`max_items` values given in the schema, _unless_ any of the block values contain
|
||||
nested unknown values. When unknown values are present, OpenTofu considers
|
||||
the value to be potentially incomplete and so OpenTofu defers validation of
|
||||
the number of blocks. For example, if the configuration includes a `dynamic`
|
||||
block whose `for_each` argument is unknown then the final number of blocks is
|
||||
not predictable until the apply phase.
|
||||
|
||||
## JSON Serialization Rules
|
||||
|
||||
The JSON serialization is a secondary representation for `DynamicValue`, with
|
||||
MessagePack preferred due to its ability to represent unknown values via an
|
||||
extension.
|
||||
|
||||
The JSON encoding described in this section is also used for the `json` field
|
||||
of the `RawValue` message that forms part of an `UpgradeResourceState` request.
|
||||
However, in that case the data is serialized per the schema of the provider
|
||||
version that created it, which won't necessarily match the schema of the
|
||||
_current_ version of that provider.
|
||||
|
||||
### `Schema.Block` Mapping Rules for JSON
|
||||
|
||||
To represent the content of a block as JSON, OpenTofu constructs a
|
||||
JSON object that contains one property per attribute and one property per
|
||||
distinct nested block described in the `Schema.Block` message.
|
||||
|
||||
The properties representing attributes have property values based on
|
||||
[the `Schema.Attribute` mapping rules](#Schema.Attribute-mapping-rules-for-json).
|
||||
The properties representing nested block types have property values based on
|
||||
[the `Schema.NestedBlock` mapping rules](#Schema.NestedBlock-mapping-rules-for-json).
|
||||
|
||||
### `Schema.Attribute` Mapping Rules for JSON
|
||||
|
||||
The JSON serialization of an attribute value depends on the value of the `type`
|
||||
field of the corresponding `Schema.Attribute` message. The `type` field is
|
||||
a compact JSON serialization of a
|
||||
[OpenTofu type constraint](https://opentofu.org/docs/language/expressions/type-constraints/),
|
||||
which consists either of a single
|
||||
string value (for primitive types) or a two-element array giving a type kind
|
||||
and a type argument.
|
||||
|
||||
The following table describes the type-specific mapping rules. Along with those
|
||||
type-specific rules there is one special rule that overrides the rules in the
|
||||
table regardless of type:
|
||||
|
||||
* A null value is always represented as JSON `null`.
|
||||
|
||||
| `type` Pattern | JSON Representation |
|
||||
|---|---|
|
||||
| `"string"` | A JSON string containing the Unicode characters from the string value. |
|
||||
| `"number"` | A JSON number representing the number value. OpenTofu numbers are arbitrary-precision floating point, so the value may have a larger mantissa than can be represented by a 64-bit float. |
|
||||
| `"bool"` | Either JSON `true` or JSON `false`, depending on the boolean value. |
|
||||
| `["list",T]` | A JSON array with the same number of elements as the list value, each of which is represented by the result of applying these same mapping rules to the nested type `T`. |
|
||||
| `["set",T]` | Identical in representation to `["list",T]`, but the order of elements is undefined because OpenTofu sets are unordered. |
|
||||
| `["map",T]` | A JSON object with one property per element of the map value, where the element key is serialized as the property name string and the element value is represented by a property value constructed by applying these same mapping rules to the nested type `T`. |
|
||||
| `["object",ATTRS]` | A JSON object with one property per attribute defined in the `ATTRS` object. The attribute name is serialized as the property name string and the attribute value is represented by a property value constructed by applying these same mapping rules to each attribute's own type. |
|
||||
| `["tuple",TYPES]` | A JSON array with one element per element described by the `TYPES` array. The element values are constructed by applying these same mapping rules to the corresponding element of `TYPES`. |
|
||||
| `"dynamic"` | A JSON object with two properties: `"type"` specifying one of the `type` patterns described in this table in-band, giving the exact runtime type of the value, and `"value"` specifying the result of applying these same mapping rules to the table for the specified runtime type. This special type constraint represents values whose types will be decided only at runtime. |
|
||||
|
||||
### `Schema.NestedBlock` Mapping Rules for JSON
|
||||
|
||||
The JSON serialization of a collection of blocks of a particular type depends
|
||||
on the `nesting` field of the corresponding `Schema.NestedBlock` message.
|
||||
The `nesting` field is a value from the `Schema.NestingBlock.NestingMode`
|
||||
enumeration.
|
||||
|
||||
All `nesting` values cause the individual blocks of a type to be represented
|
||||
by applying
|
||||
[the `Schema.Block` mapping rules](#Schema.Block-mapping-rules-for-json)
|
||||
to the block's contents based on the `block` field, producing what we'll call
|
||||
a _block value_ in the table below.
|
||||
|
||||
The `nesting` value then in turn defines how OpenTofu will collect all of the
|
||||
individual block values together to produce a single property value representing
|
||||
the nested block type. For all `nesting` values other than `MAP`, blocks may
|
||||
not have any labels. For the `nesting` value `MAP`, blocks must have exactly
|
||||
one label, which is a string we'll call a _block label_ in the table below.
|
||||
|
||||
| `nesting` Value | JSON Representation |
|
||||
|---|---|
|
||||
| `SINGLE` | The block value of the single block of this type, or `null` if there is no block of that type. |
|
||||
| `LIST` | A JSON array of all of the block values, preserving the order of definition of the blocks in the configuration. |
|
||||
| `SET` | A JSON array of all of the block values in no particular order. |
|
||||
| `MAP` | A JSON object with one property per block value, where the property name is the block label and the value is the block value. |
|
||||
| `GROUP` | The same as with `SINGLE`, except that if there is no block of that type OpenTofu will synthesize a block value by pretending that all of the declared attributes are null and that there are zero blocks of each declared block type. |
|
||||
|
||||
For the `LIST` and `SET` nesting modes, OpenTofu guarantees that the JSON
|
||||
array will have a number of elements between the `min_items` and `max_items`
|
||||
values given in the schema.
|
||||
@@ -0,0 +1,53 @@
|
||||
# Releasing a New Version of the Protocol
|
||||
|
||||
OpenTofu's plugin protocol is the contract between OpenTofu's plugins and
|
||||
OpenTofu, and as such releasing a new version requires some coordination
|
||||
between those pieces. This document is intended to be a checklist to consult
|
||||
when adding a new major version of the protocol (X in X.Y) to ensure that
|
||||
everything that needs to be is aware of it.
|
||||
|
||||
## New Protobuf File
|
||||
|
||||
The protocol is defined in protobuf files that live in the opentofu/opentofu
|
||||
repository. Adding a new version of the protocol involves creating a new
|
||||
`.proto` file in that directory. It is recommended that you copy the latest
|
||||
protocol file, and modify it accordingly.
|
||||
|
||||
## New terraform-plugin-go Package
|
||||
|
||||
The
|
||||
[hashicorp/terraform-plugin-go](https://github.com/hashicorp/terraform-plugin-go)
|
||||
repository serves as the foundation for OpenTofu's plugin ecosystem. It needs
|
||||
to know about the new major protocol version. Either open an issue in that repo
|
||||
to have the Plugin SDK team add the new package, or if you would like to
|
||||
contribute it yourself, open a PR. It is recommended that you copy the package
|
||||
for the latest protocol version and modify it accordingly.
|
||||
|
||||
## Update the Registry's List of Allowed Versions
|
||||
|
||||
The OpenTofu Registry validates the protocol versions a provider advertises
|
||||
support for when ingesting providers. Providers will not be able to advertise
|
||||
support for the new protocol version until it is added to that list.
|
||||
|
||||
## Update OpenTofu's Version Constraints
|
||||
|
||||
OpenTofu only downloads providers that speak protocol versions it is
|
||||
compatible with from the Registry during `tofu init`. When adding support
|
||||
for a new protocol, you need to tell OpenTofu it knows that protocol version.
|
||||
Modify the `SupportedPluginProtocols` variable in opentofu/opentofu's
|
||||
`internal/getproviders/registry_client.go` file to include the new protocol.
|
||||
|
||||
## Test Running a Provider With the Test Framework
|
||||
|
||||
Use the provider test framework to test a provider written with the new
|
||||
protocol. This end-to-end test ensures that providers written with the new
|
||||
protocol work correctly with the test framework, especially in communicating
|
||||
the protocol version between the test framework and OpenTofu.
|
||||
|
||||
## Test Retrieving and Running a Provider From the Registry
|
||||
|
||||
Publish a provider, either to the public registry or to the staging registry,
|
||||
and test running `tofu init` and `tofu apply`, along with exercising
|
||||
any of the new functionality the protocol version introduces. This end-to-end
|
||||
test ensures that all the pieces needing to be updated before practitioners can
|
||||
use providers built with the new protocol have been updated.
|
||||
@@ -0,0 +1,358 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.0
|
||||
//
|
||||
// This file defines version 5.0 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will be updated in-place in the source Terraform repository for
|
||||
// any minor versions of protocol 5, but later minor versions will always be
|
||||
// backwards compatible. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.1
|
||||
//
|
||||
// This file defines version 5.1 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will be updated in-place in the source Terraform repository for
|
||||
// any minor versions of protocol 5, but later minor versions will always be
|
||||
// backwards compatible. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,953 @@
|
||||
// Copyright IBM Corp. 2014, 2026
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.10
|
||||
//
|
||||
// This file defines version 5.10 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// Any minor versions of protocol 5 to follow should modify this file while
|
||||
// maintaining backwards compatibility. Breaking changes, if any are required,
|
||||
// will come in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// ResourceIdentitySchema represents the structure and types of data used to identify
|
||||
// a managed resource type. Effectively, resource identity is a versioned object
|
||||
// that can be used to compare resources, whether already managed and/or being
|
||||
// discovered.
|
||||
message ResourceIdentitySchema {
|
||||
// IdentityAttribute represents one value of data within resource identity. These
|
||||
// are always used in resource identity comparisons.
|
||||
message IdentityAttribute {
|
||||
// name is the identity attribute name
|
||||
string name = 1;
|
||||
|
||||
// type is the identity attribute type
|
||||
bytes type = 2;
|
||||
|
||||
// required_for_import when enabled signifies that this attribute must be
|
||||
// defined for ImportResourceState to complete successfully
|
||||
bool required_for_import = 3;
|
||||
|
||||
// optional_for_import when enabled signifies that this attribute is not
|
||||
// required for ImportResourceState, because it can be supplied by the
|
||||
// provider. It is still possible to supply this attribute during import.
|
||||
bool optional_for_import = 4;
|
||||
|
||||
// description is a human-readable description of the attribute in Markdown
|
||||
string description = 5;
|
||||
}
|
||||
|
||||
// version is the identity version and separate from the Schema version.
|
||||
// Any time the structure or format of identity_attributes changes, this version
|
||||
// should be incremented. Versioning implicitly starts at 0 and by convention
|
||||
// should be incremented by 1 each change.
|
||||
//
|
||||
// When comparing identity_attributes data, differing versions should always be treated
|
||||
// as inequal.
|
||||
int64 version = 1;
|
||||
|
||||
// identity_attributes are the individual value definitions which define identity data
|
||||
// for a managed resource type. This information is used to decode DynamicValue of
|
||||
// identity data.
|
||||
//
|
||||
// These attributes are intended for permanent identity data and must be wholly
|
||||
// representative of all data necessary to compare two managed resource instances
|
||||
// with no other data. This generally should include account, endpoint, location,
|
||||
// and automatically generated identifiers. For some resources, this may include
|
||||
// configuration-based data, such as a required name which must be unique.
|
||||
repeated IdentityAttribute identity_attributes = 2;
|
||||
}
|
||||
|
||||
message ResourceIdentityData {
|
||||
// identity_data is the resource identity data for the given definition. It should
|
||||
// be decoded using the identity schema.
|
||||
//
|
||||
// This data is considered permanent for the identity version and suitable for
|
||||
// longer-term storage.
|
||||
DynamicValue identity_data = 1;
|
||||
}
|
||||
|
||||
// ActionSchema defines the schema for an action that can be invoked by Terraform.
|
||||
message ActionSchema {
|
||||
Schema schema = 1; // of the action itself
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
string deprecation_message = 7;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
bool write_only = 10;
|
||||
string deprecation_message = 11;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// Return is the function return parameter.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
|
||||
// The generate_resource_config capability signals that a provider supports
|
||||
// GenerateResourceConfig.
|
||||
bool generate_resource_config = 4;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
|
||||
// The write_only_attributes_allowed capability signals that the client
|
||||
// is able to handle write_only attributes for managed resources.
|
||||
bool write_only_attributes_allowed = 2;
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive.
|
||||
// This method is CURRENTLY UNUSED and it serves mostly for convenience
|
||||
// of code generation inside of terraform-plugin-mux.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
// GetResourceIdentitySchemas returns the identity schemas for all managed
|
||||
// resources.
|
||||
rpc GetResourceIdentitySchemas(GetResourceIdentitySchemas.Request) returns (GetResourceIdentitySchemas.Response);
|
||||
// UpgradeResourceIdentityData should return the upgraded resource identity
|
||||
// data for a managed resource type.
|
||||
rpc UpgradeResourceIdentity(UpgradeResourceIdentity.Request) returns (UpgradeResourceIdentity.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
rpc GenerateResourceConfig(GenerateResourceConfig.Request) returns (GenerateResourceConfig.Response);
|
||||
|
||||
//////// Ephemeral Resource Lifecycle
|
||||
rpc ValidateEphemeralResourceConfig(ValidateEphemeralResourceConfig.Request) returns (ValidateEphemeralResourceConfig.Response);
|
||||
rpc OpenEphemeralResource(OpenEphemeralResource.Request) returns (OpenEphemeralResource.Response);
|
||||
rpc RenewEphemeralResource(RenewEphemeralResource.Request) returns (RenewEphemeralResource.Response);
|
||||
rpc CloseEphemeralResource(CloseEphemeralResource.Request) returns (CloseEphemeralResource.Response);
|
||||
|
||||
/////// List
|
||||
rpc ListResource(ListResource.Request) returns (stream ListResource.Event);
|
||||
rpc ValidateListResourceConfig(ValidateListResourceConfig.Request) returns (ValidateListResourceConfig.Response);
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
//////// Provider-contributed Functions
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Actions
|
||||
rpc PlanAction(PlanAction.Request) returns (PlanAction.Response);
|
||||
rpc InvokeAction(InvokeAction.Request) returns (stream InvokeAction.Event);
|
||||
rpc ValidateActionConfig(ValidateActionConfig.Request) returns (ValidateActionConfig.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
repeated EphemeralMetadata ephemeral_resources = 6;
|
||||
repeated ListResourceMetadata list_resources = 7;
|
||||
repeated ActionMetadata actions = 8;
|
||||
}
|
||||
|
||||
message EphemeralMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ListResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ActionMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
map<string, Function> functions = 7;
|
||||
map<string, Schema> ephemeral_resource_schemas = 8;
|
||||
map<string, Schema> list_resource_schemas = 9;
|
||||
reserved 10; // Field number 10 is used by state stores in version 6
|
||||
map<string, ActionSchema> action_schemas = 11;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetResourceIdentitySchemas {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
// identity_schemas is a mapping of resource type names to their identity schemas.
|
||||
map<string, ResourceIdentitySchema> identity_schemas = 1;
|
||||
|
||||
// diagnostics is the collection of warning and error diagnostics for this request.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceIdentity {
|
||||
message Request {
|
||||
// type_name is the managed resource type name
|
||||
string type_name = 1;
|
||||
|
||||
// version is the version of the resource identity data to upgrade
|
||||
int64 version = 2;
|
||||
|
||||
// raw_identity is the raw identity as stored for the resource. Core does
|
||||
// not have access to the identity schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_identity will be json encoded.
|
||||
RawState raw_identity = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// upgraded_identity returns the upgraded resource identity data
|
||||
ResourceIdentityData upgraded_identity = 1;
|
||||
|
||||
// diagnostics is the collection of warning and error diagnostics for this request
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateEphemeralResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
ResourceIdentityData current_identity = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
ResourceIdentityData new_identity = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
ResourceIdentityData prior_identity = 8;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
|
||||
ResourceIdentityData planned_identity = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ResourceIdentityData planned_identity = 7;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
|
||||
ResourceIdentityData new_identity = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
ResourceIdentityData identity = 4;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
ResourceIdentityData identity = 4;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message GenerateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// config is the provided state modified such that it represents a valid resource configuration value.
|
||||
DynamicValue config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
|
||||
// The raw identity of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_identity = 7;
|
||||
|
||||
// The identity schema version of the resource type that the resource
|
||||
// is being moved from.
|
||||
int64 source_identity_schema_version = 8;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
|
||||
ResourceIdentityData target_identity = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message OpenEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
DynamicValue result = 3;
|
||||
optional bytes private = 4;
|
||||
Deferred deferred = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RenewEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
optional bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message CloseEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
string name = 1;
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue result = 1;
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ListResource {
|
||||
message Request {
|
||||
// type_name is the list resource type name.
|
||||
string type_name = 1;
|
||||
|
||||
// configuration is the list ConfigSchema-based configuration data.
|
||||
DynamicValue config = 2;
|
||||
|
||||
// when include_resource_object is set to true, the provider should
|
||||
// include the full resource object for each result
|
||||
bool include_resource_object = 3;
|
||||
|
||||
// The maximum number of results that Terraform is expecting.
|
||||
// The stream will stop, once this limit is reached.
|
||||
int64 limit = 4;
|
||||
}
|
||||
|
||||
message Event {
|
||||
// identity is the resource identity data of the resource instance.
|
||||
ResourceIdentityData identity = 1;
|
||||
|
||||
// display_name can be displayed in a UI to make it easier for humans to identify a resource
|
||||
string display_name = 2;
|
||||
|
||||
// optional resource object which can be useful when combining list blocks in configuration
|
||||
optional DynamicValue resource_object = 3;
|
||||
|
||||
// A warning or error diagnostics for this event
|
||||
repeated Diagnostic diagnostic = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateListResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue include_resource_object = 3;
|
||||
DynamicValue limit = 4;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanAction {
|
||||
message Request {
|
||||
string action_type = 1;
|
||||
// config of the action, based on the schema of the actual action
|
||||
DynamicValue config = 2;
|
||||
// metadata
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
// metadata
|
||||
Deferred deferred = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message InvokeAction {
|
||||
message Request {
|
||||
string action_type = 1;
|
||||
// response from the plan
|
||||
DynamicValue config = 2;
|
||||
// metadata
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message Event {
|
||||
message Progress {
|
||||
// message to be printed in the console / HCPT
|
||||
string message = 1;
|
||||
}
|
||||
message Completed {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
|
||||
oneof type {
|
||||
Progress progress = 1;
|
||||
Completed completed = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateActionConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,374 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.2
|
||||
//
|
||||
// This file defines version 5.2 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.3
|
||||
//
|
||||
// This file defines version 5.3 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
}
|
||||
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,409 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.4
|
||||
//
|
||||
// This file defines version 5.4 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
}
|
||||
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.5
|
||||
//
|
||||
// This file defines version 5.5 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,637 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.6
|
||||
//
|
||||
// This file defines version 5.6 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaing backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,700 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.7
|
||||
//
|
||||
// This file defines version 5.7 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaing backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Ephemeral Resource Lifecycle
|
||||
rpc ValidateEphemeralResourceConfig(ValidateEphemeralResourceConfig.Request) returns (ValidateEphemeralResourceConfig.Response);
|
||||
rpc OpenEphemeralResource(OpenEphemeralResource.Request) returns (OpenEphemeralResource.Response);
|
||||
rpc RenewEphemeralResource(RenewEphemeralResource.Request) returns (RenewEphemeralResource.Response);
|
||||
rpc CloseEphemeralResource(CloseEphemeralResource.Request) returns (CloseEphemeralResource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
repeated EphemeralResourceMetadata ephemeral_resources = 6;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message EphemeralResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
map<string, Schema> ephemeral_resource_schemas = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateEphemeralResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message OpenEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
DynamicValue result = 3;
|
||||
optional bytes private = 4;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RenewEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
optional bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message CloseEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,707 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.8
|
||||
//
|
||||
// This file defines version 5.8 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaing backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
// write_only indicates that the attribute value will be provided via
|
||||
// configuration and must be omitted from state. write_only must be
|
||||
// combined with optional or required, and is only valid for managed
|
||||
// resource schemas.
|
||||
bool write_only = 10;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
// The write_only_attributes_allowed capability signals that the client
|
||||
// is able to handle write_only attributes for managed resources.
|
||||
bool write_only_attributes_allowed = 2;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Ephemeral Resource Lifecycle
|
||||
rpc ValidateEphemeralResourceConfig(ValidateEphemeralResourceConfig.Request) returns (ValidateEphemeralResourceConfig.Response);
|
||||
rpc OpenEphemeralResource(OpenEphemeralResource.Request) returns (OpenEphemeralResource.Response);
|
||||
rpc RenewEphemeralResource(RenewEphemeralResource.Request) returns (RenewEphemeralResource.Response);
|
||||
rpc CloseEphemeralResource(CloseEphemeralResource.Request) returns (CloseEphemeralResource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
repeated EphemeralResourceMetadata ephemeral_resources = 6;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message EphemeralResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
map<string, Schema> ephemeral_resource_schemas = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateEphemeralResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message OpenEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
DynamicValue result = 3;
|
||||
optional bytes private = 4;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RenewEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
optional bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message CloseEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,826 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 5.9
|
||||
//
|
||||
// This file defines version 5.9 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 5 to follow
|
||||
// should copy this file and modify the copy while maintaing backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin5";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package tfplugin5;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message Stop {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource, Provider, or Provisioner.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
// write_only indicates that the attribute value will be provided via
|
||||
// configuration and must be omitted from state. write_only must be
|
||||
// combined with optional or required, and is only valid for managed
|
||||
// resource schemas.
|
||||
bool write_only = 10;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
// ResourceIdentitySchema represents the structure and types of data used to identify
|
||||
// a managed resource type. Effectively, resource identity is a versioned object
|
||||
// that can be used to compare resources, whether already managed and/or being
|
||||
// discovered.
|
||||
message ResourceIdentitySchema {
|
||||
// IdentityAttribute represents one value of data within resource identity.
|
||||
// These are always used in resource identity comparisons.
|
||||
message IdentityAttribute {
|
||||
// name is the identity attribute name
|
||||
string name = 1;
|
||||
|
||||
// type is the identity attribute type
|
||||
bytes type = 2;
|
||||
|
||||
// required_for_import when enabled signifies that this attribute must be
|
||||
// defined for ImportResourceState to complete successfully
|
||||
bool required_for_import = 3;
|
||||
|
||||
// optional_for_import when enabled signifies that this attribute is not
|
||||
// required for ImportResourceState, because it can be supplied by the
|
||||
// provider. It is still possible to supply this attribute during import.
|
||||
bool optional_for_import = 4;
|
||||
|
||||
// description is a human-readable description of the attribute in Markdown
|
||||
string description = 5;
|
||||
}
|
||||
|
||||
// version is the identity version and separate from the Schema version.
|
||||
// Any time the structure or format of identity_attributes changes, this version
|
||||
// should be incremented. Versioning implicitly starts at 0 and by convention
|
||||
// should be incremented by 1 each change.
|
||||
//
|
||||
// When comparing identity_attributes data, differing versions should always be treated
|
||||
// as inequal.
|
||||
int64 version = 1;
|
||||
|
||||
// identity_attributes are the individual value definitions which define identity data
|
||||
// for a managed resource type. This information is used to decode DynamicValue of
|
||||
// identity data.
|
||||
//
|
||||
// These attributes are intended for permanent identity data and must be wholly
|
||||
// representative of all data necessary to compare two managed resource instances
|
||||
// with no other data. This generally should include account, endpoint, location,
|
||||
// and automatically generated identifiers. For some resources, this may include
|
||||
// configuration-based data, such as a required name which must be unique.
|
||||
repeated IdentityAttribute identity_attributes = 2;
|
||||
}
|
||||
|
||||
// ResourceIdentityData is a separate message for better extensibility
|
||||
message ResourceIdentityData {
|
||||
// identity_data is the resource identity data for the given definition. It should
|
||||
// be decoded using the identity schema.
|
||||
//
|
||||
// This data is considered permanent for the identity version and suitable for
|
||||
// longer-term storage.
|
||||
DynamicValue identity_data = 1;
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
// The write_only_attributes_allowed capability signals that the client
|
||||
// is able to handle write_only attributes for managed resources.
|
||||
bool write_only_attributes_allowed = 2;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
// GetResourceIdentitySchemas returns the identity schemas for all managed
|
||||
// resources.
|
||||
rpc GetResourceIdentitySchemas(GetResourceIdentitySchemas.Request) returns (GetResourceIdentitySchemas.Response);
|
||||
rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response);
|
||||
rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response);
|
||||
rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
// UpgradeResourceIdentityData should return the upgraded resource identity
|
||||
// data for a managed resource type.
|
||||
rpc UpgradeResourceIdentity(UpgradeResourceIdentity.Request) returns (UpgradeResourceIdentity.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc Configure(Configure.Request) returns (Configure.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Ephemeral Resource Lifecycle
|
||||
rpc ValidateEphemeralResourceConfig(ValidateEphemeralResourceConfig.Request) returns (ValidateEphemeralResourceConfig.Response);
|
||||
rpc OpenEphemeralResource(OpenEphemeralResource.Request) returns (OpenEphemeralResource.Response);
|
||||
rpc RenewEphemeralResource(RenewEphemeralResource.Request) returns (RenewEphemeralResource.Response);
|
||||
rpc CloseEphemeralResource(CloseEphemeralResource.Request) returns (CloseEphemeralResource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
repeated EphemeralResourceMetadata ephemeral_resources = 6;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message EphemeralResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
map<string, Schema> ephemeral_resource_schemas = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message PrepareProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue prepared_config = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceTypeConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataSourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Configure {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
ResourceIdentityData current_identity = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
ResourceIdentityData new_identity = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
ResourceIdentityData prior_identity = 8;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
ResourceIdentityData planned_identity = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ResourceIdentityData planned_identity = 7;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
ResourceIdentityData new_identity = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
ResourceIdentityData identity = 4;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
ResourceIdentityData identity = 4;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
|
||||
// The raw identity of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_identity = 7;
|
||||
|
||||
// The identity schema version of the resource type that the resource
|
||||
// is being moved from.
|
||||
int64 source_identity_schema_version = 8;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
|
||||
ResourceIdentityData target_identity = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
service Provisioner {
|
||||
rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response);
|
||||
rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response);
|
||||
rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response);
|
||||
rpc Stop(Stop.Request) returns (Stop.Response);
|
||||
}
|
||||
|
||||
message GetProvisionerSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provisioner = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProvisionerConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ProvisionResource {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
DynamicValue connection = 2;
|
||||
}
|
||||
message Response {
|
||||
string output = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateEphemeralResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message OpenEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
DynamicValue result = 3;
|
||||
optional bytes private = 4;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RenewEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
optional bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message CloseEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns resource identity schemas for all resources
|
||||
message GetResourceIdentitySchemas {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
// identity_schemas is a mapping of resource type names to their identity schemas.
|
||||
map<string, ResourceIdentitySchema> identity_schemas = 1;
|
||||
|
||||
// diagnostics is the collection of warning and error diagnostics for this request.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceIdentity {
|
||||
message Request {
|
||||
// type_name is the managed resource type name
|
||||
string type_name = 1;
|
||||
|
||||
// version is the version of the resource identity data to upgrade
|
||||
int64 version = 2;
|
||||
|
||||
// raw_identity is the raw identity as stored for the resource. Core does
|
||||
// not have access to the identity schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_identity will be json encoded.
|
||||
RawState raw_identity = 3;
|
||||
}
|
||||
message Response {
|
||||
// upgraded_identity returns the upgraded resource identity data
|
||||
ResourceIdentityData upgraded_identity = 1;
|
||||
|
||||
// diagnostics is the collection of warning and error diagnostics for this request
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.0
|
||||
//
|
||||
// This file defines version 6.0 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.1
|
||||
//
|
||||
// This file defines version 6.1 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,355 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.2
|
||||
//
|
||||
// This file defines version 6.2 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.3
|
||||
//
|
||||
// This file defines version 6.3 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
}
|
||||
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,390 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) 2023 HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.4
|
||||
//
|
||||
// This file defines version 6.4 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
}
|
||||
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,572 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.5
|
||||
//
|
||||
// This file defines version 6.5 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetProviderSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any errors from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,618 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.6
|
||||
//
|
||||
// This file defines version 6.6 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaing backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetProviderSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any errors from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,682 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.7
|
||||
//
|
||||
// This file defines version 6.7 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaing backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetProviderSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Ephemeral Resource Lifecycle
|
||||
rpc ValidateEphemeralResourceConfig(ValidateEphemeralResourceConfig.Request) returns (ValidateEphemeralResourceConfig.Response);
|
||||
rpc OpenEphemeralResource(OpenEphemeralResource.Request) returns (OpenEphemeralResource.Response);
|
||||
rpc RenewEphemeralResource(RenewEphemeralResource.Request) returns (RenewEphemeralResource.Response);
|
||||
rpc CloseEphemeralResource(CloseEphemeralResource.Request) returns (CloseEphemeralResource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
repeated EphemeralResourceMetadata ephemeral_resources = 6;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message EphemeralResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
map<string, Schema> ephemeral_resource_schemas = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateEphemeralResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message OpenEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
DynamicValue result = 3;
|
||||
optional bytes private = 4;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RenewEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
optional bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message CloseEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,691 @@
|
||||
// Copyright (c) The OpenTofu Authors
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.8
|
||||
//
|
||||
// This file defines version 6.8 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaing backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
// write_only indicates that the attribute value will be provided via
|
||||
// configuration and must be omitted from state. write_only must be
|
||||
// combined with optional or required, and is only valid for managed
|
||||
// resource schemas.
|
||||
bool write_only = 11;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
// The write_only_attributes_allowed capability signals that the client
|
||||
// is able to handle write_only attributes for managed resources.
|
||||
bool write_only_attributes_allowed = 2;
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetProviderSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Ephemeral Resource Lifecycle
|
||||
rpc ValidateEphemeralResourceConfig(ValidateEphemeralResourceConfig.Request) returns (ValidateEphemeralResourceConfig.Response);
|
||||
rpc OpenEphemeralResource(OpenEphemeralResource.Request) returns (OpenEphemeralResource.Response);
|
||||
rpc RenewEphemeralResource(RenewEphemeralResource.Request) returns (RenewEphemeralResource.Response);
|
||||
rpc CloseEphemeralResource(CloseEphemeralResource.Request) returns (CloseEphemeralResource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
repeated EphemeralResourceMetadata ephemeral_resources = 6;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message EphemeralResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
map<string, Schema> ephemeral_resource_schemas = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateEphemeralResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message OpenEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
DynamicValue result = 3;
|
||||
optional bytes private = 4;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RenewEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
optional bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message CloseEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,809 @@
|
||||
// Copyright (c) HashiCorp, Inc.
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
// Terraform Plugin RPC protocol version 6.9
|
||||
//
|
||||
// This file defines version 6.9 of the RPC protocol. To implement a plugin
|
||||
// against this protocol, copy this definition into your own codebase and
|
||||
// use protoc to generate stubs for your target language.
|
||||
//
|
||||
// This file will not be updated. Any minor versions of protocol 6 to follow
|
||||
// should copy this file and modify the copy while maintaining backwards
|
||||
// compatibility. Breaking changes, if any are required, will come
|
||||
// in a subsequent major version with its own separate proto definition.
|
||||
//
|
||||
// Note that only the proto files included in a release tag of Terraform are
|
||||
// official protocol releases. Proto files taken from other commits may include
|
||||
// incomplete changes or features that did not make it into a final release.
|
||||
// In all reasonable cases, plugin developers should take the proto file from
|
||||
// the tag of the most recent release of Terraform, and not from the main
|
||||
// branch or any other development branch.
|
||||
//
|
||||
syntax = "proto3";
|
||||
option go_package = "github.com/opentofu/opentofu/internal/tfplugin6";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
package tfplugin6;
|
||||
|
||||
// DynamicValue is an opaque encoding of terraform data, with the field name
|
||||
// indicating the encoding scheme used.
|
||||
message DynamicValue {
|
||||
bytes msgpack = 1;
|
||||
bytes json = 2;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
enum Severity {
|
||||
INVALID = 0;
|
||||
ERROR = 1;
|
||||
WARNING = 2;
|
||||
}
|
||||
Severity severity = 1;
|
||||
string summary = 2;
|
||||
string detail = 3;
|
||||
AttributePath attribute = 4;
|
||||
}
|
||||
|
||||
message FunctionError {
|
||||
string text = 1;
|
||||
// The optional function_argument records the index position of the
|
||||
// argument which caused the error.
|
||||
optional int64 function_argument = 2;
|
||||
}
|
||||
|
||||
message AttributePath {
|
||||
message Step {
|
||||
oneof selector {
|
||||
// Set "attribute_name" to represent looking up an attribute
|
||||
// in the current object value.
|
||||
string attribute_name = 1;
|
||||
// Set "element_key_*" to represent looking up an element in
|
||||
// an indexable collection type.
|
||||
string element_key_string = 2;
|
||||
int64 element_key_int = 3;
|
||||
}
|
||||
}
|
||||
repeated Step steps = 1;
|
||||
}
|
||||
|
||||
message StopProvider {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
string Error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// RawState holds the stored state for a resource to be upgraded by the
|
||||
// provider. It can be in one of two formats, the current json encoded format
|
||||
// in bytes, or the legacy flatmap format as a map of strings.
|
||||
message RawState {
|
||||
bytes json = 1;
|
||||
map<string, string> flatmap = 2;
|
||||
}
|
||||
|
||||
enum StringKind {
|
||||
PLAIN = 0;
|
||||
MARKDOWN = 1;
|
||||
}
|
||||
|
||||
// Schema is the configuration schema for a Resource or Provider.
|
||||
message Schema {
|
||||
message Block {
|
||||
int64 version = 1;
|
||||
repeated Attribute attributes = 2;
|
||||
repeated NestedBlock block_types = 3;
|
||||
string description = 4;
|
||||
StringKind description_kind = 5;
|
||||
bool deprecated = 6;
|
||||
}
|
||||
|
||||
message Attribute {
|
||||
string name = 1;
|
||||
bytes type = 2;
|
||||
Object nested_type = 10;
|
||||
string description = 3;
|
||||
bool required = 4;
|
||||
bool optional = 5;
|
||||
bool computed = 6;
|
||||
bool sensitive = 7;
|
||||
StringKind description_kind = 8;
|
||||
bool deprecated = 9;
|
||||
// write_only indicates that the attribute value will be provided via
|
||||
// configuration and must be omitted from state. write_only must be
|
||||
// combined with optional or required, and is only valid for managed
|
||||
// resource schemas.
|
||||
bool write_only = 11;
|
||||
}
|
||||
|
||||
message NestedBlock {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
GROUP = 5;
|
||||
}
|
||||
|
||||
string type_name = 1;
|
||||
Block block = 2;
|
||||
NestingMode nesting = 3;
|
||||
int64 min_items = 4;
|
||||
int64 max_items = 5;
|
||||
}
|
||||
|
||||
message Object {
|
||||
enum NestingMode {
|
||||
INVALID = 0;
|
||||
SINGLE = 1;
|
||||
LIST = 2;
|
||||
SET = 3;
|
||||
MAP = 4;
|
||||
}
|
||||
|
||||
repeated Attribute attributes = 1;
|
||||
NestingMode nesting = 3;
|
||||
|
||||
// MinItems and MaxItems were never used in the protocol, and have no
|
||||
// effect on validation.
|
||||
int64 min_items = 4 [deprecated = true];
|
||||
int64 max_items = 5 [deprecated = true];
|
||||
}
|
||||
|
||||
// The version of the schema.
|
||||
// Schemas are versioned, so that providers can upgrade a saved resource
|
||||
// state when the schema is changed.
|
||||
int64 version = 1;
|
||||
|
||||
// Block is the top level configuration block for this schema.
|
||||
Block block = 2;
|
||||
}
|
||||
|
||||
// ResourceIdentitySchema represents the structure and types of data used to identify
|
||||
// a managed resource type. Effectively, resource identity is a versioned object
|
||||
// that can be used to compare resources, whether already managed and/or being
|
||||
// discovered.
|
||||
message ResourceIdentitySchema {
|
||||
// IdentityAttribute represents one value of data within resource identity.
|
||||
// These are always used in resource identity comparisons.
|
||||
message IdentityAttribute {
|
||||
// name is the identity attribute name
|
||||
string name = 1;
|
||||
|
||||
// type is the identity attribute type
|
||||
bytes type = 2;
|
||||
|
||||
// required_for_import when enabled signifies that this attribute must be
|
||||
// defined for ImportResourceState to complete successfully
|
||||
bool required_for_import = 3;
|
||||
|
||||
// optional_for_import when enabled signifies that this attribute is not
|
||||
// required for ImportResourceState, because it can be supplied by the
|
||||
// provider. It is still possible to supply this attribute during import.
|
||||
bool optional_for_import = 4;
|
||||
|
||||
// description is a human-readable description of the attribute in Markdown
|
||||
string description = 5;
|
||||
}
|
||||
|
||||
// version is the identity version and separate from the Schema version.
|
||||
// Any time the structure or format of identity_attributes changes, this version
|
||||
// should be incremented. Versioning implicitly starts at 0 and by convention
|
||||
// should be incremented by 1 each change.
|
||||
//
|
||||
// When comparing identity_attributes data, differing versions should always be treated
|
||||
// as inequal.
|
||||
int64 version = 1;
|
||||
|
||||
// identity_attributes are the individual value definitions which define identity data
|
||||
// for a managed resource type. This information is used to decode DynamicValue of
|
||||
// identity data.
|
||||
//
|
||||
// These attributes are intended for permanent identity data and must be wholly
|
||||
// representative of all data necessary to compare two managed resource instances
|
||||
// with no other data. This generally should include account, endpoint, location,
|
||||
// and automatically generated identifiers. For some resources, this may include
|
||||
// configuration-based data, such as a required name which must be unique.
|
||||
repeated IdentityAttribute identity_attributes = 2;
|
||||
}
|
||||
|
||||
// ResourceIdentityData is a separate message for better extensibility
|
||||
message ResourceIdentityData {
|
||||
// identity_data is the resource identity data for the given definition. It should
|
||||
// be decoded using the identity schema.
|
||||
//
|
||||
// This data is considered permanent for the identity version and suitable for
|
||||
// longer-term storage.
|
||||
DynamicValue identity_data = 1;
|
||||
}
|
||||
|
||||
|
||||
message Function {
|
||||
// parameters is the ordered list of positional function parameters.
|
||||
repeated Parameter parameters = 1;
|
||||
|
||||
// variadic_parameter is an optional final parameter which accepts
|
||||
// zero or more argument values, in which Terraform will send an
|
||||
// ordered list of the parameter type.
|
||||
Parameter variadic_parameter = 2;
|
||||
|
||||
// return is the function result.
|
||||
Return return = 3;
|
||||
|
||||
// summary is the human-readable shortened documentation for the function.
|
||||
string summary = 4;
|
||||
|
||||
// description is human-readable documentation for the function.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
|
||||
// deprecation_message is human-readable documentation if the
|
||||
// function is deprecated.
|
||||
string deprecation_message = 7;
|
||||
|
||||
message Parameter {
|
||||
// name is the human-readable display name for the parameter.
|
||||
string name = 1;
|
||||
|
||||
// type is the type constraint for the parameter.
|
||||
bytes type = 2;
|
||||
|
||||
// allow_null_value when enabled denotes that a null argument value can
|
||||
// be passed to the provider. When disabled, Terraform returns an error
|
||||
// if the argument value is null.
|
||||
bool allow_null_value = 3;
|
||||
|
||||
// allow_unknown_values when enabled denotes that only wholly known
|
||||
// argument values will be passed to the provider. When disabled,
|
||||
// Terraform skips the function call entirely and assumes an unknown
|
||||
// value result from the function.
|
||||
bool allow_unknown_values = 4;
|
||||
|
||||
// description is human-readable documentation for the parameter.
|
||||
string description = 5;
|
||||
|
||||
// description_kind is the formatting of the description.
|
||||
StringKind description_kind = 6;
|
||||
}
|
||||
|
||||
message Return {
|
||||
// type is the type constraint for the function result.
|
||||
bytes type = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ServerCapabilities allows providers to communicate extra information
|
||||
// regarding supported protocol features. This is used to indicate
|
||||
// availability of certain forward-compatible changes which may be optional
|
||||
// in a major protocol version, but cannot be tested for directly.
|
||||
message ServerCapabilities {
|
||||
// The plan_destroy capability signals that a provider expects a call
|
||||
// to PlanResourceChange when a resource is going to be destroyed.
|
||||
bool plan_destroy = 1;
|
||||
|
||||
// The get_provider_schema_optional capability indicates that this
|
||||
// provider does not require calling GetProviderSchema to operate
|
||||
// normally, and the caller can used a cached copy of the provider's
|
||||
// schema.
|
||||
bool get_provider_schema_optional = 2;
|
||||
|
||||
// The move_resource_state capability signals that a provider supports the
|
||||
// MoveResourceState RPC.
|
||||
bool move_resource_state = 3;
|
||||
}
|
||||
|
||||
// ClientCapabilities allows Terraform to publish information regarding
|
||||
// supported protocol features. This is used to indicate availability of
|
||||
// certain forward-compatible changes which may be optional in a major
|
||||
// protocol version, but cannot be tested for directly.
|
||||
message ClientCapabilities {
|
||||
// The deferral_allowed capability signals that the client is able to
|
||||
// handle deferred responses from the provider.
|
||||
bool deferral_allowed = 1;
|
||||
// The write_only_attributes_allowed capability signals that the client
|
||||
// is able to handle write_only attributes for managed resources.
|
||||
bool write_only_attributes_allowed = 2;
|
||||
}
|
||||
|
||||
// Deferred is a message that indicates that change is deferred for a reason.
|
||||
message Deferred {
|
||||
// Reason is the reason for deferring the change.
|
||||
enum Reason {
|
||||
// UNKNOWN is the default value, and should not be used.
|
||||
UNKNOWN = 0;
|
||||
// RESOURCE_CONFIG_UNKNOWN is used when the config is partially unknown and the real
|
||||
// values need to be known before the change can be planned.
|
||||
RESOURCE_CONFIG_UNKNOWN = 1;
|
||||
// PROVIDER_CONFIG_UNKNOWN is used when parts of the provider configuration
|
||||
// are unknown, e.g. the provider configuration is only known after the apply is done.
|
||||
PROVIDER_CONFIG_UNKNOWN = 2;
|
||||
// ABSENT_PREREQ is used when a hard dependency has not been satisfied.
|
||||
ABSENT_PREREQ = 3;
|
||||
}
|
||||
// reason is the reason for deferring the change.
|
||||
Reason reason = 1;
|
||||
}
|
||||
|
||||
service Provider {
|
||||
//////// Information about what a provider supports/expects
|
||||
|
||||
// GetMetadata returns upfront information about server capabilities and
|
||||
// supported resource types without requiring the server to instantiate all
|
||||
// schema information, which may be memory intensive. This RPC is optional,
|
||||
// where clients may receive an unimplemented RPC error. Clients should
|
||||
// ignore the error and call the GetProviderSchema RPC as a fallback.
|
||||
rpc GetMetadata(GetMetadata.Request) returns (GetMetadata.Response);
|
||||
|
||||
// GetSchema returns schema information for the provider, data resources,
|
||||
// and managed resources.
|
||||
rpc GetProviderSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response);
|
||||
// GetResourceIdentitySchemas returns the identity schemas for all managed
|
||||
// resources.
|
||||
rpc GetResourceIdentitySchemas(GetResourceIdentitySchemas.Request) returns (GetResourceIdentitySchemas.Response);
|
||||
rpc ValidateProviderConfig(ValidateProviderConfig.Request) returns (ValidateProviderConfig.Response);
|
||||
rpc ValidateResourceConfig(ValidateResourceConfig.Request) returns (ValidateResourceConfig.Response);
|
||||
rpc ValidateDataResourceConfig(ValidateDataResourceConfig.Request) returns (ValidateDataResourceConfig.Response);
|
||||
rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response);
|
||||
// UpgradeResourceIdentityData should return the upgraded resource identity
|
||||
// data for a managed resource type.
|
||||
rpc UpgradeResourceIdentity(UpgradeResourceIdentity.Request) returns (UpgradeResourceIdentity.Response);
|
||||
|
||||
//////// One-time initialization, called before other functions below
|
||||
rpc ConfigureProvider(ConfigureProvider.Request) returns (ConfigureProvider.Response);
|
||||
|
||||
//////// Managed Resource Lifecycle
|
||||
rpc ReadResource(ReadResource.Request) returns (ReadResource.Response);
|
||||
rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response);
|
||||
rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response);
|
||||
rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response);
|
||||
rpc MoveResourceState(MoveResourceState.Request) returns (MoveResourceState.Response);
|
||||
rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response);
|
||||
|
||||
//////// Ephemeral Resource Lifecycle
|
||||
rpc ValidateEphemeralResourceConfig(ValidateEphemeralResourceConfig.Request) returns (ValidateEphemeralResourceConfig.Response);
|
||||
rpc OpenEphemeralResource(OpenEphemeralResource.Request) returns (OpenEphemeralResource.Response);
|
||||
rpc RenewEphemeralResource(RenewEphemeralResource.Request) returns (RenewEphemeralResource.Response);
|
||||
rpc CloseEphemeralResource(CloseEphemeralResource.Request) returns (CloseEphemeralResource.Response);
|
||||
|
||||
// Functions
|
||||
|
||||
// GetFunctions returns the definitions of all functions.
|
||||
rpc GetFunctions(GetFunctions.Request) returns (GetFunctions.Response);
|
||||
|
||||
// CallFunction runs the provider-defined function logic and returns
|
||||
// the result with any diagnostics.
|
||||
rpc CallFunction(CallFunction.Request) returns (CallFunction.Response);
|
||||
|
||||
//////// Graceful Shutdown
|
||||
rpc StopProvider(StopProvider.Request) returns (StopProvider.Response);
|
||||
}
|
||||
|
||||
message GetMetadata {
|
||||
message Request {
|
||||
}
|
||||
|
||||
message Response {
|
||||
ServerCapabilities server_capabilities = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
repeated DataSourceMetadata data_sources = 3;
|
||||
repeated ResourceMetadata resources = 4;
|
||||
|
||||
// functions returns metadata for any functions.
|
||||
repeated FunctionMetadata functions = 5;
|
||||
repeated EphemeralResourceMetadata ephemeral_resources = 6;
|
||||
}
|
||||
|
||||
message FunctionMetadata {
|
||||
// name is the function name.
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
message DataSourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message ResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
|
||||
message EphemeralResourceMetadata {
|
||||
string type_name = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetProviderSchema {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
Schema provider = 1;
|
||||
map<string, Schema> resource_schemas = 2;
|
||||
map<string, Schema> data_source_schemas = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
Schema provider_meta = 5;
|
||||
ServerCapabilities server_capabilities = 6;
|
||||
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 7;
|
||||
map<string, Schema> ephemeral_resource_schemas = 8;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateProviderConfig {
|
||||
message Request {
|
||||
DynamicValue config = 1;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceState {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// UpgradeResourceState RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to exist (in the case of resource destruction), be wholly
|
||||
// known, nor match the given prior state, which could lead to unexpected
|
||||
// provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
|
||||
// version is the schema_version number recorded in the state file
|
||||
int64 version = 2;
|
||||
|
||||
// raw_state is the raw states as stored for the resource. Core does
|
||||
// not have access to the schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_state will be the json encoded
|
||||
// state, or a legacy flat-mapped format.
|
||||
RawState raw_state = 3;
|
||||
}
|
||||
message Response {
|
||||
// new_state is a msgpack-encoded data structure that, when interpreted with
|
||||
// the _current_ schema for this resource type, is functionally equivalent to
|
||||
// that which was given in prior_state_raw.
|
||||
DynamicValue upgraded_state = 1;
|
||||
|
||||
// diagnostics describes any errors encountered during migration that could not
|
||||
// be safely resolved, and warnings about any possibly-risky assumptions made
|
||||
// in the upgrade process.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateDataResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ConfigureProvider {
|
||||
message Request {
|
||||
string terraform_version = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadResource {
|
||||
// Request is the message that is sent to the provider during the
|
||||
// ReadResource RPC.
|
||||
//
|
||||
// This message intentionally does not include configuration data as any
|
||||
// configuration-based or configuration-conditional changes should occur
|
||||
// during the PlanResourceChange RPC. Additionally, the configuration is
|
||||
// not guaranteed to be wholly known nor match the given prior state, which
|
||||
// could lead to unexpected provider behaviors for practitioners.
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue current_state = 2;
|
||||
bytes private = 3;
|
||||
DynamicValue provider_meta = 4;
|
||||
ClientCapabilities client_capabilities = 5;
|
||||
ResourceIdentityData current_identity = 6;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
bytes private = 3;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 4;
|
||||
ResourceIdentityData new_identity = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message PlanResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue proposed_new_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes prior_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ClientCapabilities client_capabilities = 7;
|
||||
ResourceIdentityData prior_identity = 8;
|
||||
}
|
||||
|
||||
message Response {
|
||||
DynamicValue planned_state = 1;
|
||||
repeated AttributePath requires_replace = 2;
|
||||
bytes planned_private = 3;
|
||||
repeated Diagnostic diagnostics = 4;
|
||||
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 5;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 6;
|
||||
ResourceIdentityData planned_identity = 7;
|
||||
}
|
||||
}
|
||||
|
||||
message ApplyResourceChange {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue prior_state = 2;
|
||||
DynamicValue planned_state = 3;
|
||||
DynamicValue config = 4;
|
||||
bytes planned_private = 5;
|
||||
DynamicValue provider_meta = 6;
|
||||
ResourceIdentityData planned_identity = 7;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue new_state = 1;
|
||||
bytes private = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
|
||||
// This may be set only by the helper/schema "SDK" in the main Terraform
|
||||
// repository, to request that Terraform Core >=0.12 permit additional
|
||||
// inconsistencies that can result from the legacy SDK type system
|
||||
// and its imprecise mapping to the >=0.12 type system.
|
||||
// The change in behavior implied by this flag makes sense only for the
|
||||
// specific details of the legacy SDK type system, and are not a general
|
||||
// mechanism to avoid proper type handling in providers.
|
||||
//
|
||||
// ==== DO NOT USE THIS ====
|
||||
// ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ====
|
||||
// ==== DO NOT USE THIS ====
|
||||
bool legacy_type_system = 4;
|
||||
ResourceIdentityData new_identity = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ImportResourceState {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
string id = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
ResourceIdentityData identity = 4;
|
||||
}
|
||||
|
||||
message ImportedResource {
|
||||
string type_name = 1;
|
||||
DynamicValue state = 2;
|
||||
bytes private = 3;
|
||||
ResourceIdentityData identity = 4;
|
||||
}
|
||||
|
||||
message Response {
|
||||
repeated ImportedResource imported_resources = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MoveResourceState {
|
||||
message Request {
|
||||
// The address of the provider the resource is being moved from.
|
||||
string source_provider_address = 1;
|
||||
|
||||
// The resource type that the resource is being moved from.
|
||||
string source_type_name = 2;
|
||||
|
||||
// The schema version of the resource type that the resource is being
|
||||
// moved from.
|
||||
int64 source_schema_version = 3;
|
||||
|
||||
// The raw state of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_state = 4;
|
||||
|
||||
// The resource type that the resource is being moved to.
|
||||
string target_type_name = 5;
|
||||
|
||||
// The private state of the resource being moved.
|
||||
bytes source_private = 6;
|
||||
|
||||
// The raw identity of the resource being moved. Only the json field is
|
||||
// populated, as there should be no legacy providers using the flatmap
|
||||
// format that support newly introduced RPCs.
|
||||
RawState source_identity = 7;
|
||||
|
||||
// The identity schema version of the resource type that the resource
|
||||
// is being moved from.
|
||||
int64 source_identity_schema_version = 8;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// The state of the resource after it has been moved.
|
||||
DynamicValue target_state = 1;
|
||||
|
||||
// Any diagnostics that occurred during the move.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
|
||||
// The private state of the resource after it has been moved.
|
||||
bytes target_private = 3;
|
||||
|
||||
ResourceIdentityData target_identity = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message ReadDataSource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
DynamicValue provider_meta = 3;
|
||||
ClientCapabilities client_capabilities = 4;
|
||||
}
|
||||
message Response {
|
||||
DynamicValue state = 1;
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message GetFunctions {
|
||||
message Request {}
|
||||
|
||||
message Response {
|
||||
// functions is a mapping of function names to definitions.
|
||||
map<string, Function> functions = 1;
|
||||
|
||||
// diagnostics is any warnings or errors.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CallFunction {
|
||||
message Request {
|
||||
// name is the name of the function being called.
|
||||
string name = 1;
|
||||
|
||||
// arguments is the data of each function argument value.
|
||||
repeated DynamicValue arguments = 2;
|
||||
}
|
||||
|
||||
message Response {
|
||||
// result is result value after running the function logic.
|
||||
DynamicValue result = 1;
|
||||
|
||||
// error is any error from the function logic.
|
||||
FunctionError error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ValidateEphemeralResourceConfig {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message OpenEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
DynamicValue config = 2;
|
||||
ClientCapabilities client_capabilities = 3;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
DynamicValue result = 3;
|
||||
optional bytes private = 4;
|
||||
// deferred is set if the provider is deferring the change. If set the caller
|
||||
// needs to handle the deferral.
|
||||
Deferred deferred = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message RenewEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
optional google.protobuf.Timestamp renew_at = 2;
|
||||
optional bytes private = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message CloseEphemeralResource {
|
||||
message Request {
|
||||
string type_name = 1;
|
||||
optional bytes private = 2;
|
||||
}
|
||||
message Response {
|
||||
repeated Diagnostic diagnostics = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns resource identity schemas for all resources
|
||||
message GetResourceIdentitySchemas {
|
||||
message Request {
|
||||
}
|
||||
message Response {
|
||||
// identity_schemas is a mapping of resource type names to their identity schemas.
|
||||
map<string, ResourceIdentitySchema> identity_schemas = 1;
|
||||
|
||||
// diagnostics is the collection of warning and error diagnostics for this request.
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message UpgradeResourceIdentity {
|
||||
message Request {
|
||||
// type_name is the managed resource type name
|
||||
string type_name = 1;
|
||||
|
||||
// version is the version of the resource identity data to upgrade
|
||||
int64 version = 2;
|
||||
|
||||
// raw_identity is the raw identity as stored for the resource. Core does
|
||||
// not have access to the identity schema of prior_version, so it's the
|
||||
// provider's responsibility to interpret this value using the
|
||||
// appropriate older schema. The raw_identity will be json encoded.
|
||||
RawState raw_identity = 3;
|
||||
}
|
||||
message Response {
|
||||
// upgraded_identity returns the upgraded resource identity data
|
||||
ResourceIdentityData upgraded_identity = 1;
|
||||
|
||||
// diagnostics is the collection of warning and error diagnostics for this request
|
||||
repeated Diagnostic diagnostics = 2;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user