This change adds the capability for a resource provider to indicate that, where an action carried out in response to a diff, a certain set of properties would be "stable"; that is to say, they are guaranteed not to change. As a result, properties may be resolved to their final values during previewing, avoiding erroneous cascading impacts. This avoids the ever-annoying situation I keep running into when demoing: when adding or removing an ingress rule to a security group, we ripple the impact through the instance, and claim it must be replaced, because that instance depends on the security group via its name. Well, the name is a great example of a stable property, in that it will never change, and so this is truly unfortunate and always adds uncertainty into the demos. Particularly since the actual update doesn't need to perform replacements. This resolves pulumi/pulumi#330.
97 lines
4.3 KiB
Protocol Buffer
97 lines
4.3 KiB
Protocol Buffer
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
|
|
|
syntax = "proto3";
|
|
|
|
import "google/protobuf/empty.proto";
|
|
import "google/protobuf/struct.proto";
|
|
|
|
package pulumirpc;
|
|
|
|
// ResourceProvider is a service that understands how to create, read, update, or delete resources for types defined
|
|
// within a single package. It is driven by the overall planning engine in response to resource diffs.
|
|
service ResourceProvider {
|
|
// Configure configures the resource provider with "globals" that control its behavior.
|
|
rpc Configure(ConfigureRequest) returns (google.protobuf.Empty){}
|
|
// Invoke dynamically executes a built-in function in the provider.
|
|
rpc Invoke(InvokeRequest) returns (InvokeResponse) {}
|
|
// Check validates that the given property bag is valid for a resource of the given type.
|
|
rpc Check(CheckRequest) returns (CheckResponse) {}
|
|
// Diff checks what impacts a hypothetical update will have on the resource's properties.
|
|
rpc Diff(DiffRequest) returns (DiffResponse) {}
|
|
// Create allocates a new instance of the provided resource and returns its unique ID afterwards. (The input ID
|
|
// must be blank.) If this call fails, the resource must not have been created (i.e., it is "transacational").
|
|
rpc Create(CreateRequest) returns (CreateResponse) {}
|
|
// Update updates an existing resource with new values.
|
|
rpc Update(UpdateRequest) returns (UpdateResponse) {}
|
|
// Delete tears down an existing resource with the given ID. If it fails, the resource is assumed to still exist.
|
|
rpc Delete(DeleteRequest) returns (google.protobuf.Empty) {}
|
|
}
|
|
|
|
message ConfigureRequest {
|
|
map<string, string> variables = 1; // a map of configuration keys to values.
|
|
}
|
|
|
|
message InvokeRequest {
|
|
string tok = 1; // the function token to invoke.
|
|
google.protobuf.Struct args = 2; // the arguments for the function invocation.
|
|
}
|
|
|
|
message InvokeResponse {
|
|
google.protobuf.Struct return = 1; // the returned values, if invoke was successful.
|
|
repeated CheckFailure failures = 2; // the failures if any arguments didn't pass verification.
|
|
}
|
|
|
|
message CheckRequest {
|
|
string urn = 1; // the Pulumi URN for this resource.
|
|
google.protobuf.Struct properties = 2; // the full properties to use for validation.
|
|
}
|
|
|
|
message CheckResponse {
|
|
google.protobuf.Struct defaults = 1; // defaults to use, if any.
|
|
repeated CheckFailure failures = 2; // any validation failures that occurred.
|
|
}
|
|
|
|
message CheckFailure {
|
|
string property = 1; // the property that failed validation.
|
|
string reason = 2; // the reason that the property failed validation.
|
|
}
|
|
|
|
message DiffRequest {
|
|
string id = 1; // the ID of the resource to diff.
|
|
string urn = 2; // the Pulumi URN for this resource.
|
|
google.protobuf.Struct olds = 3; // the old values of properties to diff.
|
|
google.protobuf.Struct news = 4; // the new values of properties to diff.
|
|
}
|
|
|
|
message DiffResponse {
|
|
repeated string replaces = 1; // if this update requires a replacement, the set of properties triggering it.
|
|
repeated string stables = 2; // an optional list of properties that will not ever change.
|
|
}
|
|
|
|
message CreateRequest {
|
|
string urn = 1; // the Pulumi URN for this resource.
|
|
google.protobuf.Struct properties = 2; // the properties to set during creation.
|
|
}
|
|
|
|
message CreateResponse {
|
|
string id = 1; // the ID of the resource created.
|
|
google.protobuf.Struct properties = 2; // any properties that were computed during creation.
|
|
}
|
|
|
|
message UpdateRequest {
|
|
string id = 1; // the ID of the resource to update.
|
|
string urn = 2; // the Pulumi URN for this resource.
|
|
google.protobuf.Struct olds = 3; // the old values of properties to update.
|
|
google.protobuf.Struct news = 4; // the new values of properties to update.
|
|
}
|
|
|
|
message UpdateResponse {
|
|
google.protobuf.Struct properties = 1; // any properties that were computed during updating.
|
|
}
|
|
|
|
message DeleteRequest {
|
|
string id = 1; // the ID of the resource to delete.
|
|
string urn = 2; // the Pulumi URN for this resource.
|
|
google.protobuf.Struct properties = 3; // the current properties on the resource.
|
|
}
|
|
|