【发布时间】:2022-08-12 00:16:35
【问题描述】:
除了gcloud datastore indexes list,我找不到任何直接导出现有索引的方法
gcloud-list.yaml
---
ancestor: NONE
indexId: CICAgOi36pgK
kind: Session
projectId: self-serve-dev-261801
properties:
- direction: ASCENDING
name: identityId
- direction: ASCENDING
name: endTime
state: READY
---
ancestor: NONE
indexId: CICAgJj7z4EL
kind: Feedback
projectId: self-serve-dev-261801
properties:
- direction: ASCENDING
name: id
- direction: ASCENDING
name: entity
- direction: ASCENDING
name: value
- direction: ASCENDING
name: submitter
- direction: ASCENDING
name: createdOn
- direction: ASCENDING
name: updatedOn
索引.yaml
indexes:
- kind: Task
ancestor: no
properties:
- name: done
- name: priority
direction: desc
- kind: Task
properties:
- name: collaborators
direction: asc
- name: created
direction: desc
- kind: TaskList
ancestor: yes
properties:
- name: percent_complete
direction: asc
- name: type
direction: asc
它的输出包含IndexId,在实际的 index.yaml 样本中找不到。
我想创建一个数据存储并使用 Terraform 模块将此索引导入到其中。
我不知道如果我们尝试从 gcloud cli 输出中导入 list 输出是否会发生冲突。
值也不同NONE -> no、ASCENDING -> asc。
我可以编写一个脚本将其转换为正确的格式。这是唯一的方法吗?
-
此document 描述了如何使用托管导出和导入服务在 Datastore 模式实体中导出和导入 Firestore。托管导出和导入服务可通过 Cloud 控制台、Google Cloud CLI 和 Datastore Admin API(REST、RPC)获得。
-
我在 Terraform 方面没有太多经验,我认为编写脚本将其转换为正确的格式是唯一的方法。您可以查看documentation 或联系Terraform Support Team。
-
有一个工具可用于以 terraform 格式导出配置。不幸的是,它并未涵盖所有资源类型。截至今天,数据存储不包括在内。更多细节在这里cloud.google.com/docs/terraform/resource-management/export。可以导出的可用类型可以通过 gcloud beta resource-config list-resource-types --project=<PROJECT_ID> 列出
标签: google-cloud-platform terraform google-cloud-datastore gcloud terraform-provider-gcp