Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(provider)!: BREAKING: base_url is now required to configure the provider #86

Merged
merged 1 commit into from
Aug 30, 2024
Merged
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
21 changes: 15 additions & 6 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ func (p *swoProvider) Schema(ctx context.Context, req provider.SchemaRequest, re
Required: true,
Sensitive: true,
},
"request_timeout": schema.Int64Attribute{
Description: "The request timeout period in seconds. Default is 30 seconds.",
Optional: true,
},
"base_url": schema.StringAttribute{
Description: "The base url to use for requests to the server.",
Required: true,
},
"request_timeout": schema.Int64Attribute{
Description: "The request timeout period in seconds. Default is 30 seconds.",
Optional: true,
},
"debug_mode": schema.BoolAttribute{
Expand All @@ -91,8 +91,17 @@ func (p *swoProvider) Configure(ctx context.Context, req provider.ConfigureReque
if config.ApiToken.IsUnknown() {
resp.Diagnostics.AddAttributeError(
path.Root("api_token"),
"Api Token Required",
"The api token was not provided.",
"api_token required",
"The api_token configuration parameter was not provided and is required. Please provide a public API token for the SolarWinds Observability API.",
)
return
}

if config.BaseURL.IsUnknown() {
resp.Diagnostics.AddAttributeError(
path.Root("base_url"),
"base_url required",
"The base_url configuration parameter was not provided and is required. Please provide the URL of the SolarWinds Observability API.",
)
return
}
Expand Down