Open
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
Terraform v0.15.4
on darwin_amd64
+ provider registry.terraform.io/hashicorp/time v0.7.1
Affected Resource(s)
- time_rotating
Terraform Configuration Files
resource "time_rotating" "test" {
rfc3339 = "2021-06-20T12:43:13Z"
rotation_minutes = 7
}
Debug Output
Output
> terraform apply -auto-approve
time_rotating.test: Refreshing state... [id=2021-06-20T12:43:13Z]
Note: Objects have changed outside of Terraform
Terraform detected the following changes made outside of
Terraform since the last "terraform apply":
# time_rotating.test has been deleted
- resource "time_rotating" "test" {
- day = 20 -> null
- hour = 12 -> null
- id = "2021-06-20T12:43:13Z" -> null
- minute = 43 -> null
- month = 6 -> null
- rfc3339 = "2021-06-20T12:43:13Z" -> null
- rotation_minutes = 7 -> null
- rotation_rfc3339 = "2021-06-20T12:50:13Z" -> null
- second = 13 -> null
- unix = 1624192993 -> null
- year = 2021 -> null
}
Unless you have made equivalent changes to your
configuration, or ignored the relevant attributes using
ignore_changes, the following plan may include actions to
undo or respond to these changes.
──────────────────────────────────────────────────────────
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_rotating.test will be created
+ resource "time_rotating" "test" {
+ day = (known after apply)
+ hour = (known after apply)
+ id = (known after apply)
+ minute = (known after apply)
+ month = (known after apply)
+ rfc3339 = "2021-06-20T12:43:13Z"
+ rotation_minutes = 7
+ rotation_rfc3339 = (known after apply)
+ second = (known after apply)
+ unix = (known after apply)
+ year = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
time_rotating.test: Creating...
time_rotating.test: Creation complete after 0s [id=2021-06-20T12:43:13Z]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Panic Output
Expected Behavior
- The resource is created after the first call of
terraform apply
and not created again before the date rfc3339 + rotation_minutes (in the example above:2021-06-20T12:50:13Z
) has passed. - After the date has passed the next call of
terraform apply
will re-create the resource. If I callterraform apply
again the resource should not be re-created as long as the current date is lower than the next rotation date (would be rfc3339 + rotation_minutes * 2)
short:
- tf init
- tf apply -> initial create
- tf apply -> nop
- tf apply -> nop
- time has passed rfc3339 + rotation_minutes
- tf apply -> re-create resource
- tf apply -> nop
- time has passed rfc3339 + rotation_minutes * 2
- tf apply -> re-create resource
- tf apply -> nop
...
Actual Behavior
- As expected: The resource is created after the first call of
terraform apply
and not created again before the date rfc3339 + rotation_minutes (in the example above:2021-06-20T12:50:13Z
) has passed. - After the date has passed each call of
terraform apply
leads to the re-creation of the resource.
short:
- tf init
- tf apply -> initial create
- tf apply -> nop
- tf apply -> nop
- time has passed rfc3339 + rotation_minutes
- tf apply -> re-create resource
- tf apply -> re-create resource
- tf apply -> re-create resource
- tf apply -> re-create resource
...
Steps to Reproduce
With the example above it should be enough to call:
terraform init
terraform apply
- initial creationterraform apply
- re-creation
Important Factoids
References
- #0000
Thank you for your work on Terraform ❤️
Metadata
Metadata
Assignees
Labels
No labels