Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to extract JSON data from an existing MSO controller in order to later design and document a migration to NDO #317

Closed
cpiatnit opened this issue Dec 18, 2024 · 2 comments

Comments

@cpiatnit
Copy link

cpiatnit commented Dec 18, 2024

Hi guys

Here is my main.tf file
This is MSO 3.1.1 and Terrafrom 1.9.8

terraform {
  required_providers {
    mso = {
      source = "CiscoDevNet/mso"
    }
  }
}
provider "mso" {
    # cisco-mso user name
    username = "admin"
    # cisco-mso password
    password = "Cisco1234567!"
    # cisco-mso url
    url      = "https://1.1.1.1"
    domain   = "domain-name"
    insecure = true
    platform = "nd"
}

resource "mso_label" "label1" {
   label = "label1"
   type  = "site"
 }

no matter what I do I am getting an error like below. I initial try to use the import command and I was getting this Error: invalid character '<' looking for beginning of value only. After trying to actually create an object I get a little bit more about the line that is causing the error but it is still the same, please see below

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the
following symbols:
  + create

Terraform will perform the following actions:

  # mso_label.label1 will be created
  + resource "mso_label" "label1" {
      + id    = (known after apply)
      + label = "label1"
      + type  = "site"
    }

Plan: 1 to add, 0 to change, 0 to destroy.
mso_label.label1: Creating...
╷
│ Error: invalid character '<' looking for beginning of value
│
│   with mso_label.label1,
│   on main.tf line 20, in resource "mso_label" "label1":
│   20: resource "mso_label" "label1" {
│
╵

What could be the reason for the above?

@cpiatnit
Copy link
Author

Enabling debugging shows these

2024-12-18T13:50:47.383-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] Label: Beginning Creation
2024-12-18T13:50:47.383-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] HTTP request POST mso/api/v1/labels
2024-12-18T13:50:47.383-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] Begin Injection
2024-12-18T13:50:47.383-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] HTTP request POST /login
2024-12-18T13:50:47.383-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] HTTP request after injection POST /login
2024-12-18T13:50:47.383-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] Begining DO method https://198.18.134.225/login
2024-12-18T13:50:47.383-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [TRACE] HTTP Request Method and URL: POST https://198.18.134.225/login
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] HTTP Request: POST https://198.18.134.225/login
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] HTTP Response: 405 405 Not Allowed &{405 Not Allowed 405 HTTP/1.1 1 1 map[Connection:[keep-alive] Content-Length:[150] Content-Type:[text/html] Date:[Wed, 18 Dec 2024 18:50:47 GMT] Server:[nginx] Strict-Transport-Security:[max-age=31536000; includeSubDomains]] 0xc000693580 150 [] false false map[] 0xc0009367e0 0xc000930210}
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 [DEBUG] HTTP response unique string POST https://1.1.1.1/login
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: <title>405 Not Allowed</title>
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0:
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0:

405 Not Allowed


2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0:
nginx
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0:
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0:
2024-12-18T13:50:47.558-0500 [DEBUG] provider.terraform-provider-mso_v1.3.0: 2024/12/18 13:50:47 Error occured while json parsing invalid character '<' looking for beginning of value
2024-12-18T13:50:47.566-0500 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-12-18T13:50:47.566-0500 [ERROR] vertex "mso_label.label1" error: invalid character '<' looking for beginning of value
2024-12-18T13:50:47.573-0500 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-12-18T13:50:47.574-0500 [INFO] provider: plugin process

@cpiatnit
Copy link
Author

Sorted this out

provider "mso" {
# cisco-mso user name
username = "admin"
# cisco-mso password
password = "password"
# cisco-mso url
url = "https://173.36.219.193/"
domain = "domain-name"
insecure = true
platform = "nd"
}

in my case the platform needed to be mso

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant