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 31 forks source link

`function/rfc3339_parse`: Add RFC3339 parsing function #280

Closed austinvalle closed 6 months ago

austinvalle commented 8 months ago

Ref: https://github.com/hashicorp/terraform-provider-time/issues/217 Terraform core refs: https://github.com/hashicorp/terraform/issues/29694, https://github.com/hashicorp/terraform/issues/31751, https://github.com/hashicorp/terraform/issues/25802, https://github.com/hashicorp/terraform/issues/33538

This PR introduces a new provider-defined function for parsing RFC3339 timestamps:

terraform {
  required_providers {
    time = {
      source = "hashicorp/time"
    }
  }
}

output "example_output" {
  value = provider::time::rfc3339_parse("2023-07-25T23:43:16Z")
}
 $ terraform plan        

Changes to Outputs:
  + example_output = {
      + day          = 25
      + hour         = 23
      + iso_week     = 30
      + iso_year     = 2023
      + minute       = 43
      + month        = 7
      + month_name   = "July"
      + second       = 16
      + unix         = 1690328596
      + weekday      = 2
      + weekday_name = "Tuesday"
      + year         = 2023
      + year_day     = 206
    }

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

Notes

bflad commented 7 months ago

terraform-plugin-docs has been updated on main 👍

github-actions[bot] commented 3 months ago

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.