diff --git a/.goreleaser.yml b/.goreleaser.yml index 01657fbad..a4491cd1b 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -14,7 +14,7 @@ builds: - -a - -tags="netgo" ldflags: - - -s -w -extldflags "-static" -X "github.com/dikhan/terraform-provider-openapi/v2/openapi/version.Version={{.Version}}" -X "github.com/dikhan/terraform-provider-openapi/v2/openapi/version.Commit={{.Commit}}" -X "github.com/dikhan/terraform-provider-openapi/v2/openapi/version.Date={{.Date}}" + - -s -w -extldflags "-static" -X "github.com/dikhan/terraform-provider-openapi/v3/openapi/version.Version={{.Version}}" -X "github.com/dikhan/terraform-provider-openapi/v3/openapi/version.Commit={{.Commit}}" -X "github.com/dikhan/terraform-provider-openapi/v3/openapi/version.Date={{.Date}}" release: name_template: "v{{.Version}}" diff --git a/Makefile b/Makefile index 121bc88a1..498ff7277 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ NEW_RELEASE_VERSION_VALIDATION?=$(shell ./scripts/semver.sh $(RELEASE_TAG) $(CUR COMMIT :=$(shell git rev-parse --verify --short HEAD) DATE :=$(shell date +'%FT%TZ%z') -REPO=github.com/dikhan/terraform-provider-openapi/v2 +REPO=github.com/dikhan/terraform-provider-openapi/v3 LDFLAGS = '-s -w -extldflags "-static" -X "$(REPO)/openapi/version.Version=$(VERSION)" -X "$(REPO)/openapi/version.Commit=$(COMMIT)" -X "$(REPO)/openapi/version.Date=$(DATE)"' PROVIDER_NAME?="" diff --git a/docs/major_version_release_notes/openapi_terraform_provider_v3.0.0.md b/docs/major_version_release_notes/openapi_terraform_provider_v3.0.0.md new file mode 100644 index 000000000..2b33d9761 --- /dev/null +++ b/docs/major_version_release_notes/openapi_terraform_provider_v3.0.0.md @@ -0,0 +1,50 @@ +# OpenAPI Terraform Provider v3.0.0 release notes + +This version of the OpenAPI Terraform provider continues to integrate Terraform SDK 2.0; however there's been some non backwards +compatible changes in functionality that rendered a major upgrade. + +This document describes the changes applied in the plugin. + +## Terraform CLI Compatibility + +Same as stated in [OpenAPI Terraform Provider v2.0.0 release notes - Terraform CLI Compatibility](https://github.com/dikhan/terraform-provider-openapi/blob/master/docs/major_version_release_notes/openapi_terraform_provider_v2.0.0.md#terraform-cli-compatibility) + +## Go Compatibility + +The OpenAPI Terraform Plugin is built in Go. Currently, that means Go 1.16 or later must be used when building this provider. + +## What's changed? + +### Version 3 of the 'github.com/dikhan/terraform-provider-openapi' Module + +As part of the breaking changes, the OpenAPI Terraform Plugin SDK Go Module has been upgraded to v3. This involves changing +import paths from `github.com/dikhan/terraform-provider-openapi/v2` to `github.com/dikhan/terraform-provider-openapi/v3` for the +custom terraform providers repositories that use the `github.com/dikhan/terraform-provider-openapi/v2` as the parent. This is done +usually to leverage the OpenAPI Terraform plugin capabilities using this repo as a library that can be imported and customizing the release cycle +of the provider as well as the name etc. + +### Deprecated multi-region on resource name level + +As notified on the previous major release v2, this major upgrade removes support for [Multi-region on resource name level](https://github.com/dikhan/terraform-provider-openapi/blob/master/docs/major_version_release_notes/openapi_terraform_provider_v2.0.0.md#deprecation-notices). + +This feature was introduced in early days of the provider to support multi-region. However, this model was not compatible +with Terraform modules since the region was attached to the resource name. Later, multi-region support was added on the provider +level as expected by Terraform enabling the provider to be used in modules and enabling users to specify the regions on the provider level. +The multi-region support on the resource name level has been still supported till now but it's time to say goodbye to features +that had some value in the past but now don't make sense and makes the code more difficult to read and maintain. + +**Note:** Please note that the above only refers to the multi-region on a **resource level**. Multi-region on the **provider configuration level** +is supported and documented [here](https://github.com/dikhan/terraform-provider-openapi/blob/master/docs/how_to.md#multi-region-configuration) + +### Deprecated plugin_version property from OpenAPI config file SchemaV1 + +The OpenAPI Terraform config file enabled the user to specify the plugin_version as a way to ensure the config is targeted +towards a specific version of the OpenAPI plugin binary. This was a feature added in early stages of the provider as a security +mechanism to validate that the expected version of the binary was being used or fail close at runtime otherwise. +This mechanism is no longer working as intended causing issues for users when they have different Terraform configurations +each pointing at different versions of the OpenAPI Terraform provider but yet the global OpenAPI Terraform plugin configuration +is set with one specific version. + +## Deprecation notices + +The following functionality will be deprecated in future versions of the OpenAPI Terraform Provider. diff --git a/docs/publishing_provider.md b/docs/publishing_provider.md index e5493b0b8..4b54b3912 100644 --- a/docs/publishing_provider.md +++ b/docs/publishing_provider.md @@ -30,7 +30,7 @@ and the `providerOpenAPIURL` should be the URL where the service API OpenAPI doc package main import ( - "github.com/dikhan/terraform-provider-openapi/v2/openapi" + "github.com/dikhan/terraform-provider-openapi/v3/openapi" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" "log" @@ -89,13 +89,13 @@ module github.com/dikhan/terraform-provider-openapiexample go 1.16 require ( - github.com/dikhan/terraform-provider-openapi/v2 v2.0.6 + github.com/dikhan/terraform-provider-openapi/v3 v2.0.6 github.com/hashicorp/terraform-plugin-sdk/v2 v2.6.1 github.com/mattn/go-colorable v0.1.8 // indirect ) ```` -Note: If you want to use a different version of the `github.com/dikhan/terraform-provider-openapi/v2` library you can update +Note: If you want to use a different version of the `github.com/dikhan/terraform-provider-openapi/v3` library you can update the version with the commit hash you want to use (eg: a branch that has not been merged to master yet) or even alpha versions released, etc. diff --git a/go.mod b/go.mod index 811423f42..7feb40267 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/dikhan/terraform-provider-openapi/v2 +module github.com/dikhan/terraform-provider-openapi/v3 go 1.16 diff --git a/main.go b/main.go index 5d5b5b569..4bba7458a 100644 --- a/main.go +++ b/main.go @@ -7,8 +7,8 @@ import ( "log" "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/version" + "github.com/dikhan/terraform-provider-openapi/v3/openapi" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/version" "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" "os" "regexp" diff --git a/openapi/common.go b/openapi/common.go index 3be8fd976..4b98b68f6 100644 --- a/openapi/common.go +++ b/openapi/common.go @@ -11,7 +11,7 @@ import ( "reflect" "strconv" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapierr" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapierr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/openapi/common_test.go b/openapi/common_test.go index 285e47a30..789c42380 100644 --- a/openapi/common_test.go +++ b/openapi/common_test.go @@ -4,7 +4,7 @@ import ( "context" "errors" "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapierr" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapierr" "io/ioutil" "net/http" "strings" diff --git a/openapi/openapi_client.go b/openapi/openapi_client.go index 06c322740..052f45068 100644 --- a/openapi/openapi_client.go +++ b/openapi/openapi_client.go @@ -7,7 +7,7 @@ import ( "runtime" "strings" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/version" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/version" "github.com/dikhan/http_goclient" ) diff --git a/openapi/openapi_spec_header.go b/openapi/openapi_spec_header.go index c14824cea..5a03a1fa5 100644 --- a/openapi/openapi_spec_header.go +++ b/openapi/openapi_spec_header.go @@ -1,6 +1,6 @@ package openapi -import "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" +import "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" // SpecHeaderParameters groups a list of SpecHeaderParam type SpecHeaderParameters []SpecHeaderParam diff --git a/openapi/openapi_spec_resource_schema_definition_property.go b/openapi/openapi_spec_resource_schema_definition_property.go index 51a11d44e..57d8c32eb 100644 --- a/openapi/openapi_spec_resource_schema_definition_property.go +++ b/openapi/openapi_spec_resource_schema_definition_property.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "reflect" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/openapi/openapi_spec_security_definition_apikey_header.go b/openapi/openapi_spec_security_definition_apikey_header.go index 85b7f7b62..d6995851c 100644 --- a/openapi/openapi_spec_security_definition_apikey_header.go +++ b/openapi/openapi_spec_security_definition_apikey_header.go @@ -2,7 +2,7 @@ package openapi import ( "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" ) // specAPIKeyHeaderSecurityDefinition defines a security definition. This struct serves as a translation between the OpenAPI document diff --git a/openapi/openapi_spec_security_definition_apikey_header_bearer.go b/openapi/openapi_spec_security_definition_apikey_header_bearer.go index 4853017a2..68fc0bb3e 100644 --- a/openapi/openapi_spec_security_definition_apikey_header_bearer.go +++ b/openapi/openapi_spec_security_definition_apikey_header_bearer.go @@ -2,7 +2,7 @@ package openapi import ( "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" "strings" ) diff --git a/openapi/openapi_spec_security_definition_apikey_query.go b/openapi/openapi_spec_security_definition_apikey_query.go index c0e579660..e8db6a8e7 100644 --- a/openapi/openapi_spec_security_definition_apikey_query.go +++ b/openapi/openapi_spec_security_definition_apikey_query.go @@ -2,7 +2,7 @@ package openapi import ( "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" ) // specAPIKeyHeaderSecurityDefinition defines a security definition. This struct serves as a translation between the OpenAPI document diff --git a/openapi/openapi_spec_security_definition_apikey_query_bearer.go b/openapi/openapi_spec_security_definition_apikey_query_bearer.go index c17685cbd..e8d1097ea 100644 --- a/openapi/openapi_spec_security_definition_apikey_query_bearer.go +++ b/openapi/openapi_spec_security_definition_apikey_query_bearer.go @@ -2,7 +2,7 @@ package openapi import ( "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" ) type specAPIKeyQueryBearerSecurityDefinition struct { diff --git a/openapi/openapi_spec_security_definition_apikey_refresh_token.go b/openapi/openapi_spec_security_definition_apikey_refresh_token.go index 2d5d1a1c9..6b55aad03 100644 --- a/openapi/openapi_spec_security_definition_apikey_refresh_token.go +++ b/openapi/openapi_spec_security_definition_apikey_refresh_token.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" ) type specAPIKeyHeaderRefreshTokenSecurityDefinition struct { diff --git a/openapi/openapi_spec_security_schemes.go b/openapi/openapi_spec_security_schemes.go index 4c9fdded4..6c7e58603 100644 --- a/openapi/openapi_spec_security_schemes.go +++ b/openapi/openapi_spec_security_schemes.go @@ -1,6 +1,6 @@ package openapi -import "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" +import "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" // SpecSecuritySchemes groups a list of SpecSecurityScheme type SpecSecuritySchemes []SpecSecurityScheme diff --git a/openapi/openapi_stub_backend_configuration.go b/openapi/openapi_stub_backend_configuration.go index fa8d6165e..1a7c17a44 100644 --- a/openapi/openapi_stub_backend_configuration.go +++ b/openapi/openapi_stub_backend_configuration.go @@ -3,7 +3,7 @@ package openapi import ( "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapiutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapiutils" ) type specStubBackendConfiguration struct { diff --git a/openapi/openapi_v2_backend_configuration.go b/openapi/openapi_v2_backend_configuration.go index b48c8de94..27fd87d5f 100644 --- a/openapi/openapi_v2_backend_configuration.go +++ b/openapi/openapi_v2_backend_configuration.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapiutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapiutils" "github.com/go-openapi/spec" ) diff --git a/openapi/openapi_v2_resource.go b/openapi/openapi_v2_resource.go index 515fe40f3..3ab651992 100644 --- a/openapi/openapi_v2_resource.go +++ b/openapi/openapi_v2_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapiutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapiutils" "github.com/go-openapi/spec" ) diff --git a/openapi/plugin_config.go b/openapi/plugin_config.go index 2495d2396..36ad4536e 100644 --- a/openapi/plugin_config.go +++ b/openapi/plugin_config.go @@ -3,7 +3,7 @@ package openapi import ( "bufio" "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" "gopkg.in/yaml.v2" "io" "io/ioutil" diff --git a/openapi/plugin_config_telemetry_provider_httpendpoint.go b/openapi/plugin_config_telemetry_provider_httpendpoint.go index 77f5ac3af..7d5fbd2c5 100644 --- a/openapi/plugin_config_telemetry_provider_httpendpoint.go +++ b/openapi/plugin_config_telemetry_provider_httpendpoint.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" "github.com/asaskevich/govalidator" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/version" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/version" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "log" "net/http" diff --git a/openapi/provider_configuration_endpoints.go b/openapi/provider_configuration_endpoints.go index 66e599afb..cceafaaf7 100644 --- a/openapi/provider_configuration_endpoints.go +++ b/openapi/provider_configuration_endpoints.go @@ -3,7 +3,7 @@ package openapi import ( "bytes" "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapiutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapiutils" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "hash/crc32" ) diff --git a/openapi/provider_factory.go b/openapi/provider_factory.go index a66fad566..ae348ebaa 100644 --- a/openapi/provider_factory.go +++ b/openapi/provider_factory.go @@ -2,12 +2,12 @@ package openapi import ( "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/version" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/version" "net/http" "strings" "time" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/terraformutils" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/terraformutils" "log" diff --git a/openapi/provider_factory_test.go b/openapi/provider_factory_test.go index 2d1927854..56684838c 100644 --- a/openapi/provider_factory_test.go +++ b/openapi/provider_factory_test.go @@ -5,7 +5,7 @@ import ( "encoding/json" "errors" "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/version" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/version" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/stretchr/testify/assert" "io/ioutil" diff --git a/openapi/resource_factory.go b/openapi/resource_factory.go index 62ebfea64..66875651d 100644 --- a/openapi/resource_factory.go +++ b/openapi/resource_factory.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapierr" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapierr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) diff --git a/openapi/resource_factory_test.go b/openapi/resource_factory_test.go index db6b63fb2..4081b7b4b 100644 --- a/openapi/resource_factory_test.go +++ b/openapi/resource_factory_test.go @@ -3,7 +3,7 @@ package openapi import ( "errors" "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi/openapierr" + "github.com/dikhan/terraform-provider-openapi/v3/openapi/openapierr" "github.com/go-openapi/spec" "github.com/stretchr/testify/assert" "io/ioutil" diff --git a/pkg/terraformdocsgenerator/example_provider_documentation_output.html b/pkg/terraformdocsgenerator/example_provider_documentation_output.html index cd56e38a4..b1a7c89a7 100644 --- a/pkg/terraformdocsgenerator/example_provider_documentation_output.html +++ b/pkg/terraformdocsgenerator/example_provider_documentation_output.html @@ -53,7 +53,7 @@ In order to provision 'openapi' Terraform resources, you need to first install the 'openapi' Terraform plugin by running the following command (you must be running Terraform >= 0.12):
-$ export PROVIDER_NAME=openapi && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME+
[INFO] Downloading https://github.com/dikhan/terraform-provider-openapi/v2/releases/download/v0.29.4/terraform-provider-openapi_0.29.4_darwin_amd64.tar.gz in temporally folder /var/folders/n_/1lrwb99s7f50xmn9jpmfnddh0000gp/T/tmp.Xv1AkIZh...
[INFO] Extracting terraform-provider-openapi from terraform-provider-openapi_0.29.4_darwin_amd64.tar.gz...
[INFO] Cleaning up tmp dir created for installation purposes: /var/folders/n_/1lrwb99s7f50xmn9jpmfnddh0000gp/T/tmp.Xv1AkIZh
[INFO] Terraform provider 'terraform-provider-openapi' successfully installed at: '~/.terraform.d/plugins'!
$ export PROVIDER_NAME=openapi && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME
[INFO] Downloading https://github.com/dikhan/terraform-provider-openapi/v3/releases/download/v3.0.0/terraform-provider-openapi_3.0.0_darwin_amd64.tar.gz in temporally folder /var/folders/n_/1lrwb99s7f50xmn9jpmfnddh0000gp/T/tmp.Xv1AkIZh...
[INFO] Extracting terraform-provider-openapi from terraform-provider-openapi_3.0.0_darwin_amd64.tar.gz...
[INFO] Cleaning up tmp dir created for installation purposes: /var/folders/n_/1lrwb99s7f50xmn9jpmfnddh0000gp/T/tmp.Xv1AkIZh
[INFO] Terraform provider 'terraform-provider-openapi' successfully installed at: '~/.terraform.d/plugins'!
You can then start running the Terraform provider:
diff --git a/pkg/terraformdocsgenerator/main.go b/pkg/terraformdocsgenerator/main.go index fa28ccc4c..21e956b1a 100644 --- a/pkg/terraformdocsgenerator/main.go +++ b/pkg/terraformdocsgenerator/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/dikhan/terraform-provider-openapi/v2/pkg/terraformdocsgenerator/openapiterraformdocsgenerator" + "github.com/dikhan/terraform-provider-openapi/v3/pkg/terraformdocsgenerator/openapiterraformdocsgenerator" "log" "os" ) diff --git a/pkg/terraformdocsgenerator/openapiterraformdocsgenerator/openapi_terraform_provider_doc_generator.go b/pkg/terraformdocsgenerator/openapiterraformdocsgenerator/openapi_terraform_provider_doc_generator.go index 6d85245e7..dbe67f5e5 100644 --- a/pkg/terraformdocsgenerator/openapiterraformdocsgenerator/openapi_terraform_provider_doc_generator.go +++ b/pkg/terraformdocsgenerator/openapiterraformdocsgenerator/openapi_terraform_provider_doc_generator.go @@ -3,7 +3,7 @@ package openapiterraformdocsgenerator import ( "errors" "fmt" - "github.com/dikhan/terraform-provider-openapi/v2/openapi" + "github.com/dikhan/terraform-provider-openapi/v3/openapi" "github.com/mitchellh/hashstructure" "log" "sort" @@ -103,7 +103,7 @@ func (t TerraformProviderDocGenerator) GenerateDocumentation() (TerraformProvide Hostname: t.Hostname, PluginVersionConstraint: t.PluginVersionConstraint, Example: fmt.Sprintf("$ export PROVIDER_NAME=%s && curl -fsSL https://raw.githubusercontent.com/dikhan/terraform-provider-openapi/master/scripts/install.sh | bash -s -- --provider-name $PROVIDER_NAME