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

Fix cloudflare_api_token's modified_on field #1368

Merged
merged 4 commits into from
Jan 11, 2022
Merged

Fix cloudflare_api_token's modified_on field #1368

merged 4 commits into from
Jan 11, 2022

Conversation

danopia
Copy link
Contributor

@danopia danopia commented Jan 4, 2022

For some reason this field was always set to time.Now() when reading, which shows as drift in every Terraform plan:

Terraform detected the following changes made outside of Terraform since the
last "terraform apply":

  # cloudflare_api_token.external-dns has changed
  ~ resource "cloudflare_api_token" "external-dns" {
        id          = "[redacted]"
      ~ modified_on = "2021-11-05T09:23:00.921389278Z" -> "2022-01-04T14:35:50.581109737Z"
        name        = "external dns"
        # (3 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

It's always shown as the exact time of the plan, which is definitely not when every token was last modified!

It looks like the swap happened within the PR adding this resource: 02bb4db so as an outsider I don't have an explanation for why time.Now() was inserted.

For some reason this field was always set to time.now, which shows as drift in every Terraform plan.
@jacobbednarz
Copy link
Member

thanks for the PR! this needs a CHANGELOG entry added before we can merge this.

@danopia
Copy link
Contributor Author

danopia commented Jan 11, 2022

I added a changelog, looks like they want to be one line otherwise I would've mentioned how it fixes Objects have changed outside of Terraform messages.

I also took the time to figure out how to use a custom provider build locally, and this patch does actually work & resolve the issue :)

@jacobbednarz jacobbednarz merged commit 8ee33b8 into cloudflare:master Jan 11, 2022
@jacobbednarz
Copy link
Member

thank you! i'm really glad you took the time to go through those steps and got a better understanding of how this all works together 😄

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

Successfully merging this pull request may close these issues.

2 participants