PaloAltoNetworks / terraform-provider-scm

The Terraform provider for Strata Cloud Manager
Apache License 2.0
7 stars 2 forks source link

`scm_service_connection` gives error when explicit provider host is not set #19

Closed zbuchheit closed 2 months ago

zbuchheit commented 3 months ago

Describe the bug

When attempting to use the scm_service_connection resource or data object, I get an object not found error.

When looking at the logs I noticed when host isn't set the api call is made to Host: api.strata.paloaltonetworks.com which I would expect it to actually be api.sase.paloaltonetworks.com. When I set the host on the provider it is able to make the api call correctly.

Expected behavior

Create or query a service connection resource correctly without error.

Current behavior

Encountering an error

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Error reading config
│ 
│   with data.scm_service_connection.example,
│   on main.tf line 15, in data "scm_service_connection" "example":
│   15: data "scm_service_connection" "example" {
│ 
│ object not found

Steps to reproduce

TF Repro File ``` terraform { required_providers { scm = { source = "paloaltonetworks/scm" version = "0.9.2" } } } provider "scm" { logging = "detailed" # host = "api.sase.paloaltonetworks.com" } data "scm_service_connection" "example" { id = "REDACTED" folder= "Service Connections" } ```
  1. Create a service connection manually (or alternatively attempt to create one) without host set on the provider
  2. Run terraform plan
  3. Witness error
  4. Set host to be "api.sase.paloaltonetworks.com"
  5. Witness successful run

Screenshots

Context

I am also witnessing this behavior with remote_networks. I suspect this might be coming from this line

Your Environment

shinmog commented 2 months ago

The documentation for the default value for the "host" param within the provider block was incorrect. The default value for "host" is "api.strata.paloaltonetworks.com", so the documentation for this can be updated to reflect the correct default value.

zbuchheit commented 2 months ago

closing as this is by design. Thanks!