接受以下.yaml文件:
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文件。)
发布于 2020-05-21 21:03:14
它可能需要有将apis.py放在计算机中的路径,这是在YAML上指定的,以便找到它。
https://stackoverflow.com/questions/61915098
复制相似问题