feat: provider v0.1.9 — namespace removed from resources, moved to provider block
This commit is contained in:
@@ -28,8 +28,9 @@ type SlessProvider struct {
|
||||
|
||||
// SlessProviderModel — конфигурация блока provider {} в .tf файле.
|
||||
type SlessProviderModel struct {
|
||||
Endpoint types.String `tfsdk:"endpoint"`
|
||||
Token types.String `tfsdk:"token"`
|
||||
Endpoint types.String `tfsdk:"endpoint"`
|
||||
Token types.String `tfsdk:"token"`
|
||||
Namespace types.String `tfsdk:"namespace"`
|
||||
}
|
||||
|
||||
// New возвращает фабрику провайдера — точная копия паттерна nubes.
|
||||
@@ -56,6 +57,12 @@ func (p *SlessProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp
|
||||
Optional: true,
|
||||
Sensitive: true,
|
||||
},
|
||||
// namespace — окружение/проект в кластере. Задаётся один раз здесь.
|
||||
// В ресурсах (sless_function, sless_trigger, sless_job) namespace НЕ указывается.
|
||||
"namespace": schema.StringAttribute{
|
||||
MarkdownDescription: "Пространство имён (окружение). Задаётся один раз для всех ресурсов.",
|
||||
Required: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -87,7 +94,9 @@ func (p *SlessProvider) Configure(ctx context.Context, req provider.ConfigureReq
|
||||
}
|
||||
}
|
||||
|
||||
c := client.New(endpoint, token)
|
||||
namespace := config.Namespace.ValueString()
|
||||
|
||||
c := client.New(endpoint, token, namespace)
|
||||
resp.ResourceData = c
|
||||
resp.DataSourceData = c
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user