v2.3.0
func resourceChannelTestingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
var diags diag.Diagnostics
// Read API DATA into `current`
diags = append(diags, diag.Diagnostic{
Severity: diag.Warning,
Summary: "Debug dumping",
Detail: fmt.Sprintf("%+v", current),
})
// Set some properties
return diags
}
resource "fpp_channel_testing" "main" {
enabled = false
mode = "foo"
}
Diff such as the following should be produced.
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
2020/12/07 22:05:03 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
~ update in-place
2020/12/07 22:05:03 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
Terraform will perform the following actions:
# fpp_channel_testing.main will be updated in-place
~ resource "fpp_channel_testing" "main" {
~ enabled = true -> false
id = "static"
~ mode = "RGBChase" -> "foo"
}
Plan: 0 to add, 1 to change, 0 to destroy.
Warning was produced but no diff identified.
2020/12/07 22:04:31 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
No changes. Infrastructure is up-to-date.
2020/12/07 22:04:31 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.
Warning: Debug dumping
{Mode:RGBChase SubMode:RGBChase-RGB CycleMS:1000
ColorPattern:FF000000FF000000FF Color1:<nil> Color2:<nil> Color3:<nil>
Enabled:1 ChannelSet:1-8 ChannelSetType:channelRange}
terraform plan
This _might_ be intentional behaviour, if it is it should be clearly documented somewhere and I don't see it. The issue from my point of view is that if the ReadContext implementation produces a Warning (something I consider non-fatal) then no diff is identified even if there were changes. The output from plan clearly states "Terraform did not detect any differences between your
configuration and real physical resources that exist" when there were changes identified, it feels wrong to hide this information just because there was a warning.
I'm also open for the fact that this could be an issue in terraform and not in the plugin-sdk but I thought I would start here as that's where the Diagnostics and ReadContext apis/types reside.
I may be getting hit by this too. My current workaround is to avoid emiting the warning. But it seems like warnings should be informational only and not prevent resource state synchronization.
Did some testing changing the terraform-cli version.
I've been able to reproduce this with 0.14.0 and 0.14.2. But not with the current main branch version (3268a7ea).
May I assume this will be fixed in 0.14.3?
Update: still reproduces in 0.14.3
I'm going to move this to the hashicorp/terraform repo, as this is Terraform core's functionality. Sorry for the confusion there. :(
Closing since this is confirmed as fixed in master.
Thanks!
Most helpful comment
I'm going to move this to the hashicorp/terraform repo, as this is Terraform core's functionality. Sorry for the confusion there. :(