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: Reading logical interface addresses on SRX300 doesn't populate addresses #438

Closed zachfi closed 1 year ago

zachfi commented 1 year ago

Terraform and Provider Versions

Terraform v1.3.4
on linux_amd64
+ provider registry.terraform.io/digitalocean/digitalocean v2.23.0
+ provider registry.terraform.io/hashicorp/vault v2.24.1
+ provider registry.terraform.io/integrations/github v4.31.0
+ provider registry.terraform.io/jeremmfr/junos v1.31.1
+ provider registry.terraform.io/psychopenguin/gandi v2.0.0-rc3```

### Terraform Configuration Files

```terraform
data "junos_interface_logical" "external" {
  config_interface = "ge-0/0/0.0"
}
resource "gandi_livedns_record" "test" {
  zone   = "example.com"
  name   = "ugh"
  type   = "TXT"
  ttl    = 360
  values = [format("%#v", data.junos_interface_logical.external)]
}

Expected Behavior

The string formatting above is just to view the json object. Not sure if there is a better way to show.

+ values = [
          + jsonencode(
                {
                  + config_interface           = "ge-0/0/0.0"
                  + description                = "external interface"
                  + disable                    = false
                  + family_inet                = [
                      + {
                          + address         = []
                          + dhcp            = [
                              + {
                                  + client_identifier_ascii                        = ""
                                  + client_identifier_hexadecimal                  = ""
                                  + client_identifier_prefix_hostname              = false
                                  + client_identifier_prefix_routing_instance_name = false
                                  + client_identifier_use_interface_description    = ""
                                  + client_identifier_userid_ascii                 = ""
                                  + client_identifier_userid_hexadecimal           = ""
                                  + force_discover                                 = false
                                  + lease_time                                     = 0
                                  + lease_time_infinite                            = false
                                  + metric                                         = -1
                                  + no_dns_install                                 = false
                                  + options_no_hostname                            = false
                                  + retransmission_attempt                         = -1
                                  + retransmission_interval                        = 0
                                  + server_address                                 = ""
                                  + srx_old_option_name                            = false
                                  + update_server                                  = false
                                  + vendor_id                                      = ""
                                },
                            ]
                          + filter_input    = ""
                          + filter_output   = ""
                          + mtu             = 0
                          + rpf_check       = []
                          + sampling_input  = false
                          + sampling_output = false
                        },
                    ]
                  + family_inet6               = [
                      + {
                          + address         = []
                          + dad_disable     = false
                          + dhcpv6_client   = [
                              + {
                                  + client_ia_type_na                         = true
                                  + client_ia_type_pd                         = true
                                  + client_identifier_duid_type               = "duid-ll"
                                  + client_type                               = "stateful"
                                  + no_dns_install                            = false
                                  + prefix_delegating_preferred_prefix_length = -1
                                  + prefix_delegating_sub_prefix_length       = 0
                                  + rapid_commit                              = false
                                  + req_option                                = []
                                  + retransmission_attempt                    = -1
                                  + update_router_advertisement_interface     = []
                                  + update_server                             = true
                                },
                            ]
                          + filter_input    = ""
                          + filter_output   = ""
                          + mtu             = 0
                          + rpf_check       = []
                          + sampling_input  = false
                          + sampling_output = false
                        },
                    ]
                  + id                         = "ge-0/0/0.0"
                  + match                      = null
                  + name                       = "ge-0/0/0.0"
                  + routing_instance           = ""
                  + security_inbound_protocols = [
                      + "router-discovery",
                    ]
                  + security_inbound_services  = [
                      + "dhcp",
                      + "dhcpv6",
                      + "ping",
                    ]
                  + security_zone              = "untrust"
                  + tunnel                     = []
                  + vlan_id                    = 0
                }
            ),
        ]

Steps to Reproduce

Create a data object that points to a logical interface. Try to reference address from the data object.

  1. terraform apply

Additional Context

I'm trying to create a DNS record for the external interface addresses, v4 and v6.

Let me know if I've overlooked something here.

zachfi commented 1 year ago

Sorry, I think I already filed this on https://github.com/jeremmfr/terraform-provider-junos/issues/393, but didn't come back to fix the environment. Checking on the results over there.

zachfi commented 1 year ago

Yep, works like a charm using the new resource. Sorry for the noise.