provider
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package provider contains all interfaces, request types, and responsetypes for a provider implementation.
In Terraform, a provider is a concept which enables provider developersto offer practitioners data sources and managed resources. Those conceptsare described in more detail in their respective datasource and resourcepackages.
Providers generally store any infrastructure clients or shared data that isapplicable across data sources and managed resources. Providers aregenerally configured early in Terraform operations, such as plan and apply,before data source and managed resource logic is called. However, this earlyprovider configuration is not guaranteed in the case there are unknownTerraform configuration values, so additional logic checks may be requiredthroughout an implementation to handle this case. Providers may contain aschema representing the structure and data types of Terraform-basedconfiguration.
The main starting point for implementations in this package is theProvider type which represents an instance of a provider that hasits own configuration.
Index¶
- type ConfigValidator
- type ConfigureProviderClientCapabilities
- type ConfigureRequest
- type ConfigureResponse
- type Deferred
- type DeferredReason
- type MetaSchemaRequest
- type MetaSchemaResponse
- type MetadataRequest
- type MetadataResponse
- type Provider
- type ProviderWithActions
- type ProviderWithConfigValidators
- type ProviderWithEphemeralResources
- type ProviderWithFunctions
- type ProviderWithListResources
- type ProviderWithMetaSchema
- type ProviderWithValidateConfig
- type SchemaRequest
- type SchemaResponse
- type ValidateConfigRequest
- type ValidateConfigResponse
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeConfigValidator¶
type ConfigValidator interface {// Description describes the validation in plain text formatting.//// This information may be automatically added to provider plain text// descriptions by external tooling.Description(context.Context)string// MarkdownDescription describes the validation in Markdown formatting.//// This information may be automatically added to provider Markdown// descriptions by external tooling.MarkdownDescription(context.Context)string// ValidateProvider performs the validation.//// This method name is separate from ConfigValidators in resource and other packages in// order to allow generic validators.ValidateProvider(context.Context,ValidateConfigRequest, *ValidateConfigResponse)}ConfigValidator describes reusable Provider configuration validation functionality.
typeConfigureProviderClientCapabilities¶added inv1.9.0
type ConfigureProviderClientCapabilities struct {// DeferralAllowed indicates whether the Terraform client initiating// the request allows a deferral response.//// NOTE: This functionality is related to deferred action support, which is currently experimental and is subject// to change or break without warning. It is not protected by version compatibility guarantees.DeferralAllowedbool}ConfigureProviderClientCapabilities allows Terraform to publish informationregarding optionally supported protocol features for the ConfigureProvider RPC,such as forward-compatible Terraform behavior changes.
typeConfigureRequest¶
type ConfigureRequest 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.TerraformVersionstring// 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.Configtfsdk.Config// ClientCapabilities defines optionally supported protocol features for the// ConfigureProvider RPC, such as forward-compatible Terraform behavior changes.ClientCapabilitiesConfigureProviderClientCapabilities}ConfigureRequest represents a request containing the values the userspecified for the provider configuration block, along with other runtimeinformation from Terraform or the Plugin SDK. An instance of this requeststruct is supplied as an argument to the provider's Configure function.
typeConfigureResponse¶
type ConfigureResponse struct {// DataSourceData is provider-defined data, clients, etc. that is passed// to [datasource.ConfigureRequest.ProviderData] for each DataSource type// that implements the Configure method.DataSourceDataany// Diagnostics report errors or warnings related to configuring the// provider. An empty slice indicates success, with no warnings or// errors generated.Diagnosticsdiag.Diagnostics// ResourceData is provider-defined data, clients, etc. that is passed// to [resource.ConfigureRequest.ProviderData] for each Resource type// that implements the Configure method.ResourceDataany// EphemeralResourceData is provider-defined data, clients, etc. that is// passed to [ephemeral.ConfigureRequest.ProviderData] for each// EphemeralResource type that implements the Configure method.EphemeralResourceDataany// ActionData is provider-defined data, clients, etc. that is// passed to [action.ConfigureRequest.ProviderData] for each// Action type that implements the Configure method.ActionDataany// ListResourceData is provider-defined data, clients, etc. that is// passed to [action.ConfigureRequest.ProviderData] for each// Action type that implements the Configure method.ListResourceDataany// Deferred indicates that Terraform should automatically defer// all resources and data sources for this provider.//// This field can only be set if// `(provider.ConfigureRequest).ClientCapabilities.DeferralAllowed` is true.//// NOTE: This functionality is related to deferred action support, which is currently experimental and is subject// to change or break without warning. It is not protected by version compatibility guarantees.Deferred *Deferred}ConfigureResponse represents a response to aConfigureRequest. An instance of this response struct is supplied asan argument to the provider's Configure function, in which the providershould set values on the ConfigureResponse as appropriate.
typeDeferred¶added inv1.9.0
type Deferred struct {// Reason is the reason for deferring the change.ReasonDeferredReason}Deferred is used to indicate to Terraform that a change needs to be deferred for a reason.
NOTE: This functionality is related to deferred action support, which is currently experimental and is subjectto change or break without warning. It is not protected by version compatibility guarantees.
typeDeferredReason¶added inv1.9.0
type DeferredReasonint32
DeferredReason represents different reasons for deferring a change.
NOTE: This functionality is related to deferred action support, which is currently experimental and is subjectto change or break without warning. It is not protected by version compatibility guarantees.
const (// DeferredReasonUnknown is used to indicate an invalid `DeferredReason`.// Provider developers should not use it.DeferredReasonUnknownDeferredReason = 0// DeferredReasonProviderConfigUnknown is used to indicate that the provider configuration// is partially unknown and the real values need to be known before the change can be planned.DeferredReasonProviderConfigUnknownDeferredReason = 2)
MAINTAINER NOTE: The deferred reason at enum value 1 in the plugin-protocolis not relevant for provider-level automatic deferred responses.provider.DeferredReason is directly mapped to the plugin-protocol which iswhy enum value 1 is skipped here
func (DeferredReason)String¶added inv1.9.0
func (dDeferredReason) String()string
typeMetaSchemaRequest¶added inv0.17.0
type MetaSchemaRequest struct{}MetaSchemaRequest represents a request for the Provider to return its schema.An instance of this request struct is supplied as an argument to theProvider type Schema method.
typeMetaSchemaResponse¶added inv0.17.0
type MetaSchemaResponse struct {// Schema is the meta schema of the provider.Schemametaschema.Schema// Diagnostics report errors or warnings related to validating the data// source configuration. An empty slice indicates success, with no warnings// or errors generated.Diagnosticsdiag.Diagnostics}MetaSchemaResponse represents a response to a MetaSchemaRequest. An instance of thisresponse struct is supplied as an argument to the Provider type Schemamethod.
typeMetadataRequest¶added inv0.12.0
type MetadataRequest struct{}MetadataRequest represents a request for the Provider to return its typename. An instance of this request struct is supplied as an argument to theProvider type Metadata method.
typeMetadataResponse¶added inv0.12.0
type MetadataResponse struct {// TypeName should be the provider type. For example, examplecloud, if// the intended resource or data source types are examplecloud_thing, etc.TypeNamestring// Version should be the provider version, such as 1.2.3.//// This is not connected to any framework functionality currently, but may// be in the future.Versionstring}MetadataResponse represents a response to a MetadataRequest. Aninstance of this response struct is supplied as an argument to theProvider type Metadata method.
typeProvider¶
type Provider interface {// Metadata should return the metadata for the provider, such as// a type name and version data.//// Implementing the MetadataResponse.TypeName will populate the// datasource.MetadataRequest.ProviderTypeName and// resource.MetadataRequest.ProviderTypeName fields automatically.Metadata(context.Context,MetadataRequest, *MetadataResponse)// Schema should return the schema for this provider.Schema(context.Context,SchemaRequest, *SchemaResponse)// 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,ConfigureRequest, *ConfigureResponse)// DataSources returns a slice of functions to instantiate each DataSource// implementation.//// The data source type name is determined by the DataSource implementing// the Metadata method. All data sources must have unique names.DataSources(context.Context) []func()datasource.DataSource// Resources returns a slice of functions to instantiate each Resource// implementation.//// The resource type name is determined by the Resource implementing// the Metadata method. All resources must have unique names.Resources(context.Context) []func()resource.Resource}Provider is the core interface that all Terraform providers must implement.
Providers can optionally implement these additional concepts:
- Validation: Schema-based or entire configurationvia ProviderWithConfigValidators or ProviderWithValidateConfig.
- Functions: ProviderWithFunctions
- Meta Schema: ProviderWithMetaSchema
typeProviderWithActions¶added inv1.16.0
type ProviderWithActions interface {Provider// Actions returns a slice of functions to instantiate each Action// implementation.//// The action type is determined by the Action implementing// the Metadata method. All action types must have unique names.Actions(context.Context) []func()action.Action}ProviderWithActions is an interface type that extends Provider toinclude actions for usage in practitioner configurations.
Actions are supported in Terraform version 1.14 and later.
typeProviderWithConfigValidators¶
type ProviderWithConfigValidators interface {Provider// ConfigValidators returns a list of functions which will all be performed during validation.ConfigValidators(context.Context) []ConfigValidator}ProviderWithConfigValidators is an interface type that extends Provider to include declarative validations.
Declaring validation using this methodology simplifies implementation ofreusable functionality. These also include descriptions, which can be usedfor automating documentation.
Validation will include ConfigValidators and ValidateConfig, if both areimplemented, in addition to any Attribute or Type validation.
typeProviderWithEphemeralResources¶added inv1.13.0
type ProviderWithEphemeralResources interface {Provider// EphemeralResources returns a slice of functions to instantiate each EphemeralResource// implementation.//// The ephemeral resource type name is determined by the EphemeralResource implementing// the Metadata method. All ephemeral resources must have unique names.EphemeralResources(context.Context) []func()ephemeral.EphemeralResource}ProviderWithEphemeralResources is an interface type that extends Provider toinclude ephemeral resources for usage in practitioner configurations.
Ephemeral resources are supported in Terraform version 1.10 and later.
typeProviderWithFunctions¶added inv1.5.0
type ProviderWithFunctions interface {Provider// Functions returns a slice of functions to instantiate each Function// implementation.//// The function name is determined by the Function implementing its Metadata// method. All functions must have unique names.Functions(context.Context) []func()function.Function}ProviderWithFunctions is an interface type that extends Provider toinclude provider defined functions for usage in practitioner configurations.
Provider-defined functions are supported in Terraform version 1.8 and later.
typeProviderWithListResources¶added inv1.16.0
type ProviderWithListResources interface {Provider// ListResources returns a slice of functions to instantiate each Resource// List implementation.//// The resource type name is determined by the ListResource implementing// the Metadata method. All ListResources must have unique names.ListResources(context.Context) []func()list.ListResource}typeProviderWithMetaSchema¶
type ProviderWithMetaSchema interface {Provider// MetaSchema should return the meta schema for this provider.//// This functionality is currently experimental and subject to change or// break without warning. It is not protected by version compatibility// guarantees.MetaSchema(context.Context,MetaSchemaRequest, *MetaSchemaResponse)}ProviderWithMetaSchema is a provider with a provider meta schema, whichis configured by practitioners via the provider_meta configuration blockand the configuration data is included with certain data source and resourceoperations. The intended use case is to enable Terraform module authorswithin the same organization of the provider to track module usage inrequests. Other use cases are explicitly not supported. All providerinstances (aliases) receive the same data.
This functionality is currently experimental and subject to change or breakwithout warning. It is not protected by version compatibility guarantees.
typeProviderWithValidateConfig¶
type ProviderWithValidateConfig interface {Provider// ValidateConfig performs the validation.ValidateConfig(context.Context,ValidateConfigRequest, *ValidateConfigResponse)}ProviderWithValidateConfig is an interface type that extends Provider to include imperative validation.
Declaring validation using this methodology simplifies one-offfunctionality that typically applies to a single provider. Any documentationof this functionality must be manually added into schema descriptions.
Validation will include ConfigValidators and ValidateConfig, if both areimplemented, in addition to any Attribute or Type validation.
typeSchemaRequest¶added inv0.17.0
type SchemaRequest struct{}SchemaRequest represents a request for the Provider to return its schema.An instance of this request struct is supplied as an argument to theProvider type Schema method.
typeSchemaResponse¶added inv0.17.0
type SchemaResponse struct {// Schema is the schema of the provider.Schemaschema.Schema// Diagnostics report errors or warnings related to validating the data// source configuration. An empty slice indicates success, with no warnings// or errors generated.Diagnosticsdiag.Diagnostics}SchemaResponse represents a response to a SchemaRequest. An instance of thisresponse struct is supplied as an argument to the Provider type Schemamethod.
typeValidateConfigRequest¶
type ValidateConfigRequest struct {// Config is the configuration the user supplied for the provider.//// 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.Configtfsdk.Config}ValidateConfigRequest represents a request to validate theconfiguration of a provider. An instance of this request struct issupplied as an argument to the Provider ValidateConfig receiver methodor automatically passed through to each ConfigValidator.
typeValidateConfigResponse¶
type ValidateConfigResponse struct {// Diagnostics report errors or warnings related to validating the provider// configuration. An empty slice indicates success, with no warnings or// errors generated.Diagnosticsdiag.Diagnostics}ValidateConfigResponse represents a response to aValidateConfigRequest. An instance of this response struct issupplied as an argument to the Provider ValidateConfig receiver methodor automatically passed through to each ConfigValidator.
Source Files¶
Directories¶
| Path | Synopsis |
|---|---|
Package metaschema contains all available meta schema functionality for providers. | Package metaschema contains all available meta schema functionality for providers. |
Package schema contains all available schema functionality for data sources. | Package schema contains all available schema functionality for data sources. |