diff --git a/dockerhub/provider.go b/dockerhub/provider.go index 358ccfe..fb98bca 100644 --- a/dockerhub/provider.go +++ b/dockerhub/provider.go @@ -24,6 +24,12 @@ func Provider() *schema.Provider { DefaultFunc: schema.EnvDefaultFunc("DOCKER_PASSWORD", nil), Description: "Password for authentication.", }, + "sleep_interval": { + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("SLEEP_INTERVAL", "750"), + Description: "Amount of milliseconds to sleep between requests. Defaults to 750", + }, }, ResourcesMap: map[string]*schema.Resource{ "dockerhub_repository": resourceRepository(), @@ -36,5 +42,5 @@ func Provider() *schema.Provider { } func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { - return rtd.NewClient(d.Get("username").(string), d.Get("password").(string)), nil + return rtd.NewClient(d.Get("username").(string), d.Get("password").(string), d.Get("sleep_interval").(string)), nil } diff --git a/docs/index.md b/docs/index.md index 2672e30..6075ce4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -34,8 +34,9 @@ terraform { ```terraform provider "dockerhub" { # Note: This cannot be a Personal Access Token - username = "USERNAME" # or use DOCKER_USERNAME environment variable - password = "PASSWORD" # or use DOCKER_PASSWORD environment variable + username = "USERNAME" # or use DOCKER_USERNAME environment variable + password = "PASSWORD" # or use DOCKER_PASSWORD environment variable + sleep_interval = "750" # milliseconds } ``` @@ -49,8 +50,9 @@ provider "dockerhub" { ```terraform # Configure the Docker Hub Provider provider "dockerhub" { - username = "azurediamond" - password = "hunter2" + username = "azurediamond" + password = "hunter2" + sleep_interval = "750" } # Create an organization group for developers diff --git a/examples/full.tf b/examples/full.tf index 06876fb..d0e48a6 100644 --- a/examples/full.tf +++ b/examples/full.tf @@ -1,7 +1,8 @@ # Configure the Docker Hub Provider provider "dockerhub" { - username = "azurediamond" - password = "hunter2" + username = "azurediamond" + password = "hunter2" + sleep_interval = "750" } # Create an organization group for developers diff --git a/examples/provider/configuration.tf b/examples/provider/configuration.tf index 3a219e4..82fb0ff 100644 --- a/examples/provider/configuration.tf +++ b/examples/provider/configuration.tf @@ -1,5 +1,6 @@ provider "dockerhub" { # Note: This cannot be a Personal Access Token - username = "USERNAME" # or use DOCKER_USERNAME environment variable - password = "PASSWORD" # or use DOCKER_PASSWORD environment variable + username = "USERNAME" # or use DOCKER_USERNAME environment variable + password = "PASSWORD" # or use DOCKER_PASSWORD environment variable + sleep_interval = "750" # milliseconds } diff --git a/go.mod b/go.mod index 16863fe..694f084 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/Marfeel/terraform-provider-dockerhub go 1.16 require ( - github.com/Marfeel/dockerhub/v2 v2.4.0 + github.com/Marfeel/dockerhub/v2 v2.4.1-0.20240709151401-994dd6e9fbdf github.com/agext/levenshtein v1.2.3 // indirect github.com/hashicorp/terraform-plugin-docs v0.13.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 diff --git a/go.sum b/go.sum index 36d6913..f733415 100644 --- a/go.sum +++ b/go.sum @@ -360,10 +360,10 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Marfeel/dockerhub/v2 v2.4.0 h1:MC15Llv7Oow7HqjnFgB9fV3H+cQbkLo075bjF7a2Dsk= -github.com/Marfeel/dockerhub/v2 v2.4.0/go.mod h1:0oJJy/ogptA+kYjmrviXU/GEwDkj09XrqsQ2lw/9KNg= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Marfeel/dockerhub/v2 v2.4.1-0.20240709151401-994dd6e9fbdf h1:hPA4Pi8ktXutbUL32Oe/RzliRYvEVbXhTt1WOEcuvYA= +github.com/Marfeel/dockerhub/v2 v2.4.1-0.20240709151401-994dd6e9fbdf/go.mod h1:0oJJy/ogptA+kYjmrviXU/GEwDkj09XrqsQ2lw/9KNg= github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=