CiscoDevNet / terraform-provider-aci

Terraform Cisco ACI provider
https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs
Mozilla Public License 2.0
88 stars 100 forks source link

datasource of aci_interface_config doesn't provide output all parameters are null #1153

Closed micronemo closed 7 months ago

micronemo commented 7 months ago

Community Note

Terraform Version

APIC version and APIC Platform

Affected Resource(s)

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

datasource of aci_interface_config provides a output

Actual Behavior

datasource of aci_interface_config doesn't provide output all parameters are null

Steps to Reproduce

  1. terraform apply

Important Factoids

References

akinross commented 7 months ago

Hi @micronemo,

Could you provide a bit more details on the what you did, and or provide config used and logs. I just did a test on the same version and see that state is populated as expected.

micronemo commented 7 months ago

data "aci_interface_config" "test" { interface = "1/1" node = 101 }

output "pippo" { value = data.aci_interface_config.test }

akinross commented 7 months ago

Hi @micronemo,

Could you please provide the logs with TF_LOG set to TRACE? See link https://developer.hashicorp.com/terraform/internals/debugging with additional information on debugging.

Could you also provide me the configuration as present on the apic?

What is the port type of the interface you are trying get the information from access or fabric? I can only replicate your output when I provide the wrong port type (default is access when not provided).

data "aci_interface_config" "access_port_config_1001" {
  node         = 1001
  interface    = "1/1"
  port_type = "fabric"
}

26f4dab604e9:/test# terraform plan
data.aci_interface_config.access_port_config_1001: Reading...
data.aci_interface_config.access_port_config_1001: Read complete after 1s

Changes to Outputs:
  + pippo = {
      + admin_state                      = null
      + annotation                       = null
      + breakout                         = null
      + description                      = null
      + id                               = null
      + interface                        = null
      + name_alias                       = null
      + node                             = null
      + operational_associated_group     = null
      + operational_associated_sub_group = null
      + pc_member                        = null
      + pc_port_dn                       = null
      + policy_group                     = null
      + port_dn                          = null
      + port_type                        = null
      + role                             = null
    }

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
data "aci_interface_config" "access_port_config_1001" {
  node         = 1001
  interface    = "1/1"
}

26f4dab604e9:/test# terraform plan
data.aci_interface_config.access_port_config_1001: Reading...
data.aci_interface_config.access_port_config_1001: Read complete after 1s [id=uni/infra/portconfnode-1001-card-1-port-1-sub-0]

Changes to Outputs:
  + pippo = {
      + admin_state                      = "up"
      + annotation                       = "orchestrator:terraform"
      + breakout                         = ""
      + description                      = "Access Port created using TF"
      + id                               = "uni/infra/portconfnode-1001-card-1-port-1-sub-0"
      + interface                        = "1/1/0"
      + name_alias                       = null
      + node                             = 1001
      + operational_associated_group     = "uni/infra/funcprof/accportgrp-leaf_access_port"
      + operational_associated_sub_group = ""
      + pc_member                        = ""
      + pc_port_dn                       = ""
      + policy_group                     = "uni/infra/funcprof/accportgrp-leaf_access_port"
      + port_dn                          = "topology/pod-1/paths-1001/pathep-[eth1/1]"
      + port_type                        = "access"
      + role                             = "leaf"
    }

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
akinross commented 7 months ago

Hi @micronemo, could you please provide us the requested information so I can assist you further with your issue?

akinross commented 7 months ago

Hi @micronemo, did you get a chance to look at the comments?

micronemo commented 7 months ago

thanks i update terraform and i try again, now works thanks very much

micronemo commented 7 months ago

i update terraform and i try again, now works thanks very much

akinross commented 7 months ago

Hi @micronemo,

I have set this issue back to reviewer approved, because I have attached a PR to raise an error for when object is not found. This one is currently still in our approval process until it can be merged into master.