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

resource/time_static: Enhance plan output for config-defined rfc3339 values #295

Merged
merged 14 commits into from
Jul 16, 2024

Conversation

austinvalle
Copy link
Member

@austinvalle austinvalle commented Feb 23, 2024

Closes #255

This PR introduces new plan enhancements to the time_static resource to ensure config-provided values for rfc3339 result in known values in the plan.

resource "time_static" "example" {
  rfc3339 = "2024-02-23T21:08:42Z"
}

Before

 $ terraform apply -auto-approve

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # time_static.example will be created
  + resource "time_static" "example" {
      + day     = (known after apply)
      + hour    = (known after apply)
      + id      = (known after apply)
      + minute  = (known after apply)
      + month   = (known after apply)
      + rfc3339 = "2024-02-23T21:08:42Z"
      + second  = (known after apply)
      + unix    = (known after apply)
      + year    = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.
time_static.example: Creating...
time_static.example: Creation complete after 0s [id=2024-02-23T21:08:42Z]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

After

 $ terraform apply -auto-approve

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # time_static.example will be created
  + resource "time_static" "example" {
      + day     = 23
      + hour    = 21
      + id      = "2024-02-23T21:08:42Z"
      + minute  = 8
      + month   = 2
      + rfc3339 = "2024-02-23T21:08:42Z"
      + second  = 42
      + unix    = 1708722522
      + year    = 2024
    }

Plan: 1 to add, 0 to change, 0 to destroy.
time_static.example: Creating...
time_static.example: Creation complete after 0s [id=2024-02-23T21:08:42Z]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

@austinvalle austinvalle requested a review from a team as a code owner February 23, 2024 21:18
@austinvalle austinvalle added this to the v0.11.0 milestone Feb 23, 2024
@austinvalle austinvalle added the enhancement New feature or request label Feb 23, 2024
@github-actions github-actions bot added dependencies Pull requests that update a dependency file size/XL labels Feb 23, 2024
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enhancement part of these changes is great, but wanted to drop some random thoughts on the other testing changes. Nothing truly blocking. 👍

internal/provider/resource_time_static.go Outdated Show resolved Hide resolved
internal/provider/resource_time_sleep_test.go Show resolved Hide resolved
internal/timetesting/sleep_state_check.go Outdated Show resolved Hide resolved
@austinvalle
Copy link
Member Author

I replaced the awkward NumberRegularExpression with an Int64Between check in d73f9a9

@austinvalle austinvalle modified the milestones: v0.11.0, v0.12.0 Mar 6, 2024
@austinvalle austinvalle merged commit ed67fcd into main Jul 16, 2024
48 checks passed
@austinvalle austinvalle deleted the av/time-static-plan branch July 16, 2024 18:38
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

time_static attributes should be determinable on plan
4 participants