首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GCP部署管理器-“无效配置文件:模板获取失败:未能为资源找到导入的模板'apis.py‘”

GCP部署管理器-“无效配置文件:模板获取失败:未能为资源找到导入的模板'apis.py‘”
EN

Stack Overflow用户
提问于 2020-05-20 14:01:23
回答 1查看 216关注 0票数 0

接受以下.yaml文件:

代码语言:javascript
复制
imports:
- path: apis.py
resources:
- name: test-project
  type: cloudresourcemanager.v1.project
  properties:
    name: test-project
    projectId: test-project
    parent:
      type: folder
      id: ''
- name: billing_test-project
  type: deploymentmanager.v2.virtual.projectBillingInfo
  metadata:
    dependsOn:
    - test-project
  properties:
    name: projects/test-project
    billingAccountName: billingAccountName
- name: apis
  type: apis.py
  properties:
    project: test-project
    billing: billing_test-project
    apis:
    - compute.googleapis.com
    concurrent_api_activation: true
- name: set-export-bucket
  action: gcp-types/compute-v1:compute.projects.setUsageExportBucket
  properties:
    project: test-project
    bucketName: gs://export-bucket
    reportNamePrefix: usage_gce_
  metadata:
    dependsOn:
    - test-project
    - test-project-compute.googleapis.com

当使用GCP部署管理器API发布此YAML时,我会收到以下错误消息:

无效配置文件:模板获取失败:未能为资源{name=apis、properties={apis=compute.googleapis.com、billing= find _test-项目、concurrent_api_activation=true、项目=测试-项目}、type=apis.py}找到导入的模板“concurrent_api_activation=true”

我遵循了创建模板(https://cloud.google.com/deployment-manager/docs/step-by-step-guide/create-a-template)的文档,“apis.py”文件取自项目创建示例:https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/project_creation

我不太清楚我在这里做错了什么。我在另一篇文章中发现另一个用户遇到了类似的问题,但答案是使用模式:(Google Deploy Manager (Invalid config files: Template fetching failed / Failed to find resource) )

但是,我发现最近有一篇文章说您不需要指定模式:Do GCP Deployment Manager templates require a schema file?

那么,是哪一种?如果我确实需要指定一个模式,那么只使用.py文件会是什么样的呢?(我的配置中根本没有任何.jinja文件。)

EN

回答 1

Stack Overflow用户

发布于 2020-05-21 21:03:14

它可能需要有将apis.py放在计算机中的路径,这是在YAML上指定的,以便找到它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61915098

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档