為何使用 API/UI/CLI 建立 Schematics 工作區失敗?

當您嘗試使用下列 CURL 指令使用 API 建立工作區時,Schematics 建立工作區失敗。

curl --request POST --url https://cloud.ibm.com/schematics/workspaces -H "Authorization: Bearer scfQ" -d '{"name":"test_api","type": ["terraform_v1.4"],"location": "eu-de","description": "via api","resource_group": "5e1f06f5b2b24a319f6cd5be86f531dd","tags": [],"template_repo": {"url": "https://xxxxxxxxx/Rise-with-SAP/iac-hec-sap"},"template_data": [{"folder": ".","type": "terraform_v1.4","variablestore": []}]}'

當 Schematics 執行 CURL 指令時,會出現錯誤狀態 Schematics,無法在有效負載中找到完整資訊。 工作區建立會標示 Bad request 訊息。

{
"requestid": "3b57ed5d-8610-4a86-9864-8d8197b80336",
"timestamp": "2021-09-22T14:49:04.565693526Z",
"messageid": "M1008",
"message": "Bad request. Check that the information you entered in the payload is complete and formatted correctly in JSON.",
"statuscode": 400
}

驗證 CURL 或有效負載包含 locationurl 指向您要建立或更新工作區的相同區域。

例如

  • 如果要在 US 區域中建立工作區: 請使用 location 作為 us-eastus-south,以及 url 作為 https://us-south.schematics.cloud.ibm.com/https://us-east.schematics.cloud.ibm.com/。 依預設,https://cloud.ibm.com/schematics/workspaces 會指向 https://cloud.ibm.com/schematics/overview 端點。
  • 對於 EU 區域中的工作區: 使用 location 作為 eu-deeu-gb,以及 url 作為 https://eu-de.schematics.cloud.ibm.comhttps://eu-gb.schematics.cloud.ibm.com 端點。