Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stacks: add deferred to protobuf #34880

Merged
merged 4 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions docs/plugin-protocol/tfplugin5.6.proto
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,27 @@ message Function {
}
}

// 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 parts of the resource configuration
// are unknown, e.g. the for_each value is only known after the apply is done.
DanielMSchmidt marked this conversation as resolved.
Show resolved Hide resolved
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

Expand Down Expand Up @@ -323,6 +344,10 @@ message UpgradeResourceState {
// appropriate older schema. The raw_state will be the json encoded
// state, or a legacy flat-mapped format.
RawState raw_state = 3;

// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 4;
}
message Response {
// new_state is a msgpack-encoded data structure that, when interpreted with
Expand All @@ -334,6 +359,10 @@ message UpgradeResourceState {
// be safely resolved, and warnings about any possibly-risky assumptions made
// in the upgrade process.
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;
}
}

Expand Down Expand Up @@ -381,11 +410,18 @@ message ReadResource {
DynamicValue current_state = 2;
bytes private = 3;
DynamicValue provider_meta = 4;

// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 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;
}
}

Expand All @@ -397,6 +433,10 @@ message PlanResourceChange {
DynamicValue config = 4;
bytes prior_private = 5;
DynamicValue provider_meta = 6;

// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 7;
}

message Response {
Expand All @@ -418,6 +458,10 @@ message PlanResourceChange {
// ==== 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;
}
}

Expand Down Expand Up @@ -454,6 +498,9 @@ message ImportResourceState {
message Request {
string type_name = 1;
string id = 2;
// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 3;
}

message ImportedResource {
Expand All @@ -465,6 +512,9 @@ message ImportResourceState {
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;
}
}

Expand Down Expand Up @@ -509,10 +559,16 @@ message ReadDataSource {
string type_name = 1;
DynamicValue config = 2;
DynamicValue provider_meta = 3;
// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 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;
}
}

Expand Down
55 changes: 55 additions & 0 deletions docs/plugin-protocol/tfplugin6.6.proto
DanielMSchmidt marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,27 @@ message ServerCapabilities {
bool move_resource_state = 3;
}

// 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 parts of the resource configuration
// are unknown, e.g. the for_each value is only known after the apply is done.
RESOURCE_CONFIG_UNKNOWN = 1;
DanielMSchmidt marked this conversation as resolved.
Show resolved Hide resolved
// 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

Expand Down Expand Up @@ -341,6 +362,10 @@ message UpgradeResourceState {
// appropriate older schema. The raw_state will be the json encoded
// state, or a legacy flat-mapped format.
RawState raw_state = 3;

// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 4;
DanielMSchmidt marked this conversation as resolved.
Show resolved Hide resolved
}
message Response {
// new_state is a msgpack-encoded data structure that, when interpreted with
Expand All @@ -352,6 +377,10 @@ message UpgradeResourceState {
// be safely resolved, and warnings about any possibly-risky assumptions made
// in the upgrade process.
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;
DanielMSchmidt marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -399,11 +428,17 @@ message ReadResource {
DynamicValue current_state = 2;
bytes private = 3;
DynamicValue provider_meta = 4;
// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 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;
}
}

Expand All @@ -415,6 +450,10 @@ message PlanResourceChange {
DynamicValue config = 4;
bytes prior_private = 5;
DynamicValue provider_meta = 6;

// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 7;
}

message Response {
Expand All @@ -435,6 +474,10 @@ message PlanResourceChange {
// ==== 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;
}
}

Expand Down Expand Up @@ -471,6 +514,9 @@ message ImportResourceState {
message Request {
string type_name = 1;
string id = 2;
// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 3;
}

message ImportedResource {
Expand All @@ -482,6 +528,9 @@ message ImportResourceState {
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;
}
}

Expand Down Expand Up @@ -526,10 +575,16 @@ message ReadDataSource {
string type_name = 1;
DynamicValue config = 2;
DynamicValue provider_meta = 3;
// deferral_allowed signals that the provider is allowed to defer the
// changes. If set the caller needs to handle the deferred response.
bool deferral_allowed = 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;
}
}

Expand Down
Loading
Loading