CiscoDevNet / terraform-provider-dcnm

Cisco DCNM Provider
https://registry.terraform.io/providers/CiscoDevNet/dcnm/latest/docs
Mozilla Public License 2.0
8 stars 15 forks source link

404 error when apply #92

Closed christung16 closed 2 years ago

christung16 commented 2 years ago

Community Note

Terraform Version

❯ terraform -v Terraform v1.2.5 on windows_amd64

DCNM version

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

terraform {
  required_providers {
    dcnm = {
      source = "CiscoDevNet/dcnm"
      version = "1.2.3"
    }
  }
}

provider "dcnm" {
  # Configuration options
  username = "admin"
  # cisco-dcnm/ndfc password
  password = "<password>"
  # cisco-dcnm/ndfc url
  url      = "https://<ndfc_ip>"
  insecure = true
  platform = "dcnm"
}

data "dcnm_interface" "check" {
  serial_number = "9WB1P8K74HF"
  name          = "Ethernet1/1"
  type          = "ethernet"
  fabric_name   = "chris-fabric-terraform"

}

Debug Output

Panic Output

Expected Behavior

it should poll the interface data.

Actual Behavior

❯ terraform plan
data.dcnm_interface.check: Reading...
╷
│ Error: <html>
│ <head><title>404 Not Found</title></head>
│ <body>
│ <center><h1>404 Not Found</h1></center>
│ <hr><center>nginx</center>
│ </body>
│ </html>
│
│
│   with data.dcnm_interface.check,
│   on main.tf line 22, in data "dcnm_interface" "check":
│   22: data "dcnm_interface" "check" {
│

Steps to Reproduce

  1. terraform apply

Important Factoids

References

dsx1123 commented 2 years ago

Please use nd as platform if it is NDFC.

Thanks, Shangxin

On Aug 10, 2022, at 9:02 PM, christung16 @.***> wrote:

 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 Version

❯ terraform -v Terraform v1.2.5 on windows_amd64

provider registry.terraform.io/ciscodevnet/dcnm v1.2.3 DCNM version

V x.x.x V 12.1.1e Affected Resource(s)

dcnm_XXXXX dcnm_interface dcnm_rest 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

terraform { required_providers { dcnm = { source = "CiscoDevNet/dcnm" version = "1.2.3" } } }

provider "dcnm" {

Configuration options

username = "admin"

cisco-dcnm/ndfc password

password = ""

cisco-dcnm/ndfc url

url = "https://" insecure = true platform = "dcnm" }

data "dcnm_interface" "check" { serial_number = "9WB1P8K74HF" name = "Ethernet1/1" type = "ethernet" fabric_name = "chris-fabric-terraform"

}

Debug Output

❯ terraform plan data.dcnm_interface.check: Reading... ╷ │ Error: │ 404 Not Found │ │

404 Not Found

│ nginx │ │ │ │ │ with data.dcnm_interface.check, │ on main.tf line 22, in data "dcnm_interface" "check": │ 22: data "dcnm_interface" "check" { │ Panic Output

Expected Behavior

it should poll the interface data.

Actual Behavior

It shows 404 error

Steps to Reproduce

terraform apply Important Factoids

References

0000

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

lhercot commented 2 years ago

@christung16 Did you had time to try Shangxin suggestion? Let us know if we can close this issue.

christung16 commented 2 years ago

Yes, it works. The case can be closed. Thanks for your support.

christung16 commented 2 years ago

Sorry @lhercot , one more issue regarding import in powershell. How to escape the double quote? I can do the import in ubuntu with

terraform import dcnm_interface.customers[\"leaf_2_eth_1_2\"] "ethernet:96G8WRV3HMF:Ethernet1/2:chris-fabric-terraform"

However, in windows power shell, it doesn't work in these ways:

❯ terraform import dcnm_interface.customers['"leaf_1_eth_1_11"'] "ethernet:9WB1P8K74HF:Ethernet1/11:chris-fabric-terraform"    
╷
│ Error: Index value required
│
│   on <import-address> line 1:
│    1: dcnm_interface.customers[leaf_1_eth_1_11]
│
│ Index brackets must contain either a literal number or a literal string.
╵
❯ terraform import dcnm_interface.customers["`"leaf_1_eth_1_11`""] "ethernet:9WB1P8K74HF:Ethernet1/11:chris-fabric-terraform"  
╷
│ Error: Index value required
│
│   on <import-address> line 1:
│    1: dcnm_interface.customers[leaf_1_eth_1_11]
│
│ Index brackets must contain either a literal number or a literal string.
╵

For information on valid syntax, see:
https://www.terraform.io/docs/cli/state/resource-addressing.html
RutvikS-crest commented 2 years ago

@christung16 try this:

terraform import dcnm_interface.customers[\`"leaf_1_eth_1_11\`"] "ethernet:9WB1P8K74HF:Ethernet1/11:chris-fabric-terraform" 
christung16 commented 2 years ago

@RutvikS-crest , Thanks a lot!! It works well!!