From bade232fecca76af5bc32d2bfc777248d536fd43 Mon Sep 17 00:00:00 2001 From: Roberto Losanno Date: Fri, 14 Mar 2025 10:44:00 +0000 Subject: [PATCH 1/2] feat: added support for branches --- go.mod | 2 +- go.sum | 4 ++-- internal/provider/provider.go | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7f7f484..7c57b8c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/hashicorp/terraform-plugin-docs v0.9.0 github.com/hashicorp/terraform-plugin-framework v0.8.1-0.20220531184835-f0051665855e github.com/hashicorp/terraform-plugin-go v0.9.1 - github.com/labd/contentstack-go-sdk v0.0.0-20220603201036-f342c4fb5d4e + github.com/labd/contentstack-go-sdk v0.1.0 ) // replace github.com/labd/contentstack-go-sdk => ../contentstack-go-sdk diff --git a/go.sum b/go.sum index 8cc1865..35e7dd2 100644 --- a/go.sum +++ b/go.sum @@ -160,8 +160,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/labd/contentstack-go-sdk v0.0.0-20220603201036-f342c4fb5d4e h1:sLkJews6wpQiWGTrvDN+zUIfHZoajFKyFTRsbBZ+XbA= -github.com/labd/contentstack-go-sdk v0.0.0-20220603201036-f342c4fb5d4e/go.mod h1:2pN/o4bC/yK/X+n/E/nOHvJssM0kLEUURtYZhsd3NOY= +github.com/labd/contentstack-go-sdk v0.1.0 h1:lxBbGBkIlileNn2+VrVG6XP776Llxy9i4THPBA01xTU= +github.com/labd/contentstack-go-sdk v0.1.0/go.mod h1:J17aqV8NOcmFfkkotnAljlt6Ctwlu21Ieeo/0BPLNtg= github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 360f2c5..f213a78 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -48,6 +48,11 @@ func (p *provider) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) Sensitive: true, Description: "The Authtoken is a read-write token used to make authorized CMA requests, and it is a user-specific token.", }, + "branch": { + Type: types.StringType, + Optional: true, + Description: "The branch to manage resources in. If not specified, the main branch will be used.", + }, }, }, nil } @@ -58,6 +63,7 @@ type providerData struct { AuthToken types.String `tfsdk:"auth_token"` ApiKey types.String `tfsdk:"api_key"` ManagementToken types.String `tfsdk:"management_token"` + Branch types.String `tfsdk:"branch"` } func (p *provider) Configure(ctx context.Context, req tfsdk.ConfigureProviderRequest, resp *tfsdk.ConfigureProviderResponse) { @@ -90,6 +96,7 @@ func (p *provider) Configure(ctx context.Context, req tfsdk.ConfigureProviderReq stackAuth := management.StackAuth{ ApiKey: config.ApiKey.Value, ManagementToken: config.ManagementToken.Value, + Branch: config.Branch.Value, } instance, err := c.Stack(&stackAuth) From 119dde0d346d951144180efd4ce2a749286de6af Mon Sep 17 00:00:00 2001 From: Roberto Losanno Date: Thu, 20 Mar 2025 10:44:36 +0000 Subject: [PATCH 2/2] chore: added changelog --- .changes/unreleased/Added-20250320-104257.yaml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changes/unreleased/Added-20250320-104257.yaml diff --git a/.changes/unreleased/Added-20250320-104257.yaml b/.changes/unreleased/Added-20250320-104257.yaml new file mode 100644 index 0000000..4f746f8 --- /dev/null +++ b/.changes/unreleased/Added-20250320-104257.yaml @@ -0,0 +1,3 @@ +kind: Added +body: Support for branches at provider level +time: 2025-03-20T10:42:57.483691Z