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

False diff #245

Closed
remche opened this issue Sep 3, 2020 · 8 comments · Fixed by #246
Closed

False diff #245

remche opened this issue Sep 3, 2020 · 8 comments · Fixed by #246

Comments

@remche
Copy link
Contributor

remche commented Sep 3, 2020

I have false diff when reapplying with the terraform and rke provider versions.

$ terraform version
Terraform v0.13.1
+ provider registry.terraform.io/hashicorp/local v1.4.0
+ provider registry.terraform.io/hashicorp/null v2.1.2
+ provider registry.terraform.io/rancher/rke v1.1.1
+ provider registry.terraform.io/terraform-providers/openstack v1.31.0

Sanitized output.log and debug.log attached.
output.log
debug.log

@rawmind0
Copy link
Contributor

rawmind0 commented Sep 3, 2020

Could you please provider more concrete info?? What is detecting as a change??

Configuring provider with debug (not terraform debug) and log file like

provider "rke" {
  debug = true
  log_file = "rke_debug.log"
}

you'll get debug messages on log_file like

...
time="2020-08-19T13:02:50Z" level=info msg="rke_cluster changed arguments: map[<argument_name>:true]"
time="2020-08-19T13:02:50Z" level=debug msg="<argument_name> old: 60 new: 120"
...

Could you please test it and take a look on debug messages saying what is changing on your apply??

@remche
Copy link
Contributor Author

remche commented Sep 4, 2020

@rawmind0 there is no change in the rke_debug.log file... but it keeps changing output of rke_cluster.
rke_debug.log

It might be caused by the way terraform deals with data sources in 0.13 versions (see end of the debug log) : hashicorp/terraform#26100

@rawmind0
Copy link
Contributor

rawmind0 commented Sep 4, 2020

@remche , i think i'm not fully understand the issue. output.log is saying that no changes in the plan, Plan: 0 to add, 0 to change, 0 to destroy.

What kind of output are you using, files?? What i saw in the log is that the provider is not generating changes on the plan, but the output is adding computed fields and eventually changing the list fields order due to it's yaml content and order is not assured on marshal/unmarshal. Diff on this provider is tricky due to managing yaml content. You can have distinct yaml content (due to "random" order at list) that at the end is generating equal object. I guess that this is what terraform is showing on the output. This was working fine on tf 0.12??

@remche
Copy link
Contributor Author

remche commented Sep 4, 2020

@rawmind0 you're right, there is no changes to be applied but changes to outputs. I'm not using file for rke_cluster output.

I had a look at terraform output diff, and it turns out that the certificates array causes the false diff. I did not see such behavior with tf0.12.

@remche
Copy link
Contributor Author

remche commented Sep 4, 2020

FYI, I filtered my output to exclude some unused fields whose certificates array. That fixed it.
I'm curious why host array never produce output diff though.

@rawmind0
Copy link
Contributor

rawmind0 commented Sep 4, 2020

Nodes array is being sorted before being saved at tfstate, https://github.com/rancher/terraform-provider-rke/blob/master/rke/structure_rke_cluster_node.go#L55 , that's why not generating diff.

Ordering certificates is provided on PR #246 , that should address this issue. Could you please test it??

@remche
Copy link
Contributor Author

remche commented Sep 7, 2020

I can confirm it's fixed by PR.

@rawmind0
Copy link
Contributor

rawmind0 commented Sep 8, 2020

Cool. Please reopen issue if needed.

@rawmind0 rawmind0 closed this as completed Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants