Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/Added-20250320-104257.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Added
body: Support for branches at provider level
time: 2025-03-20T10:42:57.483691Z
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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/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=
Expand Down
7 changes: 7 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down