From c8c6d3355bcc7b7abc92bcb54c30ea173fcbd20e Mon Sep 17 00:00:00 2001 From: Tomas Basham Date: Sat, 8 Oct 2022 15:31:47 +0000 Subject: [PATCH] Document provider environment variables --- docs/index.md | 12 ++++++------ internal/provider/provider.go | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/index.md b/docs/index.md index d8591e61..ca9574e2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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` diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 3fe55f0c..eb9c632a 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -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, }, },