為何使用 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 或有效負載包含 location 及 url 指向您要建立或更新工作區的相同區域。
例如
- 如果要在
US區域中建立工作區: 請使用location作為us-east或us-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-de或eu-gb,以及url作為https://eu-de.schematics.cloud.ibm.com和https://eu-gb.schematics.cloud.ibm.com端點。