无法通过部署管理器创建 postgres cloudsql 吗?

Is it not possible to create a postgres cloudsql via deployment manager?

我已经检查过 supported-gcp-types and supported-resource-types 但我完全看不到任何可能性

部署管理器支持 PostgreSQL。

您需要将 backendType 指定为 SECOND_GEN,将 databaseVersion 指定为 POSTGRES_9_6,将 tier 指定为 db-custom-1-3840

Documentation

示例(创建-postgresql-instance.jinja):

{% set deployment_name = env['deployment']  %}
{% set instance_name = deployment_name + '-instance'  %}
{% set database_name = deployment_name + '-db'  %}
{% set region = 'us-central1'  %}
{% set tier = 'db-custom-1-3840'  %}

resources:
- name: {{ instance_name }}
  type: gcp-types/sqladmin-v1beta4:instances
  properties:
    region: {{ region }}
    backendType: SECOND_GEN
    databaseVersion: POSTGRES_9_6
    settings:
      tier: {{ tier }}
      backupConfiguration:
        enabled: true

- name: {{ database_name }}
  type: gcp-types/sqladmin-v1beta4:databases
  properties:
    name: {{ database_name }}
    instance: $(ref.{{ instance_name }}.name)
    charset: utf8

部署:

gcloud deployment-manager deployments create mydb --template create-postgresql-instance.jinja

PostgresQL 的部署管理器 Jinja 模板

{% set deployment_name = env['deployment']  %}
{% set instance_name = deployment_name + '-instance'  %}
{% set database_name = deployment_name + '-db'  %}
{% set region = 'us-central1'  %}
{% set tier = 'db-n1-standard-1'  %}
{% set databaseVersion = 'POSTGRES_11' %}
resources:
- name: {{ instance_name }}
  type: gcp-types/sqladmin-v1beta4:instances
  properties:
      region: us-central1
      databaseVersion: POSTGRES_9_6
      instanceType: CLOUD_SQL_INSTANCE
      settings:
        tier: db-f1-micro
        backupConfiguration:
          startTime: '02:00'
          enabled: true
        locationPreference:
          zone: us-central1-c

- name: {{ database_name }}
  type: gcp-types/sqladmin-v1beta4:databases
  properties:
    name: {{ database_name }}
    databaseVersion: POSTGRES_12
    instance: $(ref.{{ instance_name }}.name)
    charset: utf8