cisco-en-programmability / terraform-provider-dnacenter

https://registry.terraform.io/providers/cisco-en-programmability/dnacenter/latest/docs
MIT License
14 stars 12 forks source link

Provider crash when executing dnacenter_network_create #99

Closed mschedrin closed 1 year ago

mschedrin commented 1 year ago

Prerequisites

Describe the bug Terraform provider crashes when creating resouce dnacenter_network_create. Terraform output: cli_output.txt Terraform debug: tf.log

Terraform configuration contains only reource dnacenter_network_create:

resource "dnacenter_network_create" "global" {
  provider = dnacenter

  parameters {

    settings {
      dhcp_server = ["1.1.1.1"]
    }

    site_id = "771662ca-cb7e-47ff-9eaf-9b8c85e8e389"
  }
}

Expected behavior Expected behavior is that provider does not crash and performs requested configuration towards DNAC controller.

Screenshots Postman call works correct:

image

Environment (please complete the following information):

mschedrin commented 1 year ago

I've tested with DNAC version 2.3.3.4-72142, the provider still crashes.

fmunozmiranda commented 1 year ago

@mschedrin , there's new provider version (1.0.12-beta), problem should be solved, update us if it works for you.

mschedrin commented 1 year ago

@fmunozmiranda I have installed new version and provider does not crash any more, however dnacenter_network_create resource still does not work correct. Terraform reports that resource has been created successfully but I can not see the changes reflected in DNAC. I have taken a look in TF debug log and see that corresponding POST request has empty settings section in it's body:

==============================================================================
~~~ REQUEST ~~~
POST  /dna/intent/api/v1/network/771662ca-cb7e-47ff-9eaf-9b8c85e8e389  HTTP/1.1
HOST   : 198.18.133.101
HEADERS:
    Accept: application/json
    Content-Type: application/json
    User-Agent: go-resty/2.7.0 (https://github.com/go-resty/resty)
    X-Auth-Token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2MWQyMzIxYWZiODI0NTMzZTA4YjVjZWQiLCJhdXRoU291cmNlIjoiaW50ZXJuYWwiLCJ0ZW5hbnROYW1lIjoiVE5UMCIsInJvbGVzIjpbIjYxZDIzMjE5ZmI4MjQ1MzNlMDhiNWNlYyJdLCJ0ZW5hbnRJZCI6IjYxZDIzMjE4ZmI4MjQ1MzNlMDhiNWNlYSIsImV4cCI6MTY2ODcwMTQ5OCwiaWF0IjoxNjY4Njk3ODk4LCJqdGkiOiJkNzE1NmYzMC1lNjA3LTQxNTgtYmY5Yy01NWZmMmU4NjM4NDIiLCJ1c2VybmFtZSI6ImFkbWluIn0.BfIOsdQcmUKvmalc46ikCsPebdYP0tbPcFni1N-0L09GSqaa1FHGdcJXzv9IQs6HjE0ARLkHCemmDvyv83qt4_luYldigECYzYNz33zLa1DiOaXMUHXrpdkj0upSVLCCUTPlJNuTwMv9UlxJiK46uZon38C9_ITSuiG0AAZnDfaJ4A7zMEheYxSNYwQEszb9aYU5RYsAKefgbZ7F_z7M7IQF8eAzqXCpMOsC6bJgkgj9Nnd6m5DZQhshoqfFu7AD-a2gkfRJXC5rmSA-KdGj8U-9tcFVErzyVgUpYO6WqxDPq9cV0UQHca4FZpo2dmVozLXy9DfTPOY8vzI-TepJwQ
BODY   :
{
   "settings": {}
}
------------------------------------------------------------------------------

Terraform resource configuration contains correct settings values, so I suppose data is lost somewhere in the provider:

> terraform state show dnacenter_network_create.global
# dnacenter_network_create.global:
resource "dnacenter_network_create" "global" {
    id   = "1668697903"
    item = [
        {
            execution_id         = "866b322d-f16c-46e2-92e0-da1e9bd060fc"
            execution_status_url = "/dna/platform/management/business-api/v1/execution-status/866b322d-f16c-46e2-92e0-da1e9bd060fc"
            message              = "The request has been accepted for execution"
        },
    ]

    parameters {
        site_id = "771662ca-cb7e-47ff-9eaf-9b8c85e8e389"

        settings {
            dhcp_server = [
                "1.1.1.1",
            ]

            dns_server {
                domain_name          = "sykehuspartner.no"
                primary_ip_address   = "1.1.1.1"
                secondary_ip_address = "2.2.2.2"
            }
        }
    }
}

Terraform apply output and terraform debug log is attached. tf ouptut.txt tf copy.log

fmunozmiranda commented 1 year ago

@mschedrin ,could you try it again with v1.0.13-beta and update us if is working now?

mschedrin commented 1 year ago

Thanks for quick response. The resource works correct now.