IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
341 stars 670 forks source link

ibm_schematics_workspace - GetWorkspaceWithContext failed The requested Workspace cannot be located. #3836

Closed skuracj closed 2 years ago

skuracj commented 2 years ago

Community Note

Terraform CLI and Terraform IBM Provider Version

required_providers { ibm = { source = "IBM-Cloud/ibm" version = "1.42.0" } } Terraform version v1.1.5

Affected Resource(s)

Terraform Configuration Files

data "ibm_schematics_workspace" "shared" {
  workspace_id = "eu-de.workspace.myworkspacid.c4c7b54e"
}

Panic Output

Error: GetWorkspaceWithContext failed The requested Workspace cannot be located. Check that the workspace ID is correct and try your request again.
 2022/06/09 07:15:28 Terraform plan | {
 2022/06/09 07:15:28 Terraform plan |     "StatusCode": 404,

Expected Behavior

I should be able to le retrieve workspace information.

Actual Behavior

Workspace cannot be located

Steps to Reproduce

Create two workspaces in the same resource group and region. Try to access one workspace from another

References

(https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/schematics_workspace)

hkantare commented 2 years ago

Can you please enable trace export TF_LOG=debug and share the complete log

skuracj commented 2 years ago

Can you please enable trace export TF_LOG=debug and share the complete log

@hkantare I think I found the issue. I have created both workspaces in Frankfurt (eu-de) but while runningterraform plan 'Schematics' is making a call to 'https://schematics.cloud.ibm.com/v1/workspaces' instead of 'https://eu-de.schematics.cloud.ibm.com/v1/workspaces'

How can I change it?

hkantare commented 2 years ago

As per my knowledge https://schematics.cloud.ibm.com/v1/workspaces shd list workspaces of all region but can set provider region

provider "ibm" { 
region = "eu-de"
}
data "ibm_schematics_workspace" "shared" {
  workspace_id = "eu-de.workspace.myworkspacid.c4c7b54e"
}

Meanwhile i will check with Schematics team

hkantare commented 2 years ago

Can you share complete log also

skuracj commented 2 years ago

The provider is set to 'eu-de' - still the same behavior.

Regarding 'API url'. I've checked it manually.

'https://eu-de.schematics.cloud.ibm.com/v1/workspaces' - returns my workspaces created in - 'eu-de'. ({"offset":0,"limit":100,"count":6,"workspaces":[{...) 'https://schematics.cloud.ibm.com/v1/workspaces' - NOT ({"offset":0,"limit":100,"count":0,"workspaces":[])

 2022/06/09 22:04:32 Terraform init | Terraform has been successfully initialized!
 2022/06/09 22:04:32 Command finished successfully.

 2022/06/09 22:04:32 -----  Terraform PLAN  -----

 2022/06/09 22:04:32 Starting command: terraform1.0 plan -input=false -refresh=true -state=terraform.tfstate -var-file=schematics.tfvars -no-color -out=tfplan.binary
 2022/06/09 22:04:32 Starting command: terraform1.0 plan -input=false -refresh=true -state=terraform.tfstate -var-file=schematics.tfvars -no-color -out=tfplan.binary
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.949Z [DEBUG] Adding temp file log sink: /tmp/terraform-log300326062
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.949Z [INFO]  Terraform version: 1.0.11
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.949Z [INFO]  Go runtime version: go1.16.4
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.958Z [INFO]  CLI args: []string{"/go/bin/terraform1.0", "plan", "-input=false", "-refresh=true", "-state=terraform.tfstate", "-var-file=schematics.tfvars", "-no-color", "-out=tfplan.binary"}
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.959Z [DEBUG] Attempting to open CLI config file: /home/nobody/terraform-custom.config
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.959Z [INFO]  Loading CLI configuration from /home/nobody/terraform-custom.config
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.959Z [DEBUG] Not reading CLI config directory because config location is overridden by environment variable
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.960Z [DEBUG] checking for credentials in "/home/nobody/.terraform.d/plugins"
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.960Z [DEBUG] Explicit provider installation configuration is set
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.960Z [INFO]  CLI command args: []string{"plan", "-input=false", "-refresh=true", "-state=terraform.tfstate", "-var-file=schematics.tfvars", "-no-color", "-out=tfplan.binary"}
 2022/06/09 22:04:32 Terraform plan | 2022-06-09T22:04:32.963Z [DEBUG] New state was assigned lineage "0ba65411-d571-615c-449a-ed94985169ef"
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.039Z [DEBUG] checking for provisioner in "."
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.040Z [DEBUG] checking for provisioner in "/go/bin"
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.041Z [DEBUG] checking for provisioner in "/home/nobody/.terraform.d/plugins"
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.041Z [DEBUG] found provisioner "terraform-provisioner-ansible_v2.3.3"
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.041Z [WARN]  found legacy provisioner "terraform-provisioner-safe-local-exec"
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.041Z [WARN]  found legacy provisioner "terraform-provisioner-safe-remote-exec"
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.043Z [INFO]  Failed to read plugin lock file .terraform/plugins/linux_amd64/lock.json: open .terraform/plugins/linux_amd64/lock.json: no such file or directory
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.044Z [INFO]  backend/local: starting Plan operation
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.062Z [DEBUG] backend/local: Skipping interactive prompts for variables because input is disabled
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.063Z [DEBUG] created provider logger: level=debug
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.064Z [INFO]  provider: configuring client automatic mTLS
 2022/06/09 22:04:34 Terraform plan | 2022-06-09T22:04:34.325Z [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 args=[.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0]
 2022/06/09 22:04:36 Terraform plan | 2022-06-09T22:04:36.606Z [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 pid=57
 2022/06/09 22:04:36 Terraform plan | 2022-06-09T22:04:36.606Z [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0
 2022/06/09 22:04:36 Terraform plan | 2022-06-09T22:04:36.745Z [DEBUG] provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:36 IBM Cloud Provider version 1.42.0  
 2022/06/09 22:04:36 Terraform plan | 2022-06-09T22:04:36.759Z [INFO]  provider.terraform-provider-ibm_v1.42.0: configuring server automatic mTLS: timestamp=2022-06-09T22:04:36.759Z
 2022/06/09 22:04:37 Terraform plan | 2022-06-09T22:04:37.133Z [DEBUG] provider.terraform-provider-ibm_v1.42.0: plugin address: address=/tmp/plugin363387639 network=unix timestamp=2022-06-09T22:04:37.133Z
 2022/06/09 22:04:37 Terraform plan | 2022-06-09T22:04:37.133Z [DEBUG] provider: using plugin: version=5
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.523Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.538Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 pid=57
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.539Z [DEBUG] provider: plugin exited
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.539Z [INFO]  terraform: building graph: GraphTypeValidate
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.540Z [DEBUG] ProviderTransformer: "data.ibm_schematics_workspace.shared" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/ibm-cloud/ibm"]
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.541Z [DEBUG] ReferenceTransformer: "var.region" references: []
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.541Z [DEBUG] ReferenceTransformer: "var.resource_group_id" references: []
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.541Z [DEBUG] ReferenceTransformer: "var.env" references: []
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.541Z [DEBUG] ReferenceTransformer: "var.TF_LOG" references: []
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.541Z [DEBUG] ReferenceTransformer: "output.remotestate" references: [data.ibm_schematics_workspace.shared]
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.541Z [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/ibm-cloud/ibm\"]" references: [var.ibmcloud_api_key var.region]
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.541Z [DEBUG] ReferenceTransformer: "data.ibm_schematics_workspace.shared" references: []
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.542Z [DEBUG] ReferenceTransformer: "var.ibmcloud_api_key" references: []
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.543Z [DEBUG] Starting graph walk: walkValidate
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.544Z [DEBUG] created provider logger: level=debug
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.544Z [INFO]  provider: configuring client automatic mTLS
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.860Z [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 args=[.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0]
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.866Z [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 pid=66
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.866Z [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.985Z [DEBUG] provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:38 IBM Cloud Provider version 1.42.0  
 2022/06/09 22:04:38 Terraform plan | 2022-06-09T22:04:38.986Z [INFO]  provider.terraform-provider-ibm_v1.42.0: configuring server automatic mTLS: timestamp=2022-06-09T22:04:38.986Z
 2022/06/09 22:04:39 Terraform plan | 2022-06-09T22:04:39.403Z [DEBUG] provider: using plugin: version=5
 2022/06/09 22:04:39 Terraform plan | 2022-06-09T22:04:39.403Z [DEBUG] provider.terraform-provider-ibm_v1.42.0: plugin address: address=/tmp/plugin276338811 network=unix timestamp=2022-06-09T22:04:39.403Z
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.641Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.663Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 pid=66
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.664Z [DEBUG] provider: plugin exited
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.664Z [INFO]  backend/local: plan calling Plan
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.664Z [INFO]  terraform: building graph: GraphTypePlan
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ProviderTransformer: "data.ibm_schematics_workspace.shared (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/ibm-cloud/ibm"]
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ReferenceTransformer: "var.region" references: []
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ReferenceTransformer: "var.resource_group_id" references: []
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ReferenceTransformer: "var.env" references: []
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ReferenceTransformer: "var.TF_LOG" references: []
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ReferenceTransformer: "output.remotestate" references: [data.ibm_schematics_workspace.shared (expand)]
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/ibm-cloud/ibm\"]" references: [var.region var.ibmcloud_api_key]
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.665Z [DEBUG] ReferenceTransformer: "data.ibm_schematics_workspace.shared (expand)" references: []
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.666Z [DEBUG] ReferenceTransformer: "var.ibmcloud_api_key" references: []
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.666Z [DEBUG] Starting graph walk: walkPlan
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.667Z [DEBUG] created provider logger: level=debug
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.667Z [INFO]  provider: configuring client automatic mTLS
 2022/06/09 22:04:41 Terraform plan | 2022-06-09T22:04:41.926Z [DEBUG] provider: starting plugin: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 args=[.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0]
 2022/06/09 22:04:42 Terraform plan | 2022-06-09T22:04:41.998Z [DEBUG] provider: plugin started: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0 pid=76
 2022/06/09 22:04:42 Terraform plan | 2022-06-09T22:04:41.999Z [DEBUG] provider: waiting for RPC address: path=.terraform/providers/registry.terraform.io/ibm-cloud/ibm/1.42.0/linux_amd64/terraform-provider-ibm_v1.42.0
 2022/06/09 22:04:42 Terraform plan | 2022-06-09T22:04:42.225Z [DEBUG] provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:42 IBM Cloud Provider version 1.42.0  
 2022/06/09 22:04:42 Terraform plan | 2022-06-09T22:04:42.226Z [INFO]  provider.terraform-provider-ibm_v1.42.0: configuring server automatic mTLS: timestamp=2022-06-09T22:04:42.225Z
 2022/06/09 22:04:42 Terraform plan | 2022-06-09T22:04:42.740Z [DEBUG] provider: using plugin: version=5
 2022/06/09 22:04:42 Terraform plan | 2022-06-09T22:04:42.740Z [DEBUG] provider.terraform-provider-ibm_v1.42.0: plugin address: address=/tmp/plugin405977062 network=unix timestamp=2022-06-09T22:04:42.740Z
 2022/06/09 22:04:44 Terraform plan | 2022-06-09T22:04:44.865Z [WARN]  ValidateProviderConfig from "provider[\"registry.terraform.io/ibm-cloud/ibm\"]" changed the config value, but that value is unused
 2022/06/09 22:04:44 Terraform plan | 2022-06-09T22:04:44.879Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:44 Configuring SoftLayer Session with token: timestamp=2022-06-09T22:04:44.879Z
 2022/06/09 22:04:44 Terraform plan | 2022-06-09T22:04:44.879Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:44 Configuring IBM Cloud Session with token: timestamp=2022-06-09T22:04:44.879Z
 2022/06/09 22:04:44 Terraform plan | 2022-06-09T22:04:44.879Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:44 Configuring IBM Cloud Session with API key: timestamp=2022-06-09T22:04:44.879Z
 2022/06/09 22:04:44 Terraform plan | 2022-06-09T22:04:44.880Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:44 [INFO] Configured Region: eu-de: timestamp=2022-06-09T22:04:44.879Z
 2022/06/09 22:04:45 Terraform plan | 2022-06-09T22:04:45.813Z [DEBUG] Resource instance state not found for node "data.ibm_schematics_workspace.shared", instance data.ibm_schematics_workspace.shared
 2022/06/09 22:04:45 Terraform plan | 2022-06-09T22:04:45.813Z [DEBUG] ReferenceTransformer: "data.ibm_schematics_workspace.shared" references: []
 2022/06/09 22:04:45 Terraform plan | 2022-06-09T22:04:45.841Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:45 [Debug] Request:
 2022/06/09 22:04:45 Terraform plan | POST /identity/token HTTP/1.1
 2022/06/09 22:04:45 Terraform plan | Host: iam.cloud.ibm.com
 2022/06/09 22:04:45 Terraform plan | User-Agent: Go-http-client/1.1
 2022/06/09 22:04:45 Terraform plan | Content-Length: 135
 2022/06/09 22:04:45 Terraform plan | Accept: application/json
 2022/06/09 22:04:45 Terraform plan | Content-Type: application/x-www-form-urlencoded
 2022/06/09 22:04:45 Terraform plan | Accept-Encoding: gzip
 2022/06/09 22:04:45 Terraform plan | 
 2022/06/09 22:04:45 Terraform plan | apikey=[redacted]&grant_type=urn%!A(MISSING)ibm%!A(MISSING)params%!A(MISSING)oauth%!A(MISSING)grant-type%!A(MISSING)apikey&response_type=cloud_iam: timestamp=2022-06-09T22:04:45.841Z
 2022/06/09 22:04:45 Terraform plan | 2022-06-09T22:04:45.842Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:45 [Debug] Invoking IAM 'get token' operation: https://iam.cloud.ibm.com/identity/token: timestamp=2022-06-09T22:04:45.841Z
 2022/06/09 22:04:46 Terraform plan | 2022-06-09T22:04:46.000Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:45 [Debug] Returned from IAM 'get token' operation, received status code 200: timestamp=2022-06-09T22:04:45.999Z
 2022/06/09 22:04:46 Terraform plan | 2022-06-09T22:04:46.002Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:46 [Debug] Response:
 2022/06/09 22:04:46 Terraform plan | HTTP/1.1 200 OK
 2022/06/09 22:04:46 Terraform plan | Akamai-Grn: 0.324d655f.1654812285.313f88a
 2022/06/09 22:04:46 Terraform plan | Cache-Control: no-cache, no-store, must-revalidate
 2022/06/09 22:04:46 Terraform plan | Connection: keep-alive
 2022/06/09 22:04:46 Terraform plan | Content-Language: en-US
 2022/06/09 22:04:46 Terraform plan | Content-Type: application/json
 2022/06/09 22:04:46 Terraform plan | Date: Thu, 09 Jun 2022 22:04:45 GMT
 2022/06/09 22:04:46 Terraform plan | Expires: 0
 2022/06/09 22:04:46 Terraform plan | Pragma: no-cache
 2022/06/09 22:04:46 Terraform plan | Strict-Transport-Security: max-age=31536000; includeSubDomains
 2022/06/09 22:04:46 Terraform plan | Transaction-Id: MmR3ZzQ-c12166a398594e27886f0f0b96a26a2f
 2022/06/09 22:04:46 Terraform plan | Vary: Accept-Encoding
 2022/06/09 22:04:46 Terraform plan | X-Content-Type-Options: nosniff
 2022/06/09 22:04:46 Terraform plan | X-Correlation-Id: MmR3ZzQ-c12166a398594e27886f0f0b96a26a2f
 2022/06/09 22:04:46 Terraform plan | X-Proxy-Upstream-Service-Time: 108
 2022/06/09 22:04:46 Terraform plan | X-Request-Id: 4ae23140-6ee7-49b1-a839-f5ff810cfabf
 2022/06/09 22:04:46 Terraform plan | 
 2022/06/09 22:04:46 Terraform plan | {"access_token":"[redacted]","refresh_token":"[redacted]","ims_user_id":9778158,"token_type":"Bearer","expires_in":3600,"expiration":1654815882,"scope":"ibm openid"}: timestamp=2022-06-09T22:04:46.002Z
 2022/06/09 22:04:46 Terraform plan | 2022-06-09T22:04:46.003Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:46 [Debug] Request:
 2022/06/09 22:04:46 Terraform plan | GET /v1/workspaces/eu-de.workspace.shared.b3a79cee HTTP/1.1
 2022/06/09 22:04:46 Terraform plan | Host: schematics.cloud.ibm.com
 2022/06/09 22:04:46 Terraform plan | User-Agent: schematics-go-sdk/0.0.1 (lang=go; arch=amd64; os=linux; go.version=go1.16.15)
 2022/06/09 22:04:46 Terraform plan | Accept: application/json
 2022/06/09 22:04:46 Terraform plan | Authorization: [redacted]
 2022/06/09 22:04:46 Terraform plan | X-Original-User-Agent: terraform-provider-ibm/1.42.0
 2022/06/09 22:04:46 Terraform plan | Accept-Encoding: gzip
 2022/06/09 22:04:46 Terraform plan | 
: timestamp=2022-06-09T22:04:46.003Z
 2022/06/09 22:04:46 Terraform plan | 2022-06-09T22:04:46.003Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:46 [DEBUG] GET https://schematics.cloud.ibm.com/v1/workspaces/eu-de.workspace.shared.b3a79cee: timestamp=2022-06-09T22:04:46.003Z
 2022/06/09 22:04:47 Terraform plan | 2022-06-09T22:04:47.478Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:47 [Debug] Response:
 2022/06/09 22:04:47 Terraform plan | HTTP/2.0 404 Not Found
 2022/06/09 22:04:47 Terraform plan | Cache-Control: no-store, no-cache='Set-Cookie, Set-Cookie2', must-revalidate, proxy-revalidate, post-check=0, pre-check=0
 2022/06/09 22:04:47 Terraform plan | Cf-Cache-Status: DYNAMIC
 2022/06/09 22:04:47 Terraform plan | Cf-Ray: 718d2a33fb3d68f2-FRA
 2022/06/09 22:04:47 Terraform plan | Content-Security-Policy: default-src 'self'; frame-ancestors 'self';
 2022/06/09 22:04:47 Terraform plan | Content-Type: application/json; charset=utf-8
 2022/06/09 22:04:47 Terraform plan | Date: Thu, 09 Jun 2022 22:04:47 GMT
 2022/06/09 22:04:47 Terraform plan | Expect-Ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
 2022/06/09 22:04:47 Terraform plan | Expires: 0
 2022/06/09 22:04:47 Terraform plan | Ibm-Schematics-Requestid: 8e17e23d-1425-4960-8f87-5faa22aca14b
 2022/06/09 22:04:47 Terraform plan | Pragma: no-cache
 2022/06/09 22:04:47 Terraform plan | Server: cloudflare
 2022/06/09 22:04:47 Terraform plan | Strict-Transport-Security: max-age=15552000; includeSubDomains
 2022/06/09 22:04:47 Terraform plan | X-Content-Type-Options: nosniff
 2022/06/09 22:04:47 Terraform plan | X-Xss-Protection: 1; mode=block
 2022/06/09 22:04:47 Terraform plan | 
 2022/06/09 22:04:47 Terraform plan | {"requestid":"8e17e23d-1425-4960-8f87-5faa22aca14b","timestamp":"2022-06-09T22:04:47.427601186Z","messageid":"M1001","message":"The requested Workspace cannot be located. Check that the workspace ID is correct and try your request again.","statuscode":404}: timestamp=2022-06-09T22:04:47.478Z
 2022/06/09 22:04:47 Terraform plan | 2022-06-09T22:04:47.478Z [INFO]  provider.terraform-provider-ibm_v1.42.0: 2022/06/09 22:04:47 [DEBUG] GetWorkspaceWithContext failed The requested Workspace cannot be located. Check that the workspace ID is correct and try your request again.
 2022/06/09 22:04:47 Terraform plan | {
 2022/06/09 22:04:47 Terraform plan |     "StatusCode": 404,
 2022/06/09 22:04:47 Terraform plan |     "Headers": {
 2022/06/09 22:04:47 Terraform plan |         "Cache-Control": [
 2022/06/09 22:04:47 Terraform plan |             "no-store, no-cache='Set-Cookie, Set-Cookie2', must-revalidate, proxy-revalidate, post-check=0, pre-check=0"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Cf-Cache-Status": [
 2022/06/09 22:04:47 Terraform plan |             "DYNAMIC"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Cf-Ray": [
 2022/06/09 22:04:47 Terraform plan |             "718d2a33fb3d68f2-FRA"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Content-Security-Policy": [
 2022/06/09 22:04:47 Terraform plan |             "default-src 'self'; frame-ancestors 'self';"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Content-Type": [
 2022/06/09 22:04:47 Terraform plan |             "application/json; charset=utf-8"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Date": [
 2022/06/09 22:04:47 Terraform plan |             "Thu, 09 Jun 2022 22:04:47 GMT"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Expect-Ct": [
 2022/06/09 22:04:47 Terraform plan |             "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Expires": [
 2022/06/09 22:04:47 Terraform plan |             "0"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Ibm-Schematics-Requestid": [
 2022/06/09 22:04:47 Terraform plan |             "8e17e23d-1425-4960-8f87-5faa22aca14b"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Pragma": [
 2022/06/09 22:04:47 Terraform plan |             "no-cache"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Server": [
 2022/06/09 22:04:47 Terraform plan |             "cloudflare"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "Strict-Transport-Security": [
 2022/06/09 22:04:47 Terraform plan |             "max-age=15552000; includeSubDomains"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "X-Content-Type-Options": [
 2022/06/09 22:04:47 Terraform plan |             "nosniff"
 2022/06/09 22:04:47 Terraform plan |         ],
 2022/06/09 22:04:47 Terraform plan |         "X-Xss-Protection": [
 2022/06/09 22:04:47 Terraform plan |             "1; mode=block"
 2022/06/09 22:04:47 Terraform plan |         ]
 2022/06/09 22:04:47 Terraform plan |     },
 2022/06/09 22:04:47 Terraform plan |     "Result": {
 2022/06/09 22:04:47 Terraform plan |         "message": "The requested Workspace cannot be located. Check that the workspace ID is correct and try your request again.",
 2022/06/09 22:04:47 Terraform plan |         "messageid": "M1001",
 2022/06/09 22:04:47 Terraform plan |         "requestid": "8e17e23d-1425-4960-8f87-5faa22aca14b",
 2022/06/09 22:04:47 Terraform plan |         "statuscode": 404,
 2022/06/09 22:04:47 Terraform plan |         "timestamp": "2022-06-09T22:04:47.427601186Z"
 2022/06/09 22:04:47 Terraform plan |     },
 2022/06/09 22:04:47 Terraform plan |     "RawResult": null
 2022/06/09 22:04:47 Terraform plan | }: timestamp=2022-06-09T22:04:47.478Z
skuracj commented 2 years ago

If you have a workspace created other in a region other than us, you must set the API endpoint to that region. For example, if your region specified is eu, the API endpoint should be specified as IBMCLOUD_SCHEMATICS_API_ENDPOINT=https://eu.schematics.cloud.ibm.com in the environment variable.

And now it works. Would be nice to add a place in UI to change IBMCLOUD_SCHEMATICS_API_ENDPOINT.