hashicorp / terraform-provider-time

Utility provider that provides Time-Based Resources
https://registry.terraform.io/providers/hashicorp/time/latest
Mozilla Public License 2.0
103 stars 30 forks source link

`function/parse_duration`: Add duration parsing function #350

Open ricardbejarano opened 1 week ago

ricardbejarano commented 1 week ago

Community Note

ricardbejarano commented 1 week ago

First contribution to this provider, so apologies if there are any errors of form.

This brings Go's time.ParseDuration function to Terraform, allowing users to define durations as "1h30m" instead of 60*90, which is much more readable.

Most of the code has been adapted from the rfc3339_parse function.

If it only goes up to hours in resolution is because that's what Rob Pike said makes sense.