sql

This provider is a derived work of the Terraform Provider distributed under MPL 2.0. If you encounter a bug or missing feature, first check the pulumi/pulumi-gcp repo; however, if that doesn’t turn up anything, please consult the source terraform-providers/terraform-provider-google repo.

class pulumi_gcp.sql.Database(resource_name, opts=None, charset=None, collation=None, instance=None, name=None, project=None, __props__=None, __name__=None, __opts__=None)

Create a Database resource with the given unique name, props, and options.

Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

project = None

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

static get(resource_name, id, opts=None, charset=None, collation=None, instance=None, name=None, project=None, self_link=None)

Get an existing Database resource’s state with the given name, id, and optional extra properties used to qualify the lookup.

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

class pulumi_gcp.sql.DatabaseInstance(resource_name, opts=None, database_version=None, master_instance_name=None, name=None, project=None, region=None, replica_configuration=None, settings=None, __props__=None, __name__=None, __opts__=None)

Creates a new Google SQL Database Instance. For more information, see the official documentation, or the JSON API.

NOTE on ``sql.DatabaseInstance``: - Second-generation instances include a default ‘root’@’%’ user with no password. This user will be deleted by this provider on instance creation. You should use sql.User to define a custom user with a restricted host and strong password.

Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • database_version (pulumi.Input[str]) – The MySQL or PostgreSQL version to use. Can be MYSQL_5_6, MYSQL_5_7, POSTGRES_9_6 or POSTGRES_11 (beta) for second-generation instances, or MYSQL_5_5 or MYSQL_5_6 for first-generation instances. See Second Generation Capabilities for more information.

  • master_instance_name (pulumi.Input[str]) – The name of the instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

  • name (pulumi.Input[str]) – The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

  • region (pulumi.Input[str]) – The region the instance will sit in. Note, first-generation Cloud SQL instance regions do not line up with the Google Compute Engine (GCE) regions, and Cloud SQL is not available in all regions - choose from one of the options listed here. 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 all first-generation instances and for second-generation 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.

  • replica_configuration (pulumi.Input[dict]) – The configuration for replication. The configuration is detailed below.

  • settings (pulumi.Input[dict]) – The settings to use for the database. The configuration is detailed below.

The replica_configuration object supports the following:

  • caCertificate (pulumi.Input[str])

  • clientCertificate (pulumi.Input[str])

  • clientKey (pulumi.Input[str])

  • connectRetryInterval (pulumi.Input[float])

  • dumpFilePath (pulumi.Input[str])

  • failoverTarget (pulumi.Input[bool])

  • masterHeartbeatPeriod (pulumi.Input[float])

  • password (pulumi.Input[str])

  • sslCipher (pulumi.Input[str])

  • username (pulumi.Input[str])

  • verifyServerCertificate (pulumi.Input[bool])

The settings object supports the following:

  • activationPolicy (pulumi.Input[str])

  • authorizedGaeApplications (pulumi.Input[list])

  • availabilityType (pulumi.Input[str])

  • backupConfiguration (pulumi.Input[dict])

    • binaryLogEnabled (pulumi.Input[bool])

    • enabled (pulumi.Input[bool])

    • location (pulumi.Input[str])

    • startTime (pulumi.Input[str])

  • crashSafeReplication (pulumi.Input[bool])

  • databaseFlags (pulumi.Input[list])

    • name (pulumi.Input[str]) - The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

    • value (pulumi.Input[str])

  • diskAutoresize (pulumi.Input[bool])

  • diskSize (pulumi.Input[float])

  • diskType (pulumi.Input[str])

  • ip_configuration (pulumi.Input[dict])

    • authorizedNetworks (pulumi.Input[list])

      • expiration_time (pulumi.Input[str])

      • name (pulumi.Input[str]) - The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

      • value (pulumi.Input[str])

    • ipv4Enabled (pulumi.Input[bool])

    • privateNetwork (pulumi.Input[str])

    • requireSsl (pulumi.Input[bool])

  • locationPreference (pulumi.Input[dict])

    • followGaeApplication (pulumi.Input[str])

    • zone (pulumi.Input[str])

  • maintenanceWindow (pulumi.Input[dict])

    • day (pulumi.Input[float])

    • hour (pulumi.Input[float])

    • updateTrack (pulumi.Input[str])

  • pricingPlan (pulumi.Input[str])

  • replicationType (pulumi.Input[str])

  • tier (pulumi.Input[str])

  • user_labels (pulumi.Input[dict])

  • version (pulumi.Input[float])

connection_name = None

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

database_version = None

The MySQL or PostgreSQL version to use. Can be MYSQL_5_6, MYSQL_5_7, POSTGRES_9_6 or POSTGRES_11 (beta) for second-generation instances, or MYSQL_5_5 or MYSQL_5_6 for first-generation instances. See Second Generation Capabilities for more information.

master_instance_name = None

The name of the instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

name = None

The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

private_ip_address = None

The first private (PRIVATE) IPv4 address assigned. This provides a convenient way to access an IP of a specific type without performing filtering.

project = None

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

public_ip_address = None

The first public (PRIMARY) IPv4 address assigned. This provides a convenient way to access an IP of a specific type without performing filtering.

region = None

The region the instance will sit in. Note, first-generation Cloud SQL instance regions do not line up with the Google Compute Engine (GCE) regions, and Cloud SQL is not available in all regions - choose from one of the options listed here. 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 all first-generation instances and for second-generation 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.

replica_configuration = None

The configuration for replication. The configuration is detailed below.

  • caCertificate (str)

  • clientCertificate (str)

  • clientKey (str)

  • connectRetryInterval (float)

  • dumpFilePath (str)

  • failoverTarget (bool)

  • masterHeartbeatPeriod (float)

  • password (str)

  • sslCipher (str)

  • username (str)

  • verifyServerCertificate (bool)

The URI of the created resource.

service_account_email_address = None

The service account email address assigned to the instance. This property is applicable only to Second Generation instances.

settings = None

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

  • activationPolicy (str)

  • authorizedGaeApplications (list)

  • availabilityType (str)

  • backupConfiguration (dict)

    • binaryLogEnabled (bool)

    • enabled (bool)

    • location (str)

    • startTime (str)

  • crashSafeReplication (bool)

  • databaseFlags (list)

    • name (str) - The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

    • value (str)

  • diskAutoresize (bool)

  • diskSize (float)

  • diskType (str)

  • ip_configuration (dict)

    • authorizedNetworks (list)

      • expiration_time (str)

      • name (str) - The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

      • value (str)

    • ipv4Enabled (bool)

    • privateNetwork (str)

    • requireSsl (bool)

  • locationPreference (dict)

    • followGaeApplication (str)

    • zone (str)

  • maintenanceWindow (dict)

    • day (float)

    • hour (float)

    • updateTrack (str)

  • pricingPlan (str)

  • replicationType (str)

  • tier (str)

  • user_labels (dict)

  • version (float)

static get(resource_name, id, opts=None, connection_name=None, database_version=None, first_ip_address=None, ip_addresses=None, master_instance_name=None, name=None, private_ip_address=None, project=None, public_ip_address=None, region=None, replica_configuration=None, self_link=None, server_ca_cert=None, service_account_email_address=None, settings=None)

Get an existing DatabaseInstance resource’s state with the given name, id, and optional extra properties used to qualify the lookup.

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • connection_name (pulumi.Input[str]) –

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

  • database_version (pulumi.Input[str]) –

    The MySQL or PostgreSQL version to use. Can be MYSQL_5_6, MYSQL_5_7, POSTGRES_9_6 or POSTGRES_11 (beta) for second-generation instances, or MYSQL_5_5 or MYSQL_5_6 for first-generation instances. See Second Generation Capabilities for more information.

  • master_instance_name (pulumi.Input[str]) – The name of the instance that will act as the master in the replication setup. Note, this requires the master to have binary_log_enabled set, as well as existing backups.

  • name (pulumi.Input[str]) –

    The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

  • private_ip_address (pulumi.Input[str]) – The first private (PRIVATE) IPv4 address assigned. This provides a convenient way to access an IP of a specific type without performing filtering.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

  • public_ip_address (pulumi.Input[str]) – The first public (PRIMARY) IPv4 address assigned. This provides a convenient way to access an IP of a specific type without performing filtering.

  • region (pulumi.Input[str]) –

    The region the instance will sit in. Note, first-generation Cloud SQL instance regions do not line up with the Google Compute Engine (GCE) regions, and Cloud SQL is not available in all regions - choose from one of the options listed here. 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 all first-generation instances and for second-generation 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.

  • replica_configuration (pulumi.Input[dict]) – The configuration for replication. The configuration is detailed below.

  • self_link (pulumi.Input[str]) – The URI of the created resource.

  • service_account_email_address (pulumi.Input[str]) – The service account email address assigned to the instance. This property is applicable only to Second Generation instances.

  • settings (pulumi.Input[dict]) – The settings to use for the database. The configuration is detailed below.

The ip_addresses object supports the following:

  • ip_address (pulumi.Input[str])

  • timeToRetire (pulumi.Input[str])

  • type (pulumi.Input[str])

The replica_configuration object supports the following:

  • caCertificate (pulumi.Input[str])

  • clientCertificate (pulumi.Input[str])

  • clientKey (pulumi.Input[str])

  • connectRetryInterval (pulumi.Input[float])

  • dumpFilePath (pulumi.Input[str])

  • failoverTarget (pulumi.Input[bool])

  • masterHeartbeatPeriod (pulumi.Input[float])

  • password (pulumi.Input[str])

  • sslCipher (pulumi.Input[str])

  • username (pulumi.Input[str])

  • verifyServerCertificate (pulumi.Input[bool])

The server_ca_cert object supports the following:

  • cert (pulumi.Input[str])

  • common_name (pulumi.Input[str])

  • create_time (pulumi.Input[str])

  • expiration_time (pulumi.Input[str])

  • sha1_fingerprint (pulumi.Input[str])

The settings object supports the following:

  • activationPolicy (pulumi.Input[str])

  • authorizedGaeApplications (pulumi.Input[list])

  • availabilityType (pulumi.Input[str])

  • backupConfiguration (pulumi.Input[dict])

    • binaryLogEnabled (pulumi.Input[bool])

    • enabled (pulumi.Input[bool])

    • location (pulumi.Input[str])

    • startTime (pulumi.Input[str])

  • crashSafeReplication (pulumi.Input[bool])

  • databaseFlags (pulumi.Input[list])

    • name (pulumi.Input[str]) - The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

    • value (pulumi.Input[str])

  • diskAutoresize (pulumi.Input[bool])

  • diskSize (pulumi.Input[float])

  • diskType (pulumi.Input[str])

  • ip_configuration (pulumi.Input[dict])

    • authorizedNetworks (pulumi.Input[list])

      • expiration_time (pulumi.Input[str])

      • name (pulumi.Input[str]) - The name of the instance. If the name is left blank, this provider will randomly generate one when the instance is first created. This is done because after a name is used, it cannot be reused for up to one week.

      • value (pulumi.Input[str])

    • ipv4Enabled (pulumi.Input[bool])

    • privateNetwork (pulumi.Input[str])

    • requireSsl (pulumi.Input[bool])

  • locationPreference (pulumi.Input[dict])

    • followGaeApplication (pulumi.Input[str])

    • zone (pulumi.Input[str])

  • maintenanceWindow (pulumi.Input[dict])

    • day (pulumi.Input[float])

    • hour (pulumi.Input[float])

    • updateTrack (pulumi.Input[str])

  • pricingPlan (pulumi.Input[str])

  • replicationType (pulumi.Input[str])

  • tier (pulumi.Input[str])

  • user_labels (pulumi.Input[dict])

  • version (pulumi.Input[float])

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

class pulumi_gcp.sql.SslCert(resource_name, opts=None, common_name=None, instance=None, project=None, __props__=None, __name__=None, __opts__=None)

Creates a new Google SQL SSL Cert on a Google SQL Instance. For more information, see the official documentation, or the JSON API.

Note: All arguments including the private key will be stored in the raw state as plain-text. Read more about sensitive data in state.

Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • common*name (pulumi.Input[str]) –

    The common name to be used in the certificate to identify the client. Constrained to [a-zA-Z.-* ]+. Changing this forces a new resource to be created.

  • instance (pulumi.Input[str]) – The name of the Cloud SQL instance. Changing this forces a new resource to be created.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

cert = None

The actual certificate data for this client certificate.

cert_serial_number = None

The serial number extracted from the certificate data.

common_name = None

The common name to be used in the certificate to identify the client. Constrained to [a-zA-Z.-_ ]+. Changing this forces a new resource to be created.

create_time = None

The time when the certificate was created in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

expiration_time = None

The time when the certificate expires in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

instance = None

The name of the Cloud SQL instance. Changing this forces a new resource to be created.

private_key = None

The private key associated with the client certificate.

project = None

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

server_ca_cert = None

The CA cert of the server this client cert was generated from.

sha1_fingerprint = None

The SHA1 Fingerprint of the certificate.

static get(resource_name, id, opts=None, cert=None, cert_serial_number=None, common_name=None, create_time=None, expiration_time=None, instance=None, private_key=None, project=None, server_ca_cert=None, sha1_fingerprint=None)

Get an existing SslCert resource’s state with the given name, id, and optional extra properties used to qualify the lookup.

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • cert (pulumi.Input[str]) – The actual certificate data for this client certificate.

  • cert_serial_number (pulumi.Input[str]) – The serial number extracted from the certificate data.

  • common*name (pulumi.Input[str]) –

    The common name to be used in the certificate to identify the client. Constrained to [a-zA-Z.-* ]+. Changing this forces a new resource to be created.

  • create_time (pulumi.Input[str]) – The time when the certificate was created in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

  • expiration_time (pulumi.Input[str]) – The time when the certificate expires in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.

  • instance (pulumi.Input[str]) – The name of the Cloud SQL instance. Changing this forces a new resource to be created.

  • private_key (pulumi.Input[str]) – The private key associated with the client certificate.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

  • server_ca_cert (pulumi.Input[str]) – The CA cert of the server this client cert was generated from.

  • sha1_fingerprint (pulumi.Input[str]) – The SHA1 Fingerprint of the certificate.

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

class pulumi_gcp.sql.User(resource_name, opts=None, host=None, instance=None, name=None, password=None, project=None, __props__=None, __name__=None, __opts__=None)

Creates a new Google SQL User on a Google SQL User Instance. For more information, see the official documentation, or the JSON API.

Note: All arguments including the username and password will be stored in the raw state as plain-text. Read more about sensitive data in state. Passwords will not be retrieved when running import.

Parameters
  • resource_name (str) – The name of the resource.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • host (pulumi.Input[str]) – The host the user can connect from. This is only supported for MySQL instances. Don’t set this field for PostgreSQL instances. Can be an IP address. Changing this forces a new resource to be created.

  • instance (pulumi.Input[str]) – The name of the Cloud SQL instance. Changing this forces a new resource to be created.

  • name (pulumi.Input[str]) – The name of the user. Changing this forces a new resource to be created.

  • password (pulumi.Input[str]) – The password for the user. Can be updated.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

host = None

The host the user can connect from. This is only supported for MySQL instances. Don’t set this field for PostgreSQL instances. Can be an IP address. Changing this forces a new resource to be created.

instance = None

The name of the Cloud SQL instance. Changing this forces a new resource to be created.

name = None

The name of the user. Changing this forces a new resource to be created.

password = None

The password for the user. Can be updated.

project = None

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

static get(resource_name, id, opts=None, host=None, instance=None, name=None, password=None, project=None)

Get an existing User resource’s state with the given name, id, and optional extra properties used to qualify the lookup.

Parameters
  • resource_name (str) – The unique name of the resulting resource.

  • id (str) – The unique provider ID of the resource to lookup.

  • opts (pulumi.ResourceOptions) – Options for the resource.

  • host (pulumi.Input[str]) – The host the user can connect from. This is only supported for MySQL instances. Don’t set this field for PostgreSQL instances. Can be an IP address. Changing this forces a new resource to be created.

  • instance (pulumi.Input[str]) – The name of the Cloud SQL instance. Changing this forces a new resource to be created.

  • name (pulumi.Input[str]) – The name of the user. Changing this forces a new resource to be created.

  • password (pulumi.Input[str]) – The password for the user. Can be updated.

  • project (pulumi.Input[str]) – The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

translate_output_property(prop)

Provides subclasses of Resource an opportunity to translate names of output properties into a format of their choosing before writing those properties to the resource object.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str

translate_input_property(prop)

Provides subclasses of Resource an opportunity to translate names of input properties into a format of their choosing before sending those properties to the Pulumi engine.

Parameters

prop (str) – A property name.

Returns

A potentially transformed property name.

Return type

str