@@ -32,6 +32,12 @@ type TimeplusProviderModel struct {
3232 Endpoint types.String `tfsdk:"endpoint"`
3333 Workspace types.String `tfsdk:"workspace"`
3434 ApiKey types.String `tfsdk:"api_key"`
35+
36+ // Ideally we should read this from stream definitions. However, there are 2 limitations
37+ // 1. Proton cluster (e.g. replica = 3) doesn't allow stream with relicatoin_refactor equals other number (e.g. 2)
38+ // 2. Proton get/list stream endpoint doesn't return relicatoin_refactor of the stream
39+ // Thus, we currently define this `replicas` as a provider setting
40+ Replicas types.Int64 `tfsdk:"replicas"`
3541}
3642
3743func (p * TimeplusProvider ) Metadata (ctx context.Context , _ provider.MetadataRequest , resp * provider.MetadataResponse ) {
@@ -59,6 +65,11 @@ Use the navigation to the left to read about the available resources.`,
5965 Required : true ,
6066 Sensitive : true ,
6167 },
68+ "replicas" : schema.Int64Attribute {
69+ MarkdownDescription : "Number of Proton replicas" ,
70+ Required : false ,
71+ Optional : true ,
72+ },
6273 },
6374 }
6475}
@@ -72,8 +83,14 @@ func (p *TimeplusProvider) Configure(ctx context.Context, req provider.Configure
7283 return
7384 }
7485
86+ var replicas * int
87+ if ! (data .Replicas .IsNull () || data .Replicas .IsUnknown ()) {
88+ valInt := int (* data .Replicas .ValueInt64Pointer ())
89+ replicas = & valInt
90+ }
91+
7592 // Configuration values are now available.
76- client , err := timeplus .NewClient (data .Workspace .ValueString (), data .ApiKey .ValueString (), timeplus.ClientOptions {
93+ client , err := timeplus .NewClient (data .Workspace .ValueString (), data .ApiKey .ValueString (), replicas , timeplus.ClientOptions {
7794 BaseURL : data .Endpoint .ValueString (),
7895 })
7996 if err != nil {
0 commit comments