New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: ResourceProvider.GetSchema method #16352

Merged
merged 1 commit into from Oct 17, 2017

Conversation

Projects
None yet
2 participants
@apparentlymart
Contributor

apparentlymart commented Oct 14, 2017

In order to parse provider, resource and data source configuration from HCL2 config files, we need to know the relevant configuration schema. This new method allows Terraform Core to request these from a provider.

This is a breaking change to this interface, so all of its implementers in this package are updated too. This includes concrete implementations of the new method in helper/schema that use the schema conversion code added in an earlier commit to produce a configschema.Block automatically.

Plugins compiled against prior versions of helper/schema will not have support for this method, and so calls to them will fail. Callers of this new method will therefore need to sniff for support using the SchemaAvailable field added to both ResourceType and DataSource.

This careful handling will need to persist until next time we increment the plugin protocol version, at which point we can make the breaking change of requiring this information to be available.

core: terraform.ResourceProvider.GetSchema method
In order to parse provider, resource and data source configuration from
HCL2 config files, we need to know the relevant configuration schema.
This new method allows Terraform Core to request these from a provider.

This is a breaking change to this interface, so all of its implementers
in this package are updated too. This includes concrete implementations
of the new method in helper/schema that use the schema conversion code
added in an earlier commit to produce a configschema.Block automatically.

Plugins compiled against prior versions of helper/schema will not have
support for this method, and so calls to them will fail. Callers of
this new method will therefore need to sniff for support using the
SchemaAvailable field added to both ResourceType and DataSource.

This careful handling will need to persist until next time we increment
the plugin protocol version, at which point we can make the breaking
change of requiring this information to be available.
)
type Schemas struct {
Providers ProviderSchemas

This comment has been minimized.

@apparentlymart

apparentlymart Oct 14, 2017

Contributor

(this seemingly-unnecessary container will grow to include provisioner schemas in a later commit)

// Indicates that a provider is compiled against a new enough
// version of core to support the GetSchema method.
SchemaAvailable: true,

This comment has been minimized.

@jbardin

jbardin Oct 16, 2017

Contributor

Shouldn't the protocol version indicate if we support the correct methods?

This comment has been minimized.

@apparentlymart

apparentlymart Oct 17, 2017

Contributor

This field is being used to avoid incrementing the protocol version so that we don't create a provider plugin compatibility wall yet. There will be some bigger changes to the provider protocol coming later, so the desire is to get it all out in a single increment so we can avoid putting users through that upgrade pain multiple times.

(If we increment the plugin protocol version then new provider releases become incompatible with older core versions, which returns us to the sad old world where you need to upgrade core in order to get the latest provider features. Tolerable to do once or twice, but not something I want to make a habit of...)

This comment has been minimized.

@jbardin

jbardin Oct 17, 2017

Contributor

gotcha, just making sure I understood why the workaround was here.

@apparentlymart apparentlymart merged commit 183833a into master Oct 17, 2017

2 checks passed

License Compliance License checks passed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@apparentlymart apparentlymart deleted the f-provider-getschema branch Feb 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment