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

Document provider environment variables #96

Merged
merged 1 commit into from
Oct 10, 2022
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
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ provider "statuscake" {

### Required

- **api_token** (String) The API token for operations
- **api_token** (String) The API token for operations. This can also be provided as an environment variable `STATUSCAKE_API_TOKEN`

### Optional

- **max_backoff** (Number) Maximum backoff period in seconds after failed API calls
- **min_backoff** (Number) Minimum backoff period in seconds after failed API calls
- **retries** (Number) Maximum number of retries to perform when an API request fails
- **rps** (Number) RPS limit to apply when making calls to the API
- **statuscake_custom_endpoint** (String) Custom endpoint to which request will be made
- **max_backoff** (Number) Maximum backoff period in seconds after failed API calls. This can also be provided as an environment variable `STATUSCAKE_MAX_BACKOFF`
- **min_backoff** (Number) Minimum backoff period in seconds after failed API calls. This can also be provided as an environment variable `STATUSCAKE_MIN_BACKOFF`
- **retries** (Number) Maximum number of retries to perform when an API request fails. This can also be provided as an environment variable `STATUSCAKE_RETRIES`
- **rps** (Number) RPS limit to apply when making calls to the API. This can also be provided as an environment variable `STATUSCAKE_RPS`
- **statuscake_custom_endpoint** (String) Custom endpoint to which request will be made. This can also be provided as an environment variable `STATUCAKE_CUSTOM_ENDPOINT`
12 changes: 6 additions & 6 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,42 @@ func Provider() *schema.Provider {
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_API_TOKEN", nil),
Description: "The API token for operations",
Description: "The API token for operations. This can also be provided as an environment variable `STATUSCAKE_API_TOKEN`",
ValidateFunc: validation.StringMatch(regexp.MustCompile("[0-9a-zA-Z_]{20,30}"), "API token must only contain characters 0-9, a-zA-Z and underscores"),
},
"rps": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_RPS", 4),
Description: "RPS limit to apply when making calls to the API",
Description: "RPS limit to apply when making calls to the API. This can also be provided as an environment variable `STATUSCAKE_RPS`",
ValidateFunc: validation.IntAtLeast(1),
},
"retries": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_RETRIES", 3),
Description: "Maximum number of retries to perform when an API request fails",
Description: "Maximum number of retries to perform when an API request fails. This can also be provided as an environment variable `STATUSCAKE_RETRIES`",
ValidateFunc: validation.IntBetween(0, 10),
},
"min_backoff": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_MIN_BACKOFF", 1),
Description: "Minimum backoff period in seconds after failed API calls",
Description: "Minimum backoff period in seconds after failed API calls. This can also be provided as an environment variable `STATUSCAKE_MIN_BACKOFF`",
ValidateFunc: validation.IntAtLeast(0),
},
"max_backoff": &schema.Schema{
Type: schema.TypeInt,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("STATUSCAKE_MAX_BACKOFF", 30),
Description: "Maximum backoff period in seconds after failed API calls",
Description: "Maximum backoff period in seconds after failed API calls. This can also be provided as an environment variable `STATUSCAKE_MAX_BACKOFF`",
ValidateFunc: validation.IntAtLeast(1),
},
"statuscake_custom_endpoint": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("STATUCAKE_CUSTOM_ENDPOINT", nil),
Description: "Custom endpoint to which request will be made",
Description: "Custom endpoint to which request will be made. This can also be provided as an environment variable `STATUCAKE_CUSTOM_ENDPOINT`",
ValidateFunc: validation.IsURLWithHTTPorHTTPS,
},
},
Expand Down