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 docs and validation for expiry_seconds on registry docker credentials resource. #582

Merged
merged 2 commits into from
Feb 10, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ func resourceDigitalOceanContainerRegistryDockerCredentials() *schema.Resource {
Default: false,
},
"expiry_seconds": {
Type: schema.TypeInt,
Optional: true,
Default: expirySecondsDefault,
Type: schema.TypeInt,
Optional: true,
Default: expirySecondsDefault,
ValidateFunc: validation.IntBetween(0, expirySecondsDefault),
},
"docker_credentials": {
Type: schema.TypeString,
Expand Down Expand Up @@ -133,11 +134,6 @@ func generateDockerCredentials(readWrite bool, expirySeconds int, client *godo.C
func updateExpiredDockerCredentials(d *schema.ResourceData, readWrite bool, client *godo.Client) error {
expirySeconds := d.Get("expiry_seconds").(int)
expirationTime := d.Get("credential_expiration_time").(string)

if (expirySeconds > expirySecondsDefault) || (expirySeconds <= 0) {
return fmt.Errorf("expiry_seconds outside acceptable range")
}

d.Set("expiry_seconds", expirySeconds)

currentTime := time.Now().UTC()
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/container_registry_docker_credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ The following arguments are supported:

* `registry_name` - (Required) The name of the container registry.
* `write` - (Optional) Allow for write access to the container registry. Defaults to false.
* `expiry_seconds` - (Optional) The amount of time to pass before the Docker credentials expire in seconds. Defaults to 2147483647, or roughly 68 years. Must be greater than 0 and less than 2147483647.
* `expiry_seconds` - (Optional) The amount of time to pass before the Docker credentials expire in seconds. Defaults to 1576800000, or roughly 50 years. Must be greater than 0 and less than 1576800000.

## Attributes Reference

Expand Down