NikolaLohinski / terraform-provider-freebox

🔌 A terraform provider to interact with a famous French ISP box
https://nikolalohinski.github.io/terraform-provider-freebox
2 stars 1 forks source link

No way to terraform plan after upgrade to the release 1.2.0 #3

Open gbloquel opened 3 days ago

gbloquel commented 3 days ago

Hi @NikolaLohinski,

I have upgraded your provider from (1.1.1) to your latest version (1.2.0).

After the upgrade no way to terraform plan . I have the following message

Planning failed. Terraform encountered an error while generating this plan.

│ Error: Go Duration ValueDuration Error
│ 
│   with freebox_virtual_machine.homeassistant,
│   on homeassistant.tf line 1, in resource "freebox_virtual_machine" "homeassistant":
│    1: resource "freebox_virtual_machine" "homeassistant" {
│ 
│ Duration string value is null

As the error indicates a problem with the duration I tried to override the embedded properties of timeouts but the problem seems to be elsewhere.

I have also activated the terraform logs in trace mode. but nothing interesting I think

....
2024-07-04T09:01:56.573+0200 [TRACE] provider.terraform-provider-freebox_v1.2.0: Called provider defined Resource Read: tf_provider_addr=registry.terraform.io/nikolalohinski/freebox tf_req_id=5e17fd43-f746-cdb9-1221-2454a61e3f12 tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-framework@v1.8.0/internal/fwserver/server_readresource.go:102 tf_resource_type=freebox_virtual_machine @module=sdk.framework timestamp="2024-07-04T09:01:56.573+0200"
2024-07-04T09:01:56.573+0200 [TRACE] provider.terraform-provider-freebox_v1.2.0: Received downstream response: diagnostic_error_count=1 diagnostic_warning_count=0 tf_proto_version=6.6 @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/tf6serverlogging/downstream_request.go:42 @module=sdk.proto tf_req_id=5e17fd43-f746-cdb9-1221-2454a61e3f12 tf_provider_addr=registry.terraform.io/nikolalohinski/freebox tf_req_duration_ms=40 tf_resource_type=freebox_virtual_machine tf_rpc=ReadResource timestamp="2024-07-04T09:01:56.573+0200"
2024-07-04T09:01:56.573+0200 [ERROR] provider.terraform-provider-freebox_v1.2.0: Response contains error diagnostic: diagnostic_detail="Duration string value is null" diagnostic_severity=ERROR diagnostic_summary="Go Duration ValueDuration Error" tf_proto_version=6.6 tf_provider_addr=registry.terraform.io/nikolalohinski/freebox tf_resource_type=freebox_virtual_machine @module=sdk.proto tf_req_id=5e17fd43-f746-cdb9-1221-2454a61e3f12 tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/diag/diagnostics.go:58 timestamp="2024-07-04T09:01:56.573+0200"
2024-07-04T09:01:56.574+0200 [TRACE] provider.terraform-provider-freebox_v1.2.0: Served request: @module=sdk.proto tf_provider_addr=registry.terraform.io/nikolalohinski/freebox tf_rpc=ReadResource @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/tf6server/server.go:802 tf_resource_type=freebox_virtual_machine tf_proto_version=6.6 tf_req_id=5e17fd43-f746-cdb9-1221-2454a61e3f12 timestamp="2024-07-04T09:01:56.573+0200"
2024-07-04T09:01:56.574+0200 [ERROR] vertex "freebox_virtual_machine.homeassistant" error: Go Duration ValueDuration Error
....
gbloquel commented 3 days ago

I have found an explanation.

My resource freebox_virtual_machine has been imported in version 1.1.1 Below the state of timeouts

$ terraform state show freebox_virtual_machine.homeassistant

# freebox_virtual_machine.homeassistant:
resource "freebox_virtual_machine" "homeassistant" {

...
timeouts           = {
        create = "5m"
        delete = "5m"
        kill   = "30s"
        read   = "5m"
        update = "5m"
    }
}

In the version 1.2.0 you added the networking field in the timeouts

the networking was not available and after I switch into 1.2.0 the terraform plan produces Duration string value is null for the field networking.

Workaround:

terraform state show freebox_virtual_machine.homeassistant
# freebox_virtual_machine.homeassistant:
resource "freebox_virtual_machine" "homeassistant" {
    ...
    timeouts           = {
        create     = "5m"
        delete     = "5m"
        kill       = "30s"
        networking = "1m"
        read       = "5m"
        update     = "5m"
    }

  ...
}

NikolaLohinski commented 3 days ago

Hi @gbloquel

Indeed the new version has a new timeout field which I did not bother to properly write the upgrade code for ; my apologies for that.

I'll make a fix for any other user that might be impacted.

Thanks for the feedback and happy to see that someone else than me is finding some usefulness in this niche provider.

Cheers