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

Checksum is still recalculated every time even without any change #230

Closed
headyj opened this issue Jan 12, 2024 · 7 comments · Fixed by #276
Closed

Checksum is still recalculated every time even without any change #230

headyj opened this issue Jan 12, 2024 · 7 comments · Fixed by #276
Labels
bug Something isn't working needs:triage

Comments

@headyj
Copy link

headyj commented Jan 12, 2024

I'm opening a new ticket as I cannot re-open this one which didn't solved the initial issue: I'm still seeing changes on lineage even if nothing changed:

diff -r --exclude=.git before/e7c1772d-ed18-4152-b377-76e772881dfd after/e7c1772d-ed18-4152-b377-76e772881dfd
diff -r '--exclude=.git' before/e7c1772d-ed18-4152-b377-76e772881dfd/.terraform/terraform.tfstate after/e7c1772d-ed18-4152-b377-76e772881dfd/.terraform/terraform.tfstate
4c4
<     "lineage": "9ea5911a-af97-2a17-e6de-02744de7a523",
---
>     "lineage": "26605bb9-21a7-840b-58cd-00c67697da34",
Crossplane Version: v1.14.5
Provider Version: v0.13.0
Kubernetes Version: v1.27
Kubernetes Distribution: EKS
@headyj headyj added bug Something isn't working needs:triage labels Jan 12, 2024
@bobh66
Copy link
Collaborator

bobh66 commented Jan 15, 2024

I think it's reasonable to exclude the .terraform/terraform.tfstate file from the checksum calculation, since we are really just trying to checksum the desired state to see if it changed. We might even be able to exclude the entire .terraform directory since that should only be modified by the CLI and not by the user. Thoughts @ytsarev ?

@bobh66 bobh66 changed the title Cheksum is still recalculated every time even without any change Checksum is still recalculated every time even without any change Jan 16, 2024
@ytsarev
Copy link
Member

ytsarev commented Jan 17, 2024

@bobh66 yes, that sounds good to me 👍

@headyj
Copy link
Author

headyj commented Jan 19, 2024

@ytsarev for sure it will fix the issue, but is it really safe? I mean according to terraform documentation:

Differing lineage: The "lineage" is a unique ID assigned to a state when it is created. If a lineage is different, then it means the states were created at different times and its very likely you're modifying a different state. Terraform will not allow this.

https://developer.hashicorp.com/terraform/language/state/backends#manual-state-pull-push

@bobh66
Copy link
Collaborator

bobh66 commented Jan 19, 2024

Does lineage change every time terraform plan is run? Or only when terraform apply is run? If it changes on every plan execution then we will never be able to assume no changes (which doesn't really make sense). If it is only changing on apply then it should be safe to include the tfstate file since we're (hopefully) not running apply on every reconciliation.

@headyj
Copy link
Author

headyj commented Jan 22, 2024

I cannot answer this one as I'm not an expert of terraform. But anyway the behavior should not be different if the sources are local or coming from a git repository I assume, which was originally the problem of the first ticket I opened: #198

@headyj
Copy link
Author

headyj commented Jun 4, 2024

@bobh66 any news on that issue? As said I'm not an expert of terraform so I cannot guarantee that it's a safe to ignore lineage.

@project-administrator
Copy link

project-administrator commented Jun 12, 2024

I think this prevents us from using the concurrency (--max-reconcile-rate set to more than "1") because every workspace tries to run "terraform init" while any other workspace might already be running the "terraform plan/apply", and that usually results with a "text file busy" error.
Disabling the shared plugin cache is also a bad option because the provider-terraform will start re-downloading all TF providers for each TF workspace with every "terraform init" with each reconciliation...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs:triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants