terraform-provider-ibm icon indicating copy to clipboard operation
terraform-provider-ibm copied to clipboard

Error trying to read ibm_satellite_endpoint resource

Open rmoe opened this issue 2 years ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform IBM Provider Version

$ terraform -v
Terraform v1.2.9
on linux_amd64
+ provider registry.terraform.io/bgpat/travis v1.4.0
+ provider registry.terraform.io/gavinbunney/kubectl v1.14.0
+ provider registry.terraform.io/hashicorp/helm v2.5.1
+ provider registry.terraform.io/hashicorp/kubernetes v2.11.0
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/time v0.8.0
+ provider registry.terraform.io/ibm-cloud/ibm v1.44.3
+ provider registry.terraform.io/logdna/logdna v1.8.0
+ provider registry.terraform.io/pagerduty/pagerduty v2.4.0
+ provider registry.terraform.io/sysdiglabs/sysdig v0.5.30

Affected Resource(s)

  • ibm_satellite_endpoint

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.


resource "ibm_satellite_endpoint" "manager_link" {
  location        = ibm_satellite_location.sat-location.id
  connection_type = "location"
  display_name    = "manager-link"
  server_host     = ibm_satellite_cluster.sat-cluster.ingress_hostname
  server_port     = 30060
  client_protocol = "https"
  server_protocol = "tls"
}

Expected Behavior

Terraform can read the resource so we can run a plan.

Actual Behavior

Any action which reads the satellite link resource fails with:

│ Error: [ERROR] Error setting performance: Invalid address to set: []string{"performance", "0", "connectors", "0", "txBW"}

Steps to Reproduce

  1. Create a satellite endpoint.
  2. Run terraform plan and it might fail.

Important Factoids

The issue here is when the endpolnt has performance data, specifically connectors. The provider tries to set RxBW and TxBW attributes but I don't see those in the raw response from the API. For our failing endpoint the API returns:

    "Result": {
        "conn_type": "location",
        "display_name": "manager-link",

        <A bunch of other attributes>

        "performance": {
            "connection": 15,
            "rx_bandwidth": 32,
            "tx_bandwidth": 15,
            "bandwidth": 47,
            "connectors": [
                {
                    "connector": "satellite-link-connector-xrp9g",
                    "connections": 6
                },
                {
                    "connector": "satellite-link-connector-rxbv6",
                    "connections": 6
                },
                {
                    "connector": "satellite-link-connector-jcqgh",
                    "connections": 3
                }
            ]
        }
    },

The connectors only have two attributes but it looks like the provider is trying to update the object in Terraform state with 4 attributes (two of which end up as nil) which causes the error shown above.

rmoe avatar Sep 21 '22 22:09 rmoe