Skip to content

Commit db3a6ba

Browse files
committed
Implement subscription resource via terraform-plugin-framework
Migrate a small resource to the new plugin framework setup. This is done by mux’ing the old provider with the new setup.
1 parent 5322954 commit db3a6ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1584
-1116
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ build-local:
1212
go build -o terraform-provider-commercetools_${LOCAL_TEST_VERSION}
1313
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/labd/commercetools/${LOCAL_TEST_VERSION}/${OS_ARCH}
1414
cp terraform-provider-commercetools_${LOCAL_TEST_VERSION} ~/.terraform.d/plugins/registry.terraform.io/labd/commercetools/${LOCAL_TEST_VERSION}/${OS_ARCH}/terraform-provider-commercetools_v${LOCAL_TEST_VERSION}
15+
codesign --deep --force -s - ~/.terraform.d/plugins/registry.terraform.io/labd/commercetools/${LOCAL_TEST_VERSION}/${OS_ARCH}/terraform-provider-commercetools_v${LOCAL_TEST_VERSION}
1516

1617
format:
1718
go fmt ./...

commercetools/provider.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
"github.com/labd/commercetools-go-sdk/ctutils"
1313
"github.com/labd/commercetools-go-sdk/platform"
1414
"golang.org/x/oauth2/clientcredentials"
15+
16+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1517
)
1618

1719
func init() {
@@ -81,12 +83,14 @@ func New(version string) func() *schema.Provider {
8183
"commercetools_state": resourceState(),
8284
"commercetools_state_transitions": resourceStateTransitions(),
8385
"commercetools_store": resourceStore(),
84-
"commercetools_subscription": resourceSubscription(),
8586
"commercetools_tax_category_rate": resourceTaxCategoryRate(),
8687
"commercetools_tax_category": resourceTaxCategory(),
8788
"commercetools_category": resourceCategory(),
8889
"commercetools_type": resourceType(),
8990
"commercetools_product_discount": resourceProductDiscount(),
91+
92+
// Following items are moved to new terraform-plugin-framework
93+
// "commercetools_subscription": resourceSubscription(),
9094
},
9195
}
9296
p.ConfigureContextFunc = providerConfigure(version, p)
@@ -135,4 +139,4 @@ func providerConfigure(version string, p *schema.Provider) func(context.Context,
135139
}
136140

137141
// This is a global MutexKV for use within this plugin.
138-
var ctMutexKV = NewMutexKV()
142+
var ctMutexKV = utils.NewMutexKV()

commercetools/resource_api_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1212
"github.com/labd/commercetools-go-sdk/platform"
1313

14-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
14+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1515
)
1616

1717
func resourceAPIClient() *schema.Resource {

commercetools/resource_api_extension.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1313
"github.com/labd/commercetools-go-sdk/platform"
1414

15-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
15+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1616
)
1717

1818
func resourceAPIExtension() *schema.Resource {

commercetools/resource_cart_discount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1111
"github.com/labd/commercetools-go-sdk/ctutils"
1212
"github.com/labd/commercetools-go-sdk/platform"
13-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
13+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1414
)
1515

1616
func resourceCartDiscount() *schema.Resource {

commercetools/resource_category.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1010
"github.com/labd/commercetools-go-sdk/platform"
11-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
11+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1212
)
1313

1414
func resourceCategory() *schema.Resource {

commercetools/resource_channel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1010
"github.com/labd/commercetools-go-sdk/platform"
11-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
11+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1212
)
1313

1414
func resourceChannel() *schema.Resource {

commercetools/resource_custom_object.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1111
"github.com/labd/commercetools-go-sdk/platform"
12-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
12+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1313
)
1414

1515
func resourceCustomObject() *schema.Resource {

commercetools/resource_customer_group.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1010
"github.com/labd/commercetools-go-sdk/platform"
11-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
11+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1212
)
1313

1414
func resourceCustomerGroup() *schema.Resource {

commercetools/resource_discount_code.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
99
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1010
"github.com/labd/commercetools-go-sdk/platform"
11-
"github.com/labd/terraform-provider-commercetools/commercetools/utils"
11+
"github.com/labd/terraform-provider-commercetools/internal/utils"
1212
)
1313

1414
func resourceDiscountCode() *schema.Resource {

0 commit comments

Comments
 (0)