From 91b5bbbde0428966b43916fb7bef759ab218af0c Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 21 Jun 2018 14:59:18 -0400 Subject: [PATCH] add versions to the provider schemas We need to know the schema version for all resources. This is stored in order to allow providers to upgrade the state from a known previous version. --- providers/provider.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/providers/provider.go b/providers/provider.go index d45d2b22a..61917d7c7 100644 --- a/providers/provider.go +++ b/providers/provider.go @@ -66,18 +66,25 @@ type Interface interface { type GetSchemaResponse struct { // Provider is the schema for the provider itself. - Provider *configschema.Block + Provider Schema // ResourceTypes map the resource type name to that type's schema. - ResourceTypes map[string]*configschema.Block + ResourceTypes map[string]Schema // DataSources maps the data source name to that data source's schema. - DataSources map[string]*configschema.Block + DataSources map[string]Schema // Diagnostics contains any warnings or errors from the method call. Diagnostics tfdiags.Diagnostics } +// Schema pairs a provider or resource schema with that schema's version. +// This is used to be able to upgrade the schema in +type Schema struct { + Version int + Block *configschema.Block +} + type ValidateProviderConfigRequest struct { // Config is the complete configuration value for the provider. Config cty.Value