Add ImportedResource type

The ImportResourceStateResponse command can return mutliple types.
ImportedResource maps the state to the appropriate type name, and also
allows providers to return Private data for each resource.
This commit is contained in:
James Bardin 2018-06-21 15:04:59 -04:00 committed by Martin Atkins
parent dc78269a3c
commit 12521366e1

View File

@ -253,16 +253,35 @@ type ImportResourceStateRequest struct {
}
type ImportResourceStateResponse struct {
// State contains one or more state values for the imported resource. It is
// not required that these be complete, only that there is enough
// identifying information for the provider to successfully update the
// state in ReadResource.
State []cty.Value
// ImportedResources contains one or more state values related to the
// imported resource. It is not required that these be complete, only that
// there is enough identifying information for the provider to successfully
// update the states in ReadResource.
ImportedResources []ImportedResource
// Diagnostics contains any warnings or errors from the method call.
Diagnostics tfdiags.Diagnostics
}
// ImportedResource represents an object being imported into Terraform with the
// help of a provider. An ImportedObject is a RemoteObject that has been read
// by the provider's import handler but hasn't yet been committed to state.
type ImportedResource struct {
// ResourceType is the name of the resource type associated with the
// returned state. It's possible for providers to import multiple related
// types with a single import request.
ResourceType string
// State is the state of the remote object being imported. This may not be
// complete, but must contain enough information to uniquely identify the
// resource.
State cty.Value
// Private is an opaque blob that will be stored in state along with the
// resource. It is intended only for interpretation by the provider itself.
Private []byte
}
type ReadDataSourceRequest struct {
// TypeName is the name of the data source type to Read.
TypeName string