Skip to content

New ephemeral resource: time_sleep#432

Open
magodo wants to merge 3 commits intohashicorp:mainfrom
magodo:ephemeral_time_sleep
Open

New ephemeral resource: time_sleep#432
magodo wants to merge 3 commits intohashicorp:mainfrom
magodo:ephemeral_time_sleep

Conversation

@magodo
Copy link
Copy Markdown

@magodo magodo commented Jun 3, 2025

Related Issue

Fixes magodo/terraform-provider-restful#145

Description

This PR introduces a new ephemeral resource time_sleep. This resource is useful to delay provider configuration based on another ephemeral resource's value (which can not be referenced by the resource time_sleep as it has no write-only attribute).

One example can be found at magodo/terraform-provider-restful#145.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Test

$ TF_ACC=1 go test -v ./internal/provider
=== RUN   TestEphemeralResourceTimeSleep_Open
--- PASS: TestEphemeralResourceTimeSleep_Open (1.01s)
=== RUN   TestAccEphemeralTimeSleep_Outputs
--- PASS: TestAccEphemeralTimeSleep_Outputs (1.24s)
=== RUN   TestDurationParse_valid
--- PASS: TestDurationParse_valid (1.97s)
=== RUN   TestDurationParse_invalid
--- PASS: TestDurationParse_invalid (0.18s)
=== RUN   TestRFC3339Parse_UTC
--- PASS: TestRFC3339Parse_UTC (1.10s)
=== RUN   TestRFC3339Parse_offset
--- PASS: TestRFC3339Parse_offset (0.48s)
=== RUN   TestRFC3339Parse_invalid
--- PASS: TestRFC3339Parse_invalid (0.18s)
=== RUN   TestUnixTimestampParseFunction_Valid
=== PAUSE TestUnixTimestampParseFunction_Valid
=== RUN   TestUnixTimestampParseFunction_Null
=== PAUSE TestUnixTimestampParseFunction_Null
=== RUN   TestAccTimeOffset_Triggers
--- PASS: TestAccTimeOffset_Triggers (2.12s)
=== RUN   TestAccTimeOffset_OffsetDays
--- PASS: TestAccTimeOffset_OffsetDays (1.12s)
=== RUN   TestAccTimeOffset_OffsetHours
--- PASS: TestAccTimeOffset_OffsetHours (1.23s)
=== RUN   TestAccTimeOffset_OffsetMinutes
--- PASS: TestAccTimeOffset_OffsetMinutes (1.12s)
=== RUN   TestAccTimeOffset_OffsetMonths
--- PASS: TestAccTimeOffset_OffsetMonths (1.12s)
=== RUN   TestAccTimeOffset_OffsetSeconds
--- PASS: TestAccTimeOffset_OffsetSeconds (1.39s)
=== RUN   TestAccTimeOffset_OffsetYears
--- PASS: TestAccTimeOffset_OffsetYears (2.22s)
=== RUN   TestAccTimeOffset_OffsetYearsAndMonths
--- PASS: TestAccTimeOffset_OffsetYearsAndMonths (1.35s)
=== RUN   TestAccTimeOffset_Upgrade
--- PASS: TestAccTimeOffset_Upgrade (1.50s)
=== RUN   TestAccTimeOffset_Validators
--- PASS: TestAccTimeOffset_Validators (0.20s)
=== RUN   TestAccTimeRotating_Triggers
=== PAUSE TestAccTimeRotating_Triggers
=== RUN   TestAccTimeRotating_ComputedRFC3339RotationDays_basic
=== PAUSE TestAccTimeRotating_ComputedRFC3339RotationDays_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationDays_basic
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationDays_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationDays_expired
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationDays_expired
=== RUN   TestAccTimeRotating_ComputedRFC3339RotationHours_basic
=== PAUSE TestAccTimeRotating_ComputedRFC3339RotationHours_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationHours_basic
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationHours_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationHours_expired
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationHours_expired
=== RUN   TestAccTimeRotating_ComputedRFC3339RotationMinutes_basic
=== PAUSE TestAccTimeRotating_ComputedRFC3339RotationMinutes_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_basic
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_expired
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_expired
=== RUN   TestAccTimeRotating_ComputedRFC3339RotationMonths_basic
=== PAUSE TestAccTimeRotating_ComputedRFC3339RotationMonths_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationMonths_basic
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationMonths_basic
=== RUN   TestAccTimeRotating_RotationMonths_expired
=== PAUSE TestAccTimeRotating_RotationMonths_expired
=== RUN   TestAccTimeRotating_ComputedRFC3339RotationRfc3339_basic
=== PAUSE TestAccTimeRotating_ComputedRFC3339RotationRfc3339_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationRfc3339_basic
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationRfc3339_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC339RotationRfc3339_expired
=== PAUSE TestAccTimeRotating_ConfiguredRFC339RotationRfc3339_expired
=== RUN   TestAccTimeRotating_ComputedRFC3339RotationYears_basic
=== PAUSE TestAccTimeRotating_ComputedRFC3339RotationYears_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationYears_basic
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationYears_basic
=== RUN   TestAccTimeRotating_ConfiguredRFC3339RotationYears_expired
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339RotationYears_expired
=== RUN   TestAccTimeRotating_ComputedRFC3339_RotationDays_ToRotationMonths
=== PAUSE TestAccTimeRotating_ComputedRFC3339_RotationDays_ToRotationMonths
=== RUN   TestAccTimeRotating_ConfiguredRFC3339_RotationDays_ToRotationMonths
=== PAUSE TestAccTimeRotating_ConfiguredRFC3339_RotationDays_ToRotationMonths
=== RUN   TestAccTimeRotating_UpdateUnknownValue
=== PAUSE TestAccTimeRotating_UpdateUnknownValue
=== RUN   TestAccTimeRotating_LifecycleReplaceTriggeredBy
=== PAUSE TestAccTimeRotating_LifecycleReplaceTriggeredBy
=== RUN   TestAccTimeRotation_Upgrade
--- PASS: TestAccTimeRotation_Upgrade (1.89s)
=== RUN   TestAccTimeRotating_Validators
=== PAUSE TestAccTimeRotating_Validators
=== RUN   TestResourceTimeSleepCreate
--- PASS: TestResourceTimeSleepCreate (1.01s)
=== RUN   TestResourceTimeSleepDelete
--- PASS: TestResourceTimeSleepDelete (1.00s)
=== RUN   TestAccTimeSleep_CreateDuration
--- PASS: TestAccTimeSleep_CreateDuration (1.03s)
=== RUN   TestAccTimeSleep_DestroyDuration
--- PASS: TestAccTimeSleep_DestroyDuration (0.99s)
=== RUN   TestAccTimeSleep_Triggers
--- PASS: TestAccTimeSleep_Triggers (3.02s)
=== RUN   TestAccTimeSleep_Upgrade
--- PASS: TestAccTimeSleep_Upgrade (1.50s)
=== RUN   TestAccTimeSleep_Validators
--- PASS: TestAccTimeSleep_Validators (0.25s)
=== RUN   TestAccTimeStatic_basic
--- PASS: TestAccTimeStatic_basic (0.81s)
=== RUN   TestAccTimeStatic_Triggers
--- PASS: TestAccTimeStatic_Triggers (2.24s)
=== RUN   TestAccTimeStatic_Rfc3339
--- PASS: TestAccTimeStatic_Rfc3339 (0.85s)
=== RUN   TestAccTimeStatic_Upgrade
--- PASS: TestAccTimeStatic_Upgrade (1.93s)
=== RUN   TestAccTimeStatic_Validators
--- PASS: TestAccTimeStatic_Validators (0.20s)
=== CONT  TestUnixTimestampParseFunction_Valid
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationMonths_basic
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationHours_basic
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationDays_basic
=== CONT  TestAccTimeRotating_ComputedRFC3339RotationHours_basic
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_basic
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationYears_expired
=== CONT  TestAccTimeRotating_ComputedRFC3339RotationDays_basic
=== CONT  TestAccTimeRotating_UpdateUnknownValue
=== CONT  TestAccTimeRotating_ConfiguredRFC339RotationRfc3339_expired
=== CONT  TestAccTimeRotating_LifecycleReplaceTriggeredBy
=== CONT  TestAccTimeRotating_ComputedRFC3339RotationMonths_basic
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationYears_basic
=== CONT  TestAccTimeRotating_ComputedRFC3339RotationMinutes_basic
=== CONT  TestAccTimeRotating_Triggers
=== CONT  TestAccTimeRotating_Validators
--- PASS: TestAccTimeRotating_Validators (0.61s)
=== CONT  TestUnixTimestampParseFunction_Null
--- PASS: TestUnixTimestampParseFunction_Null (0.36s)
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_expired
--- PASS: TestUnixTimestampParseFunction_Valid (1.00s)
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationDays_expired
--- PASS: TestAccTimeRotating_ConfiguredRFC339RotationRfc3339_expired (1.30s)
=== CONT  TestAccTimeRotating_ComputedRFC3339RotationYears_basic
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationYears_expired (1.43s)
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationHours_expired
--- PASS: TestAccTimeRotating_UpdateUnknownValue (1.65s)
=== CONT  TestAccTimeRotating_ConfiguredRFC3339_RotationDays_ToRotationMonths
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_expired (1.28s)
=== CONT  TestAccTimeRotating_ComputedRFC3339_RotationDays_ToRotationMonths
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationDays_expired (1.30s)
=== CONT  TestAccTimeRotating_ComputedRFC3339RotationRfc3339_basic
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationDays_basic (2.60s)
=== CONT  TestAccTimeRotating_ConfiguredRFC3339RotationRfc3339_basic
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationHours_expired (1.17s)
=== CONT  TestAccTimeRotating_RotationMonths_expired
--- PASS: TestAccTimeRotating_ComputedRFC3339RotationHours_basic (2.63s)
--- PASS: TestAccTimeRotating_ComputedRFC3339RotationDays_basic (2.65s)
--- PASS: TestAccTimeRotating_ComputedRFC3339RotationMinutes_basic (2.66s)
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationMinutes_basic (2.68s)
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationMonths_basic (2.68s)
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationHours_basic (2.68s)
--- PASS: TestAccTimeRotating_ComputedRFC3339RotationMonths_basic (2.68s)
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationYears_basic (2.69s)
--- PASS: TestAccTimeRotating_Triggers (3.15s)
--- PASS: TestAccTimeRotating_ConfiguredRFC3339_RotationDays_ToRotationMonths (1.64s)
--- PASS: TestAccTimeRotating_ComputedRFC3339RotationYears_basic (2.03s)
--- PASS: TestAccTimeRotating_RotationMonths_expired (0.79s)
--- PASS: TestAccTimeRotating_ComputedRFC3339_RotationDays_ToRotationMonths (1.37s)
--- PASS: TestAccTimeRotating_ComputedRFC3339RotationRfc3339_basic (1.63s)
--- PASS: TestAccTimeRotating_ConfiguredRFC3339RotationRfc3339_basic (1.51s)
--- PASS: TestAccTimeRotating_LifecycleReplaceTriggeredBy (62.73s)
PASS
ok      github.com/hashicorp/terraform-provider-time/internal/provider  98.990s

@magodo magodo requested a review from a team as a code owner June 3, 2025 06:47
@magodo
Copy link
Copy Markdown
Author

magodo commented Jul 22, 2025

Kindly ping @bflad

@SBGoods SBGoods requested a review from a team as a code owner March 20, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ephemeral_resource: support not valid before type of leases

2 participants