disc / terraform-provider-pritunl

Pritunl Terraform provider

Home Page:https://pritunl.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

warnings in terraform log file

dlethin opened this issue · comments

I happened to notice a warning message scroll when running terraform import on one of my pritunl_host resources.

2021-10-23T07:32:18.609-0400 [WARN]  Provider "registry.terraform.io/disc/pritunl" produced an unexpected new value for pritunl_server.test during refresh.
      - .name: was null, but now cty.StringVal("terraform_test")
      - .network: was null, but now cty.StringVal("172.20.68.0/24")
      - .network_wg: was null, but now cty.StringVal("")
      - .organization_ids: was null, but now cty.ListVal([]cty.Value{cty.StringVal("[REDACTED]")})
      - .replica_count: was null, but now cty.NumberIntVal(1)
      - .search_domain: was null, but now cty.StringVal("")
      - .host_ids: was null, but now cty.ListVal([]cty.Value{cty.StringVal("[REDACTED]"), cty.StringVal("[REDACTED]")})
      - .block_outside_dns: was null, but now cty.False
      - .hash: was null, but now cty.StringVal("sha1")
      - .network_mode: was null, but now cty.StringVal("")
      - .bind_address: was null, but now cty.StringVal("")
      - .network_start: was null, but now cty.StringVal("")
      - .vxlan: was null, but now cty.False
      - .inter_client: was null, but now cty.False
      - .multi_device: was null, but now cty.False
      - .port_wg: was null, but now cty.NumberIntVal(0)
      - .cipher: was null, but now cty.StringVal("aes256")
      - .dns_servers: was null, but now cty.ListVal([]cty.Value{cty.StringVal("10.20.0.2"), cty.StringVal("9.9.9.9")})
      - .otp_auth: was null, but now cty.False
      - .port: was null, but now cty.NumberIntVal(20068)
      - .allowed_devices: was null, but now cty.StringVal("")
      - .ping_timeout: was null, but now cty.NumberIntVal(60)
      - .status: was null, but now cty.StringVal("offline")
      - .link_ping_timeout: was null, but now cty.NumberIntVal(5)
      - .inactive_timeout: was null, but now cty.NumberIntVal(0)
      - .ipv6: was null, but now cty.False
      - .network_end: was null, but now cty.StringVal("")
      - .pre_connect_msg: was null, but now cty.StringVal("")
      - .dh_param_bits: was null, but now cty.NumberIntVal(2048)
      - .dns_mapping: was null, but now cty.False
      - .link_ping_interval: was null, but now cty.NumberIntVal(1)
      - .max_clients: was null, but now cty.NumberIntVal(2000)
      - .max_devices: was null, but now cty.NumberIntVal(0)
      - .mss_fix: was null, but now cty.NumberIntVal(0)
      - .debug: was null, but now cty.False
      - .protocol: was null, but now cty.StringVal("udp")
      - .restrict_routes: was null, but now cty.False
      - .ping_interval: was null, but now cty.NumberIntVal(10)
      - .route: block count changed from 0 to 1

I'm running essentially these commands:

terraform init
terraform apply
terraform state rm pritunl_server.test
TF_LOG=debug terraform import pritunl_server.test [REDACTED-hostid]
terraform plan

Everything appears to work fine. The plan runs cleanly, showing no changes.

Actually, I noticed another warning when I running terraform plan with logging enabled

pritunl_server.test: Refreshing state... [id=[REDACTED]]
2021-10-23T07:41:44.237-0400 [WARN]  Provider "registry.terraform.io/disc/pritunl" produced an invalid plan for pritunl_server.test, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .groups: planned value cty.NullVal(cty.List(cty.String)) does not match config value cty.ListValEmpty(cty.String)
      - .inactive_timeout: planned value cty.NumberIntVal(0) for a non-computed attribute
      - .inter_client: planned value cty.False for a non-computed attribute
      - .ipv6: planned value cty.False for a non-computed attribute
      - .block_outside_dns: planned value cty.False for a non-computed attribute
      - .protocol: planned value cty.StringVal("udp") for a non-computed attribute
      - .dns_mapping: planned value cty.False for a non-computed attribute
      - .vxlan: planned value cty.False for a non-computed attribute
      - .allowed_devices: planned value cty.StringVal("") for a non-computed attribute
      - .pre_connect_msg: planned value cty.StringVal("") for a non-computed attribute
      - .max_devices: planned value cty.NumberIntVal(0) for a non-computed attribute
      - .network_end: planned value cty.StringVal("") for a non-computed attribute
      - .restrict_routes: planned value cty.False for a non-computed attribute
      - .bind_address: planned value cty.StringVal("") for a non-computed attribute
      - .network_start: planned value cty.StringVal("") for a non-computed attribute
      - .hash: planned value cty.StringVal("sha1") for a non-computed attribute
      - .network_mode: planned value cty.StringVal("") for a non-computed attribute
      - .network_wg: planned value cty.StringVal("") for a non-computed attribute
      - .debug: planned value cty.False for a non-computed attribute
      - .mss_fix: planned value cty.NumberIntVal(0) for a non-computed attribute
      - .multi_device: planned value cty.False for a non-computed attribute
      - .otp_auth: planned value cty.False for a non-computed attribute
      - .port_wg: planned value cty.NumberIntVal(0) for a non-computed attribute
      - .search_domain: planned value cty.StringVal("") for a non-computed attribute
      - .route[0].comment: planned value cty.StringVal("") for a non-computed attribute
2021-10-23T07:41:44.239-0400 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-10-23T07:41:44.240-0400 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/disc/pritunl/0.1.1/darwin_amd64/terraform-provider-pritunl_v0.1.1 pid=2318
2021-10-23T07:41:44.240-0400 [DEBUG] provider: plugin exited
2021-10-23T07:41:44.240-0400 [INFO]  backend/local: plan operation completed

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Maybe the first warning shown above is related to the message from the second warning - "but we are tolerating it because it is using the legacy plugin SDK."?

My resource looks like this:

resource "pritunl_server" "test" {
  name="terraform_test"

  groups = []

  organization_ids = [
    "[REDACTED]"
  ]

  # looking these up.
  host_ids = [for host in local.host_names:
    data.pritunl_host.host[host].id
  ]

  network = "172.20.68.0/24"
  port = 20068
  cipher             = "aes256"
  dns_servers        = [
    "10.20.0.2",
    "9.9.9.9",
  ]

  route {
     network =     "10.20.0.2/32"
     nat = false
  }
}

I guess if the functionality is working, maybe I shouldn't worry so much about noise in the log files as we don't regularly look there. Just wanted to report this in case it was indicative of a problem in the code. Not sure if terraform is planning on deprecating the legacy plugin API at some point?

Cheers.

I gather its essentially related to this -- hashicorp/terraform#28454 (comment)
So probably not to do or can be done unless this provider migrates to the next gen plugin API.