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

time_static attributes should be determinable on plan #255

Closed hariAtDeloitte closed 1 month ago

hariAtDeloitte commented 10 months ago

Terraform CLI and Provider Versions

terraform_version: 1.1.4

Use Cases or Problem Statement

I have a use-case for the time module as I want to determine the time in seconds since epoch. This is used as an input in other resources that we create. Thus we created our resource called "example_time_resource"

resource "time_static" "example_time_resource" {
   rfc3339 = "2023-07-01T00:00:00Z"
}

However, our tf plan doesn't comprehensively describe changes to a resource if we use the following resource example. On tf plan, this is what is displayed.

resource "time_static" "example_time_resource" {
      + day     = (known after apply)
      + hour    = (known after apply)
      + id      = (known after apply)
      + minute  = (known after apply)
      + month   = (known after apply)
      + rfc3339 = "2023-07-01T00:00:00Z"
      + second  = (known after apply)
      + unix    = (known after apply)
      + year    = (known after apply)
    }

And thus anything that uses time_static.example_time_resource.unix for example comes out as (known after apply)

Proposal

In the plan, we can ideally identify these attributes in advance in the plan: On tf plan

resource "time_static" "example_time_resource" {
      + day     = 1
      + hour    = 0
      + id      = "2023-07-01T00:00:00Z"
      + minute  = 0
      + month   = 7
      + rfc3339 = "2023-07-01T00:00:00Z"
      + second  = 0
      + unix    = 1698364800
      + year    = 2023
    }

This would allow us to have more descriptive plans if we use the time_static resource.

How much impact is this issue causing?

Low

Additional Information

No response

Code of Conduct