我正在使用 terraform 来管理 ibm 云资源。我正在为 api 网关方式创建 api。
但是,资源需要一个 json 文件及其路径。我必须为所有不同的环境和地区修改 json 文件。
resource "ibm_api_gateway_endpoint" "endpoint"{
service_instance_crn = ibm_resource_instance.apigateway.id
open_api_doc_name = "${path.module}/${var.environment}-api-definitions.yaml"
}
它以这种方式与 yml(或 json)文件一起工作。如果我对 open_api_doc 使用 jsonencode 或 tempfile,我会收到一个错误,指出 open_api_doc_name 需要 json,yml 文件。有没有办法将 jsonencode 转换为文件路径?