Improve region details (#90)
* Make client config error message more clear * Add missing log * Add region detail to resource/data source description * Generate docs * Remove resourcemanager using region * Apply changes to MongoDBFlex user * Generate docs * Fix wrong description --------- Co-authored-by: Henrique Santos <henrique.santos@freiheit.com>
This commit is contained in:
parent
20f3496242
commit
9d11098102
102 changed files with 200 additions and 193 deletions
|
|
@ -76,7 +76,7 @@ func (r *credentialResource) Configure(ctx context.Context, req resource.Configu
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", err.Error())
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v. This is an error related to the provider configuration, not to the resource configuration", err))
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -86,6 +86,7 @@ func (r *credentialResource) Configure(ctx context.Context, req resource.Configu
|
|||
|
||||
func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Description: "Argus credential resource schema. Must have a `region` specified in the provider configuration.",
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"id": schema.StringAttribute{
|
||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`instance_id`,`username`\".",
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ func (d *instanceDataSource) Configure(ctx context.Context, req datasource.Confi
|
|||
)
|
||||
}
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v", err))
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v. This is an error related to the provider configuration, not to the data source configuration", err))
|
||||
return
|
||||
}
|
||||
d.client = apiClient
|
||||
|
|
@ -73,6 +73,7 @@ func (d *instanceDataSource) Configure(ctx context.Context, req datasource.Confi
|
|||
// Schema defines the schema for the data source.
|
||||
func (d *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Description: "Argus instance data source schema. Must have a `region` specified in the provider configuration.",
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"id": schema.StringAttribute{
|
||||
Description: "Terraform's internal data source. ID. It is structured as \"`project_id`,`instance_id`\".",
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ func (r *instanceResource) Configure(ctx context.Context, req resource.Configure
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v", err))
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v. This is an error related to the provider configuration, not to the resource configuration", err))
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -114,6 +114,7 @@ func (r *instanceResource) Configure(ctx context.Context, req resource.Configure
|
|||
// Schema defines the schema for the resource.
|
||||
func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Description: "Argus instance resource schema. Must have a `region` specified in the provider configuration.",
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"id": schema.StringAttribute{
|
||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`instance_id`\".",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/argus"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
|
||||
|
|
@ -64,7 +65,7 @@ func (d *scrapeConfigDataSource) Configure(ctx context.Context, req datasource.C
|
|||
)
|
||||
}
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v", err))
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v. This is an error related to the provider configuration, not to the data source configuration", err))
|
||||
return
|
||||
}
|
||||
d.client = apiClient
|
||||
|
|
@ -73,6 +74,7 @@ func (d *scrapeConfigDataSource) Configure(ctx context.Context, req datasource.C
|
|||
// Schema defines the schema for the data source.
|
||||
func (d *scrapeConfigDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Description: "Argus scrape config data source schema. Must have a `region` specified in the provider configuration.",
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"id": schema.StringAttribute{
|
||||
Description: "Terraform's internal data source. ID. It is structured as \"`project_id`,`instance_id`,`name`\".",
|
||||
|
|
@ -215,4 +217,5 @@ func (d *scrapeConfigDataSource) Read(ctx context.Context, req datasource.ReadRe
|
|||
if resp.Diagnostics.HasError() {
|
||||
return
|
||||
}
|
||||
tflog.Info(ctx, "Argus scrape config read")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ func (r *scrapeConfigResource) Configure(ctx context.Context, req resource.Confi
|
|||
}
|
||||
|
||||
if err != nil {
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", err.Error())
|
||||
core.LogAndAddError(ctx, &resp.Diagnostics, "Error configuring API client", fmt.Sprintf("Configuring client: %v. This is an error related to the provider configuration, not to the resource configuration", err))
|
||||
return
|
||||
}
|
||||
r.client = apiClient
|
||||
|
|
@ -124,6 +124,7 @@ func (r *scrapeConfigResource) Configure(ctx context.Context, req resource.Confi
|
|||
// Schema defines the schema for the resource.
|
||||
func (r *scrapeConfigResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
|
||||
resp.Schema = schema.Schema{
|
||||
Description: "Argus scrape config resource schema. Must have a `region` specified in the provider configuration.",
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"id": schema.StringAttribute{
|
||||
Description: "Terraform's internal resource ID. It is structured as \"`project_id`,`instance_id`,`name`\".",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue