Documentation
¶
Index ¶
- func NewProtocol6Server(p Provider) tfprotov6.ProviderServer
- func Serve(ctx context.Context, factory func() Provider, opts ServeOpts) error
- type Config
- type ConfigureProviderRequest
- type ConfigureProviderResponse
- func (r *ConfigureProviderResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *ConfigureProviderResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *ConfigureProviderResponse) AddError(summary, detail string)
- func (r *ConfigureProviderResponse) AddWarning(summary, detail string)
- type CreateResourceRequest
- type CreateResourceResponse
- func (r *CreateResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *CreateResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *CreateResourceResponse) AddError(summary, detail string)
- func (r *CreateResourceResponse) AddWarning(summary, detail string)
- type DataSource
- type DataSourceType
- type DeleteResourceRequest
- type DeleteResourceResponse
- func (r *DeleteResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *DeleteResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *DeleteResourceResponse) AddError(summary, detail string)
- func (r *DeleteResourceResponse) AddWarning(summary, detail string)
- type Plan
- func (p Plan) Get(ctx context.Context, target interface{}) error
- func (p Plan) GetAttribute(ctx context.Context, path *tftypes.AttributePath) (attr.Value, error)
- func (p *Plan) Set(ctx context.Context, val interface{}) error
- func (p *Plan) SetAttribute(ctx context.Context, path *tftypes.AttributePath, val interface{}) error
- type Provider
- type ProviderWithProviderMeta
- type ReadDataSourceRequest
- type ReadDataSourceResponse
- type ReadResourceRequest
- type ReadResourceResponse
- func (r *ReadResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *ReadResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *ReadResourceResponse) AddError(summary, detail string)
- func (r *ReadResourceResponse) AddWarning(summary, detail string)
- type Resource
- type ResourceType
- type ServeOpts
- type State
- func (s State) Get(ctx context.Context, target interface{}) error
- func (s State) GetAttribute(ctx context.Context, path *tftypes.AttributePath) (attr.Value, error)
- func (s *State) RemoveResource(ctx context.Context)
- func (s *State) Set(ctx context.Context, val interface{}) error
- func (s *State) SetAttribute(ctx context.Context, path *tftypes.AttributePath, val interface{}) error
- type UpdateResourceRequest
- type UpdateResourceResponse
- func (r *UpdateResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *UpdateResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
- func (r *UpdateResourceResponse) AddError(summary, detail string)
- func (r *UpdateResourceResponse) AddWarning(summary, detail string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProtocol6Server ¶ added in v0.2.0
func NewProtocol6Server(p Provider) tfprotov6.ProviderServer
NewProtocol6Server returns a tfprotov6.ProviderServer implementation based on the passed Provider implementation.
Types ¶
type Config ¶
Config represents a Terraform config.
func (Config) GetAttribute ¶
GetAttribute retrieves the attribute found at `path` and returns it as an attr.Value. Consumers should assert the type of the returned value with the desired attr.Type.
type ConfigureProviderRequest ¶
type ConfigureProviderRequest struct { // TerraformVersion is the version of Terraform executing the request. // This is supplied for logging, analytics, and User-Agent purposes // only. Providers should not try to gate provider behavior on // Terraform versions. TerraformVersion string // Config is the configuration the user supplied for the provider. This // information should usually be persisted to the underlying type // that's implementing the Provider interface, for use in later // resource CRUD operations. Config Config }
ConfigureProviderRequest represents a request containing the values the user specified for the provider configuration block, along with other runtime information from Terraform or the Plugin SDK. An instance of this request struct is supplied as an argument to the provider's Configure function.
type ConfigureProviderResponse ¶
type ConfigureProviderResponse struct { // Diagnostics report errors or warnings related to configuring the // provider. An empty slice indicates success, with no warnings or // errors generated. Diagnostics []*tfprotov6.Diagnostic }
ConfigureProviderResponse represents a response to a ConfigureProviderRequest. An instance of this response struct is supplied as an argument to the provider's Configure function, in which the provider should set values on the ConfigureProviderResponse as appropriate.
func (*ConfigureProviderResponse) AddAttributeError ¶
func (r *ConfigureProviderResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeError appends an error diagnostic to the response and labels it with a specific attribute.
func (*ConfigureProviderResponse) AddAttributeWarning ¶
func (r *ConfigureProviderResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeWarning appends a warning diagnostic to the response and labels it with a specific attribute.
func (*ConfigureProviderResponse) AddError ¶
func (r *ConfigureProviderResponse) AddError(summary, detail string)
AddError appends an error diagnostic to the response. If the error concerns a particular attribute, AddAttributeError should be used instead.
func (*ConfigureProviderResponse) AddWarning ¶
func (r *ConfigureProviderResponse) AddWarning(summary, detail string)
AddWarning appends a warning diagnostic to the response. If the warning concerns a particular attribute, AddAttributeWarning should be used instead.
type CreateResourceRequest ¶
type CreateResourceRequest struct { // Config is the configuration the user supplied for the resource. // // This configuration may contain unknown values if a user uses // interpolation or other functionality that would prevent Terraform // from knowing the value at request time. Config Config // Plan is the planned state for the resource. Plan Plan // ProviderMeta is metadata from the provider_meta block of the module. ProviderMeta Config }
CreateResourceRequest represents a request for the provider to create a resource. An instance of this request struct is supplied as an argument to the resource's Create function.
type CreateResourceResponse ¶
type CreateResourceResponse struct { // State is the state of the resource following the Create operation. // This field is pre-populated from CreateResourceRequest.Plan and // should be set during the resource's Create operation. State State // Diagnostics report errors or warnings related to creating the // resource. An empty slice indicates a successful operation with no // warnings or errors generated. Diagnostics []*tfprotov6.Diagnostic }
CreateResourceResponse represents a response to a CreateResourceRequest. An instance of this response struct is supplied as an argument to the resource's Create function, in which the provider should set values on the CreateResourceResponse as appropriate.
func (*CreateResourceResponse) AddAttributeError ¶
func (r *CreateResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeError appends an error diagnostic to the response and labels it with a specific attribute.
func (*CreateResourceResponse) AddAttributeWarning ¶
func (r *CreateResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeWarning appends a warning diagnostic to the response and labels it with a specific attribute.
func (*CreateResourceResponse) AddError ¶
func (r *CreateResourceResponse) AddError(summary, detail string)
AddError appends an error diagnostic to the response. If the error concerns a particular attribute, AddAttributeError should be used instead.
func (*CreateResourceResponse) AddWarning ¶
func (r *CreateResourceResponse) AddWarning(summary, detail string)
AddWarning appends a warning diagnostic to the response. If the warning concerns a particular attribute, AddAttributeWarning should be used instead.
type DataSource ¶
type DataSource interface { // Read is called when the provider must read data source values in // order to update state. Config values should be read from the // ReadDataSourceRequest and new state values set on the // ReadDataSourceResponse. Read(context.Context, ReadDataSourceRequest, *ReadDataSourceResponse) }
DataSource implements a data source instance.
type DataSourceType ¶
type DataSourceType interface { // GetSchema returns the schema for this data source. GetSchema(context.Context) (schema.Schema, []*tfprotov6.Diagnostic) // NewDataSource instantiates a new DataSource of this DataSourceType. NewDataSource(context.Context, Provider) (DataSource, []*tfprotov6.Diagnostic) }
A DataSourceType is a type of data source. For each type of data source this provider supports, it should define a type implementing DataSourceType and return an instance of it in the map returned by Provider.GetDataSources.
type DeleteResourceRequest ¶
type DeleteResourceRequest struct { // State is the current state of the resource prior to the Delete // operation. State State // ProviderMeta is metadata from the provider_meta block of the module. ProviderMeta Config }
DeleteResourceRequest represents a request for the provider to delete a resource. An instance of this request struct is supplied as an argument to the resource's Delete function.
type DeleteResourceResponse ¶
type DeleteResourceResponse struct { // State is the state of the resource following the Delete operation. // This field is pre-populated from UpdateResourceRequest.Plan and // should be set during the resource's Update operation. State State // Diagnostics report errors or warnings related to deleting the // resource. An empty slice indicates a successful operation with no // warnings or errors generated. Diagnostics []*tfprotov6.Diagnostic }
DeleteResourceResponse represents a response to a DeleteResourceRequest. An instance of this response struct is supplied as an argument to the resource's Delete function, in which the provider should set values on the DeleteResourceResponse as appropriate.
func (*DeleteResourceResponse) AddAttributeError ¶
func (r *DeleteResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeError appends an error diagnostic to the response and labels it with a specific attribute.
func (*DeleteResourceResponse) AddAttributeWarning ¶
func (r *DeleteResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeWarning appends a warning diagnostic to the response and labels it with a specific attribute.
func (*DeleteResourceResponse) AddError ¶
func (r *DeleteResourceResponse) AddError(summary, detail string)
AddError appends an error diagnostic to the response. If the error concerns a particular attribute, AddAttributeError should be used instead.
func (*DeleteResourceResponse) AddWarning ¶
func (r *DeleteResourceResponse) AddWarning(summary, detail string)
AddWarning appends a warning diagnostic to the response. If the warning concerns a particular attribute, AddAttributeWarning should be used instead.
type Plan ¶
Plan represents a Terraform plan.
func (Plan) GetAttribute ¶
GetAttribute retrieves the attribute found at `path` and returns it as an attr.Value. Consumers should assert the type of the returned value with the desired attr.Type.
func (*Plan) Set ¶
Set populates the entire plan using the supplied Go value. The value `val` should be a struct whose values have one of the attr.Value types. Each field must be tagged with the corresponding schema field.
func (*Plan) SetAttribute ¶
func (p *Plan) SetAttribute(ctx context.Context, path *tftypes.AttributePath, val interface{}) error
SetAttribute sets the attribute at `path` using the supplied Go value.
type Provider ¶
type Provider interface { // GetSchema returns the schema for this provider's configuration. If // this provider has no configuration, return an empty schema.Schema. GetSchema(context.Context) (schema.Schema, []*tfprotov6.Diagnostic) // Configure is called at the beginning of the provider lifecycle, when // Terraform sends to the provider the values the user specified in the // provider configuration block. These are supplied in the // ConfigureProviderRequest argument. // Values from provider configuration are often used to initialise an // API client, which should be stored on the struct implementing the // Provider interface. Configure(context.Context, ConfigureProviderRequest, *ConfigureProviderResponse) // GetResources returns a map of the resource types this provider // supports. GetResources(context.Context) (map[string]ResourceType, []*tfprotov6.Diagnostic) // GetDataSources returns a map of the data source types this provider // supports. GetDataSources(context.Context) (map[string]DataSourceType, []*tfprotov6.Diagnostic) }
Provider is the core interface that all Terraform providers must implement.
type ProviderWithProviderMeta ¶
type ProviderWithProviderMeta interface { Provider // GetMetaSchema returns the provider meta schema. GetMetaSchema(context.Context) (schema.Schema, []*tfprotov6.Diagnostic) }
ProviderWithProviderMeta is a provider with a provider meta schema. This functionality is currently experimental and subject to change or break without warning; it should only be used by providers that are collaborating on its use with the Terraform team.
type ReadDataSourceRequest ¶
type ReadDataSourceRequest struct { // Config is the configuration the user supplied for the data source. // // This configuration may contain unknown values if a user uses // interpolation or other functionality that would prevent Terraform // from knowing the value at request time. Config Config // ProviderMeta is metadata from the provider_meta block of the module. ProviderMeta Config }
ReadDataSourceRequest represents a request for the provider to read a data source, i.e., update values in state according to the real state of the data source. An instance of this request struct is supplied as an argument to the data source's Read function.
type ReadDataSourceResponse ¶
type ReadDataSourceResponse struct { // State is the state of the data source following the Read operation. // This field should be set during the resource's Read operation. State State // Diagnostics report errors or warnings related to reading the data // source. An empty slice indicates a successful operation with no // warnings or errors generated. Diagnostics []*tfprotov6.Diagnostic }
ReadDataSourceResponse represents a response to a ReadDataSourceRequest. An instance of this response struct is supplied as an argument to the data source's Read function, in which the provider should set values on the ReadDataSourceResponse as appropriate.
type ReadResourceRequest ¶
type ReadResourceRequest struct { // State is the current state of the resource prior to the Read // operation. State State // ProviderMeta is metadata from the provider_meta block of the module. ProviderMeta Config }
ReadResourceRequest represents a request for the provider to read a resource, i.e., update values in state according to the real state of the resource. An instance of this request struct is supplied as an argument to the resource's Read function.
type ReadResourceResponse ¶
type ReadResourceResponse struct { // State is the state of the resource following the Read operation. // This field is pre-populated from ReadResourceRequest.State and // should be set during the resource's Read operation. State State // Diagnostics report errors or warnings related to reading the // resource. An empty slice indicates a successful operation with no // warnings or errors generated. Diagnostics []*tfprotov6.Diagnostic }
ReadResourceResponse represents a response to a ReadResourceRequest. An instance of this response struct is supplied as an argument to the resource's Read function, in which the provider should set values on the ReadResourceResponse as appropriate.
func (*ReadResourceResponse) AddAttributeError ¶
func (r *ReadResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeError appends an error diagnostic to the response and labels it with a specific attribute.
func (*ReadResourceResponse) AddAttributeWarning ¶
func (r *ReadResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeWarning appends a warning diagnostic to the response and labels it with a specific attribute.
func (*ReadResourceResponse) AddError ¶
func (r *ReadResourceResponse) AddError(summary, detail string)
AddError appends an error diagnostic to the response. If the error concerns a particular attribute, AddAttributeError should be used instead.
func (*ReadResourceResponse) AddWarning ¶
func (r *ReadResourceResponse) AddWarning(summary, detail string)
AddWarning appends a warning diagnostic to the response. If the warning concerns a particular attribute, AddAttributeWarning should be used instead.
type Resource ¶
type Resource interface { // Create is called when the provider must create a new resource. Config // and planned state values should be read from the // CreateResourceRequest and new state values set on the // CreateResourceResponse. Create(context.Context, CreateResourceRequest, *CreateResourceResponse) // Read is called when the provider must read resource values in order // to update state. Planned state values should be read from the // ReadResourceRequest and new state values set on the // ReadResourceResponse. Read(context.Context, ReadResourceRequest, *ReadResourceResponse) // Update is called to update the state of the resource. Config, planned // state, and prior state values should be read from the // UpdateResourceRequest and new state values set on the // UpdateResourceResponse. Update(context.Context, UpdateResourceRequest, *UpdateResourceResponse) // Delete is called when the provider must delete the resource. Config // values may be read from the DeleteResourceRequest. Delete(context.Context, DeleteResourceRequest, *DeleteResourceResponse) }
Resource represents a resource instance. This is the core interface that all resources must implement.
type ResourceType ¶
type ResourceType interface { // GetSchema returns the schema for this resource. GetSchema(context.Context) (schema.Schema, []*tfprotov6.Diagnostic) // NewResource instantiates a new Resource of this ResourceType. NewResource(context.Context, Provider) (Resource, []*tfprotov6.Diagnostic) }
A ResourceType is a type of resource. For each type of resource this provider supports, it should define a type implementing ResourceType and return an instance of it in the map returned by Provider.GeResources.
type ServeOpts ¶
type ServeOpts struct { // Name is the name of the provider, in full address form. For example: // registry.terraform.io/hashicorp/random. Name string }
ServeOpts are options for serving the provider.
type State ¶
State represents a Terraform state.
func (State) GetAttribute ¶
GetAttribute retrieves the attribute found at `path` and returns it as an attr.Value. Consumers should assert the type of the returned value with the desired attr.Type.
func (*State) RemoveResource ¶
RemoveResource removes the entire resource from state.
func (*State) Set ¶
Set populates the entire state using the supplied Go value. The value `val` should be a struct whose values have one of the attr.Value types. Each field must be tagged with the corresponding schema field.
func (*State) SetAttribute ¶
func (s *State) SetAttribute(ctx context.Context, path *tftypes.AttributePath, val interface{}) error
SetAttribute sets the attribute at `path` using the supplied Go value.
type UpdateResourceRequest ¶
type UpdateResourceRequest struct { // Config is the configuration the user supplied for the resource. // // This configuration may contain unknown values if a user uses // interpolation or other functionality that would prevent Terraform // from knowing the value at request time. Config Config // Plan is the planned state for the resource. Plan Plan // State is the current state of the resource prior to the Update // operation. State State // ProviderMeta is metadata from the provider_meta block of the module. ProviderMeta Config }
UpdateResourceRequest represents a request for the provider to update a resource. An instance of this request struct is supplied as an argument to the resource's Update function.
type UpdateResourceResponse ¶
type UpdateResourceResponse struct { // State is the state of the resource following the Update operation. // This field is pre-populated from UpdateResourceRequest.Plan and // should be set during the resource's Update operation. State State // Diagnostics report errors or warnings related to updating the // resource. An empty slice indicates a successful operation with no // warnings or errors generated. Diagnostics []*tfprotov6.Diagnostic }
UpdateResourceResponse represents a response to an UpdateResourceRequest. An instance of this response struct is supplied as an argument to the resource's Update function, in which the provider should set values on the UpdateResourceResponse as appropriate.
func (*UpdateResourceResponse) AddAttributeError ¶
func (r *UpdateResourceResponse) AddAttributeError(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeError appends an error diagnostic to the response and labels it with a specific attribute.
func (*UpdateResourceResponse) AddAttributeWarning ¶
func (r *UpdateResourceResponse) AddAttributeWarning(attributePath *tftypes.AttributePath, summary, detail string)
AddAttributeWarning appends a warning diagnostic to the response and labels it with a specific attribute.
func (*UpdateResourceResponse) AddError ¶
func (r *UpdateResourceResponse) AddError(summary, detail string)
AddError appends an error diagnostic to the response. If the error concerns a particular attribute, AddAttributeError should be used instead.
func (*UpdateResourceResponse) AddWarning ¶
func (r *UpdateResourceResponse) AddWarning(summary, detail string)
AddWarning appends a warning diagnostic to the response. If the warning concerns a particular attribute, AddAttributeWarning should be used instead.