Skip to content

Commit

Permalink
stacks: add deferred to protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Mar 25, 2024
1 parent 5c24fc1 commit 3198f88
Show file tree
Hide file tree
Showing 3 changed files with 7,884 additions and 1,359 deletions.
52 changes: 52 additions & 0 deletions docs/plugin-protocol/tfplugin6.5.proto
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;
// 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;
}
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;
}
}

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,7 @@ message PlanResourceChange {
DynamicValue config = 4;
bytes prior_private = 5;
DynamicValue provider_meta = 6;
bool deferral_allowed = 7;
}

message Response {
Expand All @@ -435,6 +471,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 +511,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 +525,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 +572,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

0 comments on commit 3198f88

Please sign in to comment.