2023-05-02 10:33:06 -05:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2018-06-21 13:31:48 -05:00
|
|
|
package providers
|
2018-06-20 16:39:50 -05:00
|
|
|
|
|
|
|
import (
|
2018-08-24 18:13:50 -05:00
|
|
|
"github.com/zclconf/go-cty/cty"
|
|
|
|
|
2021-05-17 14:43:35 -05:00
|
|
|
"github.com/hashicorp/terraform/internal/states"
|
2021-05-17 12:11:06 -05:00
|
|
|
"github.com/hashicorp/terraform/internal/tfdiags"
|
2018-06-20 16:39:50 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// Interface represents the set of methods required for a complete resource
|
|
|
|
// provider plugin.
|
|
|
|
type Interface interface {
|
|
|
|
// GetSchema returns the complete schema for the provider.
|
2021-02-18 09:13:43 -06:00
|
|
|
GetProviderSchema() GetProviderSchemaResponse
|
2018-06-20 16:39:50 -05:00
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
// ValidateProviderConfig allows the provider to validate the configuration.
|
|
|
|
// The ValidateProviderConfigResponse.PreparedConfig field is unused. The
|
2020-11-04 12:02:04 -06:00
|
|
|
// final configuration is not stored in the state, and any modifications
|
|
|
|
// that need to be made must be made during the Configure method call.
|
2021-02-18 09:13:43 -06:00
|
|
|
ValidateProviderConfig(ValidateProviderConfigRequest) ValidateProviderConfigResponse
|
2018-06-20 16:39:50 -05:00
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
// ValidateResourceConfig allows the provider to validate the resource
|
2018-06-20 16:39:50 -05:00
|
|
|
// configuration values.
|
2021-02-18 09:13:43 -06:00
|
|
|
ValidateResourceConfig(ValidateResourceConfigRequest) ValidateResourceConfigResponse
|
2018-06-20 16:39:50 -05:00
|
|
|
|
2021-02-24 11:04:28 -06:00
|
|
|
// ValidateDataResourceConfig allows the provider to validate the data source
|
2018-06-20 16:39:50 -05:00
|
|
|
// configuration values.
|
2021-02-24 11:04:28 -06:00
|
|
|
ValidateDataResourceConfig(ValidateDataResourceConfigRequest) ValidateDataResourceConfigResponse
|
2018-06-20 16:39:50 -05:00
|
|
|
|
|
|
|
// UpgradeResourceState is called when the state loader encounters an
|
|
|
|
// instance state whose schema version is less than the one reported by the
|
|
|
|
// currently-used version of the corresponding provider, and the upgraded
|
|
|
|
// result is used for any further processing.
|
|
|
|
UpgradeResourceState(UpgradeResourceStateRequest) UpgradeResourceStateResponse
|
|
|
|
|
|
|
|
// Configure configures and initialized the provider.
|
2021-02-18 09:13:43 -06:00
|
|
|
ConfigureProvider(ConfigureProviderRequest) ConfigureProviderResponse
|
2018-06-20 16:39:50 -05:00
|
|
|
|
|
|
|
// Stop is called when the provider should halt any in-flight actions.
|
|
|
|
//
|
|
|
|
// Stop should not block waiting for in-flight actions to complete. It
|
|
|
|
// should take any action it wants and return immediately acknowledging it
|
|
|
|
// has received the stop request. Terraform will not make any further API
|
|
|
|
// calls to the provider after Stop is called.
|
|
|
|
//
|
|
|
|
// The error returned, if non-nil, is assumed to mean that signaling the
|
|
|
|
// stop somehow failed and that the user should expect potentially waiting
|
|
|
|
// a longer period of time.
|
|
|
|
Stop() error
|
|
|
|
|
|
|
|
// ReadResource refreshes a resource and returns its current state.
|
|
|
|
ReadResource(ReadResourceRequest) ReadResourceResponse
|
|
|
|
|
|
|
|
// PlanResourceChange takes the current state and proposed state of a
|
|
|
|
// resource, and returns the planned final state.
|
|
|
|
PlanResourceChange(PlanResourceChangeRequest) PlanResourceChangeResponse
|
|
|
|
|
|
|
|
// ApplyResourceChange takes the planned state for a resource, which may
|
|
|
|
// yet contain unknown computed values, and applies the changes returning
|
|
|
|
// the final state.
|
|
|
|
ApplyResourceChange(ApplyResourceChangeRequest) ApplyResourceChangeResponse
|
|
|
|
|
|
|
|
// ImportResourceState requests that the given resource be imported.
|
|
|
|
ImportResourceState(ImportResourceStateRequest) ImportResourceStateResponse
|
|
|
|
|
|
|
|
// ReadDataSource returns the data source's current state.
|
|
|
|
ReadDataSource(ReadDataSourceRequest) ReadDataSourceResponse
|
2018-08-15 12:21:25 -05:00
|
|
|
|
|
|
|
// Close shuts down the plugin process if applicable.
|
|
|
|
Close() error
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
2023-07-03 11:37:50 -05:00
|
|
|
// All access to a provider's schema internally should bt through the Schemas
|
|
|
|
// type.
|
|
|
|
// TODO: Acccess to schemas was split over two types with slightly different
|
|
|
|
// structures in different parts of the code. These types need to be unified
|
|
|
|
// for easier and more consistent access, but there is however a large amount
|
|
|
|
// of code which directly uses this structure, so it is not easily refactored
|
|
|
|
// out.
|
2021-02-18 09:13:43 -06:00
|
|
|
type GetProviderSchemaResponse struct {
|
2018-06-20 16:39:50 -05:00
|
|
|
// Provider is the schema for the provider itself.
|
2018-06-21 13:59:18 -05:00
|
|
|
Provider Schema
|
2018-06-20 16:39:50 -05:00
|
|
|
|
2020-03-05 18:53:24 -06:00
|
|
|
// ProviderMeta is the schema for the provider's meta info in a module
|
|
|
|
ProviderMeta Schema
|
|
|
|
|
2018-06-20 16:39:50 -05:00
|
|
|
// ResourceTypes map the resource type name to that type's schema.
|
2018-06-21 13:59:18 -05:00
|
|
|
ResourceTypes map[string]Schema
|
2018-06-20 16:39:50 -05:00
|
|
|
|
|
|
|
// DataSources maps the data source name to that data source's schema.
|
2018-06-21 13:59:18 -05:00
|
|
|
DataSources map[string]Schema
|
2018-06-20 16:39:50 -05:00
|
|
|
|
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
2022-06-02 17:03:35 -05:00
|
|
|
|
2022-07-06 12:47:30 -05:00
|
|
|
// ServerCapabilities lists optional features supported by the provider.
|
|
|
|
ServerCapabilities ServerCapabilities
|
2022-06-02 17:03:35 -05:00
|
|
|
}
|
|
|
|
|
2022-07-06 12:47:30 -05:00
|
|
|
// 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.
|
|
|
|
type ServerCapabilities struct {
|
2022-06-02 17:03:35 -05:00
|
|
|
// PlanDestroy signals that this provider expects to receive a
|
|
|
|
// PlanResourceChange call for resources that are to be destroyed.
|
|
|
|
PlanDestroy bool
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
type ValidateProviderConfigRequest struct {
|
2018-10-17 20:21:41 -05:00
|
|
|
// Config is the raw configuration value for the provider.
|
2018-06-20 16:39:50 -05:00
|
|
|
Config cty.Value
|
|
|
|
}
|
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
type ValidateProviderConfigResponse struct {
|
|
|
|
// PreparedConfig is unused and will be removed with support for plugin protocol v5.
|
2018-10-17 20:21:41 -05:00
|
|
|
PreparedConfig cty.Value
|
2018-06-20 16:39:50 -05:00
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
|
|
|
}
|
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
type ValidateResourceConfigRequest struct {
|
2018-06-20 16:39:50 -05:00
|
|
|
// TypeName is the name of the resource type to validate.
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// Config is the configuration value to validate, which may contain unknown
|
|
|
|
// values.
|
|
|
|
Config cty.Value
|
|
|
|
}
|
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
type ValidateResourceConfigResponse struct {
|
2018-06-20 16:39:50 -05:00
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
|
|
|
}
|
|
|
|
|
2021-02-24 11:04:28 -06:00
|
|
|
type ValidateDataResourceConfigRequest struct {
|
2018-06-20 16:39:50 -05:00
|
|
|
// TypeName is the name of the data source type to validate.
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// Config is the configuration value to validate, which may contain unknown
|
|
|
|
// values.
|
|
|
|
Config cty.Value
|
|
|
|
}
|
|
|
|
|
2021-02-24 11:04:28 -06:00
|
|
|
type ValidateDataResourceConfigResponse struct {
|
2018-06-20 16:39:50 -05:00
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
|
|
|
}
|
|
|
|
|
|
|
|
type UpgradeResourceStateRequest struct {
|
|
|
|
// TypeName is the name of the resource type being upgraded
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// Version is version of the schema that created the current state.
|
2018-11-29 18:53:36 -06:00
|
|
|
Version int64
|
2018-06-20 16:39:50 -05:00
|
|
|
|
2018-06-21 14:01:47 -05:00
|
|
|
// RawStateJSON and RawStateFlatmap contiain the state that needs to be
|
|
|
|
// upgraded to match the current schema version. Because the schema is
|
|
|
|
// unknown, this contains only the raw data as stored in the state.
|
|
|
|
// RawStateJSON is the current json state encoding.
|
|
|
|
// RawStateFlatmap is the legacy flatmap encoding.
|
|
|
|
// Only on of these fields may be set for the upgrade request.
|
|
|
|
RawStateJSON []byte
|
|
|
|
RawStateFlatmap map[string]string
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type UpgradeResourceStateResponse struct {
|
2018-06-21 14:03:26 -05:00
|
|
|
// UpgradedState is the newly upgraded resource state.
|
|
|
|
UpgradedState cty.Value
|
2018-06-20 16:39:50 -05:00
|
|
|
|
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
|
|
|
}
|
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
type ConfigureProviderRequest struct {
|
2018-08-08 16:01:01 -05:00
|
|
|
// Terraform version is the version string from the running instance of
|
|
|
|
// terraform. Providers can use TerraformVersion to verify compatibility,
|
|
|
|
// and to store for informational purposes.
|
|
|
|
TerraformVersion string
|
|
|
|
|
2018-06-20 16:39:50 -05:00
|
|
|
// Config is the complete configuration value for the provider.
|
|
|
|
Config cty.Value
|
|
|
|
}
|
|
|
|
|
2021-02-18 09:13:43 -06:00
|
|
|
type ConfigureProviderResponse struct {
|
2018-06-20 16:39:50 -05:00
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
|
|
|
}
|
|
|
|
|
|
|
|
type ReadResourceRequest struct {
|
|
|
|
// TypeName is the name of the resource type being read.
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// PriorState contains the previously saved state value for this resource.
|
|
|
|
PriorState cty.Value
|
2019-06-03 17:08:26 -05:00
|
|
|
|
|
|
|
// 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
|
2020-03-05 18:53:24 -06:00
|
|
|
|
|
|
|
// ProviderMeta is the configuration for the provider_meta block for the
|
|
|
|
// module and provider this resource belongs to. Its use is defined by
|
|
|
|
// each provider, and it should not be used without coordination with
|
|
|
|
// HashiCorp. It is considered experimental and subject to change.
|
|
|
|
ProviderMeta cty.Value
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type ReadResourceResponse struct {
|
|
|
|
// NewState contains the current state of the resource.
|
|
|
|
NewState cty.Value
|
|
|
|
|
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
2019-06-03 17:08:26 -05:00
|
|
|
|
|
|
|
// 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
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type PlanResourceChangeRequest struct {
|
|
|
|
// TypeName is the name of the resource type to plan.
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// PriorState is the previously saved state value for this resource.
|
|
|
|
PriorState cty.Value
|
|
|
|
|
|
|
|
// ProposedNewState is the expected state after the new configuration is
|
|
|
|
// applied. This is created by directly applying the configuration to the
|
|
|
|
// PriorState. The provider is then responsible for applying any further
|
|
|
|
// changes required to create the proposed final state.
|
|
|
|
ProposedNewState cty.Value
|
|
|
|
|
2018-07-17 20:07:34 -05:00
|
|
|
// Config is the resource configuration, before being merged with the
|
|
|
|
// PriorState. Any value not explicitly set in the configuration will be
|
|
|
|
// null. Config is supplied for reference, but Provider implementations
|
|
|
|
// should prefer the ProposedNewState in most circumstances.
|
|
|
|
Config cty.Value
|
|
|
|
|
2018-06-20 16:39:50 -05:00
|
|
|
// PriorPrivate is the previously saved private data returned from the
|
|
|
|
// provider during the last apply.
|
|
|
|
PriorPrivate []byte
|
2020-03-05 18:53:24 -06:00
|
|
|
|
|
|
|
// ProviderMeta is the configuration for the provider_meta block for the
|
|
|
|
// module and provider this resource belongs to. Its use is defined by
|
|
|
|
// each provider, and it should not be used without coordination with
|
|
|
|
// HashiCorp. It is considered experimental and subject to change.
|
|
|
|
ProviderMeta cty.Value
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type PlanResourceChangeResponse struct {
|
|
|
|
// PlannedState is the expected state of the resource once the current
|
|
|
|
// configuration is applied.
|
|
|
|
PlannedState cty.Value
|
|
|
|
|
Store sensitive attribute paths in state (#26338)
* Add creation test and simplify in-place test
* Add deletion test
* Start adding marking from state
Start storing paths that should be marked
when pulled out of state. Implements deep
copy for attr paths. This commit also includes some
comment noise from investigations, and fixing the diff test
* Fix apply stripping marks
* Expand diff tests
* Basic apply test
* Update comments on equality checks to clarify current understanding
* Add JSON serialization for sensitive paths
We need to serialize a slice of cty.Path values to be used to re-mark
the sensitive values of a resource instance when loading the state file.
Paths consist of a list of steps, each of which may be either getting an
attribute value by name, or indexing into a collection by string or
number.
To serialize these without building a complex parser for a compact
string form, we render a nested array of small objects, like so:
[
[
{ type: "get_attr", value: "foo" },
{ type: "index", value: { "type": "number", "value": 2 } }
]
]
The above example is equivalent to a path `foo[2]`.
* Format diffs with map types
Comparisons need unmarked values to operate on,
so create unmarked values for those operations. Additionally,
change diff to cover map types
* Remove debugging printing
* Fix bug with marking non-sensitive values
When pulling a sensitive value from state,
we were previously using those marks to remark
the planned new value, but that new value
might *not* be sensitive, so let's not do that
* Fix apply test
Apply was not passing the second state
through to the third pass at apply
* Consistency in checking for length of paths vs inspecting into value
* In apply, don't mark with before paths
* AttrPaths test coverage for DeepCopy
* Revert format changes
Reverts format changes in format/diff for this
branch so those changes can be discussed on a separate PR
* Refactor name of AttrPaths to AttrSensitivePaths
* Rename AttributePaths/attributePaths for naming consistency
Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2020-09-24 11:40:17 -05:00
|
|
|
// RequiresReplace is the list of the attributes that are requiring
|
2018-06-20 16:39:50 -05:00
|
|
|
// resource replacement.
|
|
|
|
RequiresReplace []cty.Path
|
|
|
|
|
|
|
|
// PlannedPrivate is an opaque blob that is not interpreted by terraform
|
|
|
|
// core. This will be saved and relayed back to the provider during
|
|
|
|
// ApplyResourceChange.
|
|
|
|
PlannedPrivate []byte
|
|
|
|
|
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
2019-02-08 22:32:44 -06:00
|
|
|
|
|
|
|
// LegacyTypeSystem is set only if the provider is using the legacy SDK
|
|
|
|
// whose type system cannot be precisely mapped into the Terraform type
|
|
|
|
// system. We use this to bypass certain consistency checks that would
|
|
|
|
// otherwise fail due to this imprecise mapping. No other provider or SDK
|
|
|
|
// implementation is permitted to set this.
|
|
|
|
LegacyTypeSystem bool
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type ApplyResourceChangeRequest struct {
|
|
|
|
// TypeName is the name of the resource type being applied.
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// PriorState is the current state of resource.
|
|
|
|
PriorState cty.Value
|
|
|
|
|
|
|
|
// Planned state is the state returned from PlanResourceChange, and should
|
|
|
|
// represent the new state, minus any remaining computed attributes.
|
|
|
|
PlannedState cty.Value
|
|
|
|
|
2018-07-25 16:49:04 -05:00
|
|
|
// Config is the resource configuration, before being merged with the
|
|
|
|
// PriorState. Any value not explicitly set in the configuration will be
|
|
|
|
// null. Config is supplied for reference, but Provider implementations
|
|
|
|
// should prefer the PlannedState in most circumstances.
|
|
|
|
Config cty.Value
|
|
|
|
|
2018-06-20 16:39:50 -05:00
|
|
|
// PlannedPrivate is the same value as returned by PlanResourceChange.
|
|
|
|
PlannedPrivate []byte
|
2020-03-05 18:53:24 -06:00
|
|
|
|
|
|
|
// ProviderMeta is the configuration for the provider_meta block for the
|
|
|
|
// module and provider this resource belongs to. Its use is defined by
|
|
|
|
// each provider, and it should not be used without coordination with
|
|
|
|
// HashiCorp. It is considered experimental and subject to change.
|
|
|
|
ProviderMeta cty.Value
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type ApplyResourceChangeResponse struct {
|
|
|
|
// NewState is the new complete state after applying the planned change.
|
|
|
|
// In the event of an error, NewState should represent the most recent
|
|
|
|
// known state of the resource, if it exists.
|
|
|
|
NewState 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
|
|
|
|
|
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
2019-02-05 16:28:58 -06:00
|
|
|
|
|
|
|
// LegacyTypeSystem is set only if the provider is using the legacy SDK
|
|
|
|
// whose type system cannot be precisely mapped into the Terraform type
|
|
|
|
// system. We use this to bypass certain consistency checks that would
|
|
|
|
// otherwise fail due to this imprecise mapping. No other provider or SDK
|
|
|
|
// implementation is permitted to set this.
|
|
|
|
LegacyTypeSystem bool
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type ImportResourceStateRequest struct {
|
|
|
|
// TypeName is the name of the resource type to be imported.
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// ID is a string with which the provider can identify the resource to be
|
|
|
|
// imported.
|
|
|
|
ID string
|
|
|
|
}
|
|
|
|
|
|
|
|
type ImportResourceStateResponse struct {
|
2018-06-21 14:04:59 -05:00
|
|
|
// 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
|
2018-06-20 16:39:50 -05:00
|
|
|
|
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
|
|
|
}
|
|
|
|
|
2018-06-21 14:04:59 -05:00
|
|
|
// 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 {
|
2018-08-08 16:01:01 -05:00
|
|
|
// TypeName is the name of the resource type associated with the
|
2018-06-21 14:04:59 -05:00
|
|
|
// returned state. It's possible for providers to import multiple related
|
|
|
|
// types with a single import request.
|
2018-08-08 16:01:01 -05:00
|
|
|
TypeName string
|
2018-06-21 14:04:59 -05:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2018-08-24 18:13:50 -05:00
|
|
|
// AsInstanceObject converts the receiving ImportedObject into a
|
|
|
|
// ResourceInstanceObject that has status ObjectReady.
|
|
|
|
//
|
|
|
|
// The returned object does not know its own resource type, so the caller must
|
|
|
|
// retain the ResourceType value from the source object if this information is
|
|
|
|
// needed.
|
|
|
|
//
|
|
|
|
// The returned object also has no dependency addresses, but the caller may
|
|
|
|
// freely modify the direct fields of the returned object without affecting
|
|
|
|
// the receiver.
|
|
|
|
func (ir ImportedResource) AsInstanceObject() *states.ResourceInstanceObject {
|
|
|
|
return &states.ResourceInstanceObject{
|
|
|
|
Status: states.ObjectReady,
|
|
|
|
Value: ir.State,
|
|
|
|
Private: ir.Private,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-20 16:39:50 -05:00
|
|
|
type ReadDataSourceRequest struct {
|
|
|
|
// TypeName is the name of the data source type to Read.
|
|
|
|
TypeName string
|
|
|
|
|
|
|
|
// Config is the complete configuration for the requested data source.
|
|
|
|
Config cty.Value
|
2020-03-05 18:53:24 -06:00
|
|
|
|
|
|
|
// ProviderMeta is the configuration for the provider_meta block for the
|
|
|
|
// module and provider this resource belongs to. Its use is defined by
|
|
|
|
// each provider, and it should not be used without coordination with
|
|
|
|
// HashiCorp. It is considered experimental and subject to change.
|
|
|
|
ProviderMeta cty.Value
|
2018-06-20 16:39:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type ReadDataSourceResponse struct {
|
|
|
|
// State is the current state of the requested data source.
|
|
|
|
State cty.Value
|
|
|
|
|
|
|
|
// Diagnostics contains any warnings or errors from the method call.
|
|
|
|
Diagnostics tfdiags.Diagnostics
|
|
|
|
}
|