jeremmfr / terraform-provider-junos

Terraform provider for Junos devices
https://registry.terraform.io/providers/jeremmfr/junos
MIT License
62 stars 22 forks source link

Bug: junos_security_ike_gateway Value Conversion Error #533

Closed giulianna14 closed 1 year ago

giulianna14 commented 1 year ago

Terraform and Provider Versions

Terraform 1.5.3
Provider 2.1.1

Terraform Configuration Files

resource "junos_security_ike_gateway" "gateway" {
  for_each           = var.tunnels
  name               = "ike_gw_${each.key}"
  address            = [var.tunnels[each.key].public_ip
  policy             = junos_security_ike_policy.gateway[each.key].name
  external_interface = junos_interface_logical.dmz.name
  no_nat_traversal   = true
  version            = "v2-only"
  dead_peer_detection {
    interval  = 10
    threshold = 3
    send_mode = "always-send"
  }
  local_identity {
    type  = "inet"
    value = var.public_ip
  }
  remote_identity {
    type  = "inet"
    value = var.tunnels[each.key].public_ip
  }
}

Expected Behavior

A successful plan.

Actual Behavior

 Error: Value Conversion Error
│ 
│   with module.shared-awsvpn-settings[0].junos_security_ike_gateway.gateway["gateway"],
│   on modules/shared-awsvpn-settings/vpn.tf line 57, in resource "junos_security_ike_gateway" "gateway":
│   57: resource "junos_security_ike_gateway" "gateway" {
│ 
│ An unexpected error was encountered trying to convert tftypes.Value into
│ providerfwk.securityIkeGatewayBlockRemoteIdentity. This is always an error
│ in the provider. Please report the following to the provider developer:
│ 
│ mismatch between struct and object: Struct defines fields not found in
│ object: distinguished_name_container and distinguished_name_wildcard.
╵

Steps to Reproduce

  1. terraform plan

We thank you for any help you can provide! If we can provide any further details please let us know.

jeremmfr commented 1 year ago

Hi @giulianna14 👋 Thank you for reporting this issue. This bug only appears when upgrading the provider before v2.0.0 to v2.0.0...v2.1.1 and there are junos_security_ike_gateway resources with remote_identity block set in Terraform state. I'll take care of fixing this quickly.

giulianna14 commented 1 year ago

@jeremmfr, Thank you very much for the quick code fix!