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

Provider produced invalid plan #146

Open
sam701 opened this issue Dec 19, 2022 · 2 comments
Open

Provider produced invalid plan #146

sam701 opened this issue Dec 19, 2022 · 2 comments

Comments

@sam701
Copy link

sam701 commented Dec 19, 2022

Terraform Version

Terraform v1.3.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/time v0.9.1

Affected Resource(s)

  • provider.terraform-provider-time_v0.9.1_x5

Terraform Configuration Files

resource "time_rotating" "main" {
  count            = 2
  rotation_rfc3339 = timeadd(timestamp(), "10m")
}

Expected Behavior

terraform plan produces a plan without errors.

Actual Behavior

╷
│ Error: Provider produced invalid plan
│
│ Provider "registry.terraform.io/hashicorp/time" planned an invalid value for module.sp_grafana.time_rotating.main[1].rotation_rfc3339: planned value cty.StringVal("0001-01-01T00:00:00Z") does not match config value
│ cty.UnknownVal(cty.String) nor prior value cty.StringVal("2022-12-19T09:36:47Z").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

Changes of an existing resource on the field rotation_rfc3339 lead this this error:

terraform apply # resources created
terraform plan # resources exist but must be modified
@jskirde
Copy link

jskirde commented Jan 6, 2023

This issue seems to affect all time resources where the value on update is known after apply. Create doesn't appear to be affected.
An example of another time resource that can be created but not updated with a known after apply:

resource "time_offset" "example" {
  offset_days = formatdate("s", timestamp())
}

@SBGoods
Copy link
Contributor

SBGoods commented Aug 2, 2023

Hi @sam701,
Sorry that you are running into this issue here. As @jskirde mentioned, this issue stems from the rotation_rfc3339 attribute being updated with a value that is known after apply (timestamp() is calculated during the apply step). Unfortunately due to the nature of this resource, we cannot fix this issue as it would cause preemptive rotations to occur. If you are using Terraform v1.5.0 and above, you can use plantimestamp(), which calculates the time stamp during planning, instead to avoid this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants