SQLInstance


Property Value
Google Cloud Service Name Cloud SQL
Google Cloud Service Documentation /sql/docs/
Google Cloud REST Resource Name v1beta4.instance
Google Cloud REST Resource Documentation /sql/docs/postgres/admin-api/v1beta4/instances
Config Connector Resource Short Names gcpsqlinstance
gcpsqlinstances
sqlinstance
Config Connector Service Name sqladmin.googleapis.com
Config Connector Resource Fully Qualified Name sqlinstances.sql.cnrm.cloud.google.com
Can Be Referenced by IAMPolicy/IAMPolicyMember No
Config Connector Default Average Reconcile Interval In Seconds 600

Custom Resource Definition Properties

Annotations

Fields
cnrm.cloud.google.com/project-id

Spec

Schema

cloneSource:
  binLogCoordinates:
    binLogFileName: string
    binLogPosition: integer
  databaseNames:
  - string
  pointInTime: string
  sqlInstanceRef:
    external: string
    name: string
    namespace: string
databaseVersion: string
encryptionKMSCryptoKeyRef:
  external: string
  name: string
  namespace: string
instanceType: string
maintenanceVersion: string
masterInstanceRef:
  external: string
  name: string
  namespace: string
region: string
replicaConfiguration:
  caCertificate: string
  clientCertificate: string
  clientKey: string
  connectRetryInterval: integer
  dumpFilePath: string
  failoverTarget: boolean
  masterHeartbeatPeriod: integer
  password:
    value: string
    valueFrom:
      secretKeyRef:
        key: string
        name: string
  sslCipher: string
  username: string
  verifyServerCertificate: boolean
resourceID: string
rootPassword:
  value: string
  valueFrom:
    secretKeyRef:
      key: string
      name: string
settings:
  activationPolicy: string
  activeDirectoryConfig:
    domain: string
  advancedMachineFeatures:
    threadsPerCore: integer
  authorizedGaeApplications:
  - string
  availabilityType: string
  backupConfiguration:
    backupRetentionSettings:
      retainedBackups: integer
      retentionUnit: string
    binaryLogEnabled: boolean
    enabled: boolean
    location: string
    pointInTimeRecoveryEnabled: boolean
    startTime: string
    transactionLogRetentionDays: integer
  collation: string
  connectorEnforcement: string
  crashSafeReplication: boolean
  dataCacheConfig:
    dataCacheEnabled: boolean
  databaseFlags:
  - name: string
    value: string
  deletionProtectionEnabled: boolean
  denyMaintenancePeriod:
    endDate: string
    startDate: string
    time: string
  diskAutoresize: boolean
  diskAutoresizeLimit: integer
  diskSize: integer
  diskType: string
  edition: string
  insightsConfig:
    queryInsightsEnabled: boolean
    queryPlansPerMinute: integer
    queryStringLength: integer
    recordApplicationTags: boolean
    recordClientAddress: boolean
  ipConfiguration:
    allocatedIpRange: string
    authorizedNetworks:
    - expirationTime: string
      name: string
      value: string
    enablePrivatePathForGoogleCloudServices: boolean
    ipv4Enabled: boolean
    privateNetworkRef:
      external: string
      name: string
      namespace: string
    pscConfig:
    - allowedConsumerProjects:
      - string
      pscEnabled: boolean
    requireSsl: boolean
    sslMode: string
  locationPreference:
    followGaeApplication: string
    secondaryZone: string
    zone: string
  maintenanceWindow:
    day: integer
    hour: integer
    updateTrack: string
  passwordValidationPolicy:
    complexity: string
    disallowUsernameSubstring: boolean
    enablePasswordPolicy: boolean
    minLength: integer
    passwordChangeInterval: string
    reuseInterval: integer
  pricingPlan: string
  replicationType: string
  sqlServerAuditConfig:
    bucketRef:
      external: string
      name: string
      namespace: string
    retentionInterval: string
    uploadInterval: string
  tier: string
  timeZone: string
Fields

cloneSource

Optional

object

Create this database as a clone of a source instance. Immutable.

cloneSource.binLogCoordinates

Optional

object

Binary log coordinates, if specified, identify the position up to which the source instance is cloned. If not specified, the source instance is cloned up to the most recent binary log coordinates.

cloneSource.binLogCoordinates.binLogFileName

Optional

string

Name of the binary log file for a Cloud SQL instance.

cloneSource.binLogCoordinates.binLogPosition

Optional

integer

Position (offset) within the binary log file.

cloneSource.databaseNames

Optional

list (string)

(SQL Server only) Clone only the specified databases from the source instance. Clone all databases if empty.

cloneSource.databaseNames[]

Optional

string

cloneSource.pointInTime

Optional

string

Timestamp, if specified, identifies the time to which the source instance is cloned.

cloneSource.sqlInstanceRef

Optional

object

The source SQLInstance to clone

cloneSource.sqlInstanceRef.external

Optional

string

The SQLInstance selfLink, when not managed by Config Connector.

cloneSource.sqlInstanceRef.name

Optional

string

The `name` field of a `SQLInstance` resource.

cloneSource.sqlInstanceRef.namespace

Optional

string

The `namespace` field of a `SQLInstance` resource.

databaseVersion

Optional

string

The MySQL, PostgreSQL or SQL Server (beta) version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, POSTGRES_9_6, POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, POSTGRES_15, SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, SQLSERVER_2017_WEB. Database Version Policies includes an up-to-date reference of supported versions.

encryptionKMSCryptoKeyRef

Optional

object

encryptionKMSCryptoKeyRef.external

Optional

string

A reference to an externally managed KMSCryptoKey. Should be in the format `projects/[kms_project_id]/locations/[region]/keyRings/[key_ring_id]/cryptoKeys/[key]`.

encryptionKMSCryptoKeyRef.name

Optional

string

The `name` of a `KMSCryptoKey` resource.

encryptionKMSCryptoKeyRef.namespace

Optional

string

The `namespace` of a `KMSCryptoKey` resource.

instanceType

Optional

string

The type of the instance. The valid values are:- 'SQL_INSTANCE_TYPE_UNSPECIFIED', 'CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE' and 'READ_REPLICA_INSTANCE'.

maintenanceVersion

Optional

string

Maintenance version.

masterInstanceRef

Optional

object

masterInstanceRef.external

Optional

string

The SQLInstance selfLink, when not managed by Config Connector.

masterInstanceRef.name

Optional

string

The `name` field of a `SQLInstance` resource.

masterInstanceRef.namespace

Optional

string

The `namespace` field of a `SQLInstance` resource.

region

Optional

string

Immutable. The region the instance will sit in. Note, Cloud SQL is not available in all regions. A valid region must be provided to use this resource. If a region is not provided in the resource definition, the provider region will be used instead, but this will be an apply-time error for instances if the provider region is not supported with Cloud SQL. If you choose not to provide the region argument for this resource, make sure you understand this.

replicaConfiguration

Optional

object

The configuration for replication.

replicaConfiguration.caCertificate

Optional

string

Immutable. PEM representation of the trusted CA's x509 certificate.

replicaConfiguration.clientCertificate

Optional

string

Immutable. PEM representation of the replica's x509 certificate.

replicaConfiguration.clientKey

Optional

string

Immutable. PEM representation of the replica's private key. The corresponding public key in encoded in the client_certificate.

replicaConfiguration.connectRetryInterval

Optional

integer

Immutable. The number of seconds between connect retries. MySQL's default is 60 seconds.

replicaConfiguration.dumpFilePath

Optional

string

Immutable. Path to a SQL file in Google Cloud Storage from which replica instances are created. Format is gs://bucket/filename.

replicaConfiguration.failoverTarget

Optional

boolean

Immutable. Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. If the master instance fails, the replica instance will be promoted as the new master instance. Not supported for Postgres.

replicaConfiguration.masterHeartbeatPeriod

Optional

integer

Immutable. Time in ms between replication heartbeats.

replicaConfiguration.password

Optional

object

Immutable. Password for the replication connection.

replicaConfiguration.password.value

Optional

string

Value of the field. Cannot be used if 'valueFrom' is specified.

replicaConfiguration.password.valueFrom

Optional

object

Source for the field's value. Cannot be used if 'value' is specified.

replicaConfiguration.password.valueFrom.secretKeyRef

Optional

object

Reference to a value with the given key in the given Secret in the resource's namespace.

replicaConfiguration.password.valueFrom.secretKeyRef.key

Required*

string

Key that identifies the value to be extracted.

replicaConfiguration.password.valueFrom.secretKeyRef.name

Required*

string

Name of the Secret to extract a value from.

replicaConfiguration.sslCipher

Optional

string

Immutable. Permissible ciphers for use in SSL encryption.

replicaConfiguration.username

Optional

string

Immutable. Username for replication connection.

replicaConfiguration.verifyServerCertificate

Optional

boolean

Immutable. True if the master's common name value is checked during the SSL handshake.

resourceID

Optional

string

Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default.

rootPassword

Optional

object

Initial root password. Required for MS SQL Server.

rootPassword.value

Optional

string

Value of the field. Cannot be used if 'valueFrom' is specified.

rootPassword.valueFrom

Optional

object

Source for the field's value. Cannot be used if 'value' is specified.

rootPassword.valueFrom.secretKeyRef

Optional

object

Reference to a value with the given key in the given Secret in the resource's namespace.

rootPassword.valueFrom.secretKeyRef.key

Required*

string

Key that identifies the value to be extracted.

rootPassword.valueFrom.secretKeyRef.name

Required*

string

Name of the Secret to extract a value from.

settings

Required

object

The settings to use for the database. The configuration is detailed below.

settings.activationPolicy

Optional

string

This specifies when the instance should be active. Can be either ALWAYS, NEVER or ON_DEMAND.

settings.activeDirectoryConfig

Optional

object

settings.activeDirectoryConfig.domain

Required*

string

Domain name of the Active Directory for SQL Server (e.g., mydomain.com).

settings.advancedMachineFeatures

Optional

object

settings.advancedMachineFeatures.threadsPerCore

Optional

integer

The number of threads per physical core. Can be 1 or 2.

settings.authorizedGaeApplications

Optional

list (string)

DEPRECATED. This property is only applicable to First Generation instances, and First Generation instances are now deprecated. see https://cloud.google.com/sql/docs/mysql/deprecation-notice for information on how to upgrade to Second Generation instances. Specifying this field has no-ops; it's recommended to remove this field from your configuration.

settings.authorizedGaeApplications[]

Optional

string

settings.availabilityType

Optional

string

The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL). For all instances, ensure that settings.backup_configuration.enabled is set to true. For MySQL instances, ensure that settings.backup_configuration.binary_log_enabled is set to true. For Postgres instances, ensure that settings.backup_configuration.point_in_time_recovery_enabled is set to true. Defaults to ZONAL.

settings.backupConfiguration

Optional

object

settings.backupConfiguration.backupRetentionSettings

Optional

object

settings.backupConfiguration.backupRetentionSettings.retainedBackups

Required*

integer

Number of backups to retain.

settings.backupConfiguration.backupRetentionSettings.retentionUnit

Optional

string

The unit that 'retainedBackups' represents. Defaults to COUNT.

settings.backupConfiguration.binaryLogEnabled

Optional

boolean

True if binary logging is enabled. If settings.backup_configuration.enabled is false, this must be as well. Can only be used with MySQL.

settings.backupConfiguration.enabled

Optional

boolean

True if backup configuration is enabled.

settings.backupConfiguration.location

Optional

string

Location of the backup configuration.

settings.backupConfiguration.pointInTimeRecoveryEnabled

Optional

boolean

True if Point-in-time recovery is enabled.

settings.backupConfiguration.startTime

Optional

string

HH:MM format time indicating when backup configuration starts.

settings.backupConfiguration.transactionLogRetentionDays

Optional

integer

The number of days of transaction logs we retain for point in time restore, from 1-7. (For PostgreSQL Enterprise Plus instances, from 1 to 35.).

settings.collation

Optional

string

Immutable. The name of server instance collation.

settings.connectorEnforcement

Optional

string

Specifies if connections must use Cloud SQL connectors.

settings.crashSafeReplication

Optional

boolean

DEPRECATED. This property is only applicable to First Generation instances, and First Generation instances are now deprecated. see https://cloud.google.com/sql/docs/mysql/deprecation-notice for information on how to upgrade to Second Generation instances. Specifying this field has no-ops; it's recommended to remove this field from your configuration.

settings.dataCacheConfig

Optional

object

Data cache configurations.

settings.dataCacheConfig.dataCacheEnabled

Optional

boolean

Whether data cache is enabled for the instance.

settings.databaseFlags

Optional

list (object)

settings.databaseFlags[]

Optional

object

settings.databaseFlags[].name

Required*

string

Name of the flag.

settings.databaseFlags[].value

Required*

string

Value of the flag.

settings.deletionProtectionEnabled

Optional

boolean

Configuration to protect against accidental instance deletion.

settings.denyMaintenancePeriod

Optional

object

settings.denyMaintenancePeriod.endDate

Required*

string

End date before which maintenance will not take place. The date is in format yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01.

settings.denyMaintenancePeriod.startDate

Required*

string

Start date after which maintenance will not take place. The date is in format yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01.

settings.denyMaintenancePeriod.time

Required*

string

Time in UTC when the "deny maintenance period" starts on start_date and ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00.

settings.diskAutoresize

Optional

boolean

Enables auto-resizing of the storage size. Defaults to true.

settings.diskAutoresizeLimit

Optional

integer

The maximum size, in GB, to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.

settings.diskSize

Optional

integer

The size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. The minimum value is 10GB.

settings.diskType

Optional

string

Immutable. The type of data disk: PD_SSD or PD_HDD. Defaults to PD_SSD.

settings.edition

Optional

string

The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS.

settings.insightsConfig

Optional

object

Configuration of Query Insights.

settings.insightsConfig.queryInsightsEnabled

Optional

boolean

True if Query Insights feature is enabled.

settings.insightsConfig.queryPlansPerMinute

Optional

integer

Number of query execution plans captured by Insights per minute for all queries combined. Between 0 and 20. Default to 5.

settings.insightsConfig.queryStringLength

Optional

integer

Maximum query length stored in bytes. Between 256 and 4500. Default to 1024.

settings.insightsConfig.recordApplicationTags

Optional

boolean

True if Query Insights will record application tags from query when enabled.

settings.insightsConfig.recordClientAddress

Optional

boolean

True if Query Insights will record client address when enabled.

settings.ipConfiguration

Optional

object

settings.ipConfiguration.allocatedIpRange

Optional

string

The name of the allocated ip range for the private ip CloudSQL instance. For example: "google-managed-services-default". If set, the instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?.

settings.ipConfiguration.authorizedNetworks

Optional

list (object)

settings.ipConfiguration.authorizedNetworks[]

Optional

object

settings.ipConfiguration.authorizedNetworks[].expirationTime

Optional

string

settings.ipConfiguration.authorizedNetworks[].name

Optional

string

settings.ipConfiguration.authorizedNetworks[].value

Required*

string

settings.ipConfiguration.enablePrivatePathForGoogleCloudServices

Optional

boolean

Whether Google Cloud services such as BigQuery are allowed to access data in this Cloud SQL instance over a private IP connection. SQLSERVER database type is not supported.

settings.ipConfiguration.ipv4Enabled

Optional

boolean

Whether this Cloud SQL instance should be assigned a public IPV4 address. At least ipv4_enabled must be enabled or a private_network must be configured.

settings.ipConfiguration.privateNetworkRef

Optional

object

settings.ipConfiguration.privateNetworkRef.external

Optional

string

A reference to an externally managed Compute Network resource. Should be in the format `projects//global/networks/`.

settings.ipConfiguration.privateNetworkRef.name

Optional

string

The `name` field of a `ComputeNetwork` resource.

settings.ipConfiguration.privateNetworkRef.namespace

Optional

string

The `namespace` field of a `ComputeNetwork` resource.

settings.ipConfiguration.pscConfig

Optional

list (object)

PSC settings for a Cloud SQL instance.

settings.ipConfiguration.pscConfig[]

Optional

object

settings.ipConfiguration.pscConfig[].allowedConsumerProjects

Optional

list (string)

List of consumer projects that are allow-listed for PSC connections to this instance. This instance can be connected to with PSC from any network in these projects. Each consumer project in this list may be represented by a project number (numeric) or by a project id (alphanumeric).

settings.ipConfiguration.pscConfig[].allowedConsumerProjects[]

Optional

string

settings.ipConfiguration.pscConfig[].pscEnabled

Optional

boolean

Whether PSC connectivity is enabled for this instance.

settings.ipConfiguration.requireSsl

Optional

boolean

settings.ipConfiguration.sslMode

Optional

string

Specify how SSL connection should be enforced in DB connections. This field provides more SSL enforcment options compared to requireSsl. To change this field, also set the correspoding value in requireSsl if it has been set.

settings.locationPreference

Optional

object

settings.locationPreference.followGaeApplication

Optional

string

A Google App Engine application whose zone to remain in. Must be in the same region as this instance.

settings.locationPreference.secondaryZone

Optional

string

The preferred Compute Engine zone for the secondary/failover.

settings.locationPreference.zone

Optional

string

The preferred compute engine zone.

settings.maintenanceWindow

Optional

object

Declares a one-hour maintenance window when an Instance can automatically restart to apply updates. The maintenance window is specified in UTC time.

settings.maintenanceWindow.day

Optional

integer

Day of week (1-7), starting on Monday.

settings.maintenanceWindow.hour

Optional

integer

Hour of day (0-23), ignored if day not set.

settings.maintenanceWindow.updateTrack

Optional

string

Receive updates earlier (canary) or later (stable).

settings.passwordValidationPolicy

Optional

object

settings.passwordValidationPolicy.complexity

Optional

string

Password complexity.

settings.passwordValidationPolicy.disallowUsernameSubstring

Optional

boolean

Disallow username as a part of the password.

settings.passwordValidationPolicy.enablePasswordPolicy

Required*

boolean

Whether the password policy is enabled or not.

settings.passwordValidationPolicy.minLength

Optional

integer

Minimum number of characters allowed.

settings.passwordValidationPolicy.passwordChangeInterval

Optional

string

Minimum interval after which the password can be changed. This flag is only supported for PostgresSQL.

settings.passwordValidationPolicy.reuseInterval

Optional

integer

Number of previous passwords that cannot be reused.

settings.pricingPlan

Optional

string

Pricing plan for this instance, can only be PER_USE.

settings.replicationType

Optional

string

DEPRECATED. This property is only applicable to First Generation instances, and First Generation instances are now deprecated. see https://cloud.google.com/sql/docs/mysql/deprecation-notice for information on how to upgrade to Second Generation instances. Specifying this field has no-ops; it's recommended to remove this field from your configuration.

settings.sqlServerAuditConfig

Optional

object

settings.sqlServerAuditConfig.bucketRef

Optional

object

The name of the destination bucket (e.g., gs://mybucket).

settings.sqlServerAuditConfig.bucketRef.external

Optional

string

The StorageBucket selfLink, when not managed by Config Connector.

settings.sqlServerAuditConfig.bucketRef.name

Optional

string

The `name` field of a `StorageBucket` resource.

settings.sqlServerAuditConfig.bucketRef.namespace

Optional

string

The `namespace` field of a `StorageBucket` resource.

settings.sqlServerAuditConfig.retentionInterval

Optional

string

How long to keep generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s"..

settings.sqlServerAuditConfig.uploadInterval

Optional

string

How often to upload generated audit files. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

settings.tier

Required

string

The machine type to use. See tiers for more details and supported versions. Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312. See the Custom Machine Type Documentation to learn about specifying custom machine types.

settings.timeZone

Optional

string

Immutable. The time_zone to be used by the database engine (supported only for SQL Server), in SQL Server timezone format.

* Field is required when parent field is specified

Status

Schema

availableMaintenanceVersions:
- string
conditions:
- lastTransitionTime: string
  message: string
  reason: string
  status: string
  type: string
connectionName: string
dnsName: string
firstIpAddress: string
instanceType: string
ipAddress:
- ipAddress: string
  timeToRetire: string
  type: string
observedGeneration: integer
privateIpAddress: string
pscServiceAttachmentLink: string
publicIpAddress: string
selfLink: string
serverCaCert:
  cert: string
  commonName: string
  createTime: string
  expirationTime: string
  sha1Fingerprint: string
serviceAccountEmailAddress: string
Fields
availableMaintenanceVersions

list (string)

Available Maintenance versions.

availableMaintenanceVersions[]

string

conditions

list (object)

Conditions represent the latest available observations of the SQLInstance's current state.

conditions[]

object

conditions[].lastTransitionTime

string

Last time the condition transitioned from one status to another.

conditions[].message

string

Human-readable message indicating details about last transition.

conditions[].reason

string

Unique, one-word, CamelCase reason for the condition's last transition.

conditions[].status

string

Status is the status of the condition. Can be True, False, Unknown.

conditions[].type

string

Type is the type of the condition.

connectionName

string

The connection name of the instance to be used in connection strings. For example, when connecting with Cloud SQL Proxy.

dnsName

string

The dns name of the instance.

firstIpAddress

string

instanceType

string

The type of the instance. The valid values are:- 'SQL_INSTANCE_TYPE_UNSPECIFIED', 'CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE' and 'READ_REPLICA_INSTANCE'.

ipAddress

list (object)

ipAddress[]

object

ipAddress[].ipAddress

string

ipAddress[].timeToRetire

string

ipAddress[].type

string

observedGeneration

integer

ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource.

privateIpAddress

string

pscServiceAttachmentLink

string

The link to service attachment of PSC instance.

publicIpAddress

string

selfLink

string

The URI of the created resource.

serverCaCert

object

serverCaCert.cert

string

The CA Certificate used to connect to the SQL Instance via SSL.

serverCaCert.commonName

string

The CN valid for the CA Cert.

serverCaCert.createTime

string

Creation time of the CA Cert.

serverCaCert.expirationTime

string

Expiration time of the CA Cert.

serverCaCert.sha1Fingerprint

string

SHA Fingerprint of the CA Cert.

serviceAccountEmailAddress

string

The service account email address assigned to the instance.

Sample YAML(s)

Mysql SQL Instance

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: sql.cnrm.cloud.google.com/v1beta1
kind: SQLInstance
metadata:
  name: sqlinstance-sample-mysql
spec:
  databaseVersion: MYSQL_5_7
  region: us-central1
  settings:
    tier: db-f1-micro

Mysql SQL Instance High Availability

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: sql.cnrm.cloud.google.com/v1beta1
kind: SQLInstance
metadata:
  name: sqlinstance-sample-mysqlhighavailability
spec:
  databaseVersion: MYSQL_5_7
  region: us-central1
  settings:
    tier: db-g1-small
    diskSize: 25
    diskType: PD_SSD
    availabilityType: REGIONAL
    backupConfiguration:
      binaryLogEnabled: true
      enabled: true

Mysql SQL Instance With Replication

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: sql.cnrm.cloud.google.com/v1beta1
kind: SQLInstance
metadata:
  name: sqlinstance-sample1-mysqlwithreplication
spec:
  databaseVersion: MYSQL_5_7
  region: us-central1
  settings:
    tier: db-f1-micro
    backupConfiguration:
        binaryLogEnabled: true
        enabled: true
        startTime: "18:00"
    ipConfiguration:
      requireSsl: true
    locationPreference:
        zone: us-central1-b
---
apiVersion: sql.cnrm.cloud.google.com/v1beta1
kind: SQLInstance
metadata:
  name: sqlinstance-sample2-mysqlwithreplication
spec:
  databaseVersion: MYSQL_5_7
  region: us-central1
  masterInstanceRef: 
    name: sqlinstance-sample1-mysqlwithreplication
  replicaConfiguration:
    connectRetryInterval: 30
  settings:
    tier: db-f1-micro
    ipConfiguration:
      requireSsl: true
    locationPreference:
        zone: us-central1-a

Postgres SQL Instance High Availability

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: sql.cnrm.cloud.google.com/v1beta1
kind: SQLInstance
metadata:
  name: sqlinstance-sample-postgreshighavailability
spec:
  databaseVersion: POSTGRES_9_6
  region: us-central1
  settings:
    tier: db-custom-1-3840
    availabilityType: REGIONAL

Private Ip Instance

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: sql.cnrm.cloud.google.com/v1beta1
kind: SQLInstance
metadata:
  name: sqlinstance-sample-private-ip
spec:
  databaseVersion: MYSQL_5_7
  region: us-central1
  settings:
    tier: db-f1-micro
    ipConfiguration:
      ipv4Enabled: false
      privateNetworkRef:
        name: sqlinstance-dep-private-ip
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeAddress
metadata:
  name: sqlinstance-dep-private-ip
spec:
  addressType: INTERNAL
  location: global
  purpose: VPC_PEERING
  prefixLength: 16
  networkRef:
    name: sqlinstance-dep-private-ip
---
apiVersion: compute.cnrm.cloud.google.com/v1beta1
kind: ComputeNetwork
metadata:
  name: sqlinstance-dep-private-ip
spec:
  autoCreateSubnetworks: false
---
apiVersion: servicenetworking.cnrm.cloud.google.com/v1beta1
kind: ServiceNetworkingConnection
metadata:
  name: sqlinstance-dep-private-ip
spec:
  networkRef:
    name: sqlinstance-dep-private-ip
  reservedPeeringRanges:
    - name: sqlinstance-dep-private-ip
  service: servicenetworking.googleapis.com

SQL Server Instance

# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: sql.cnrm.cloud.google.com/v1beta1
kind: SQLInstance
metadata:
  name: sqlinstance-sample-sqlserver
  annotations:
    # Replace ${PROJECT_ID?} with your project ID
    cnrm.cloud.google.com/project-id: ${PROJECT_ID?}
spec:
  region: us-central1
  databaseVersion: SQLSERVER_2017_EXPRESS
  settings:
    tier: db-custom-1-3840
    sqlServerAuditConfig:
      bucketRef:
        name: ${PROJECT_ID?}-sqlinstance-dep-sqlserver
  rootPassword:
    value: "1234"
---
apiVersion: storage.cnrm.cloud.google.com/v1beta1
kind: StorageBucket
metadata:
  annotations:
    cnrm.cloud.google.com/force-destroy: "false"
  # StorageBucket names must be globally unique. Replace ${PROJECT_ID?} with your project ID.
  name: ${PROJECT_ID?}-sqlinstance-dep-sqlserver