SourceRepresentationInstance class
A source representation instance is a Cloud SQL instance that represents the source database server to the Cloud SQL replica. It is visible in the Cloud Console and appears the same as a regular Cloud SQL instance, but it contains no data, requires no configuration or maintenance, and does not affect billing. You cannot update the source representation instance.
Example Usage
Sql Source Representation Instance Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const instance = new gcp.sql.SourceRepresentationInstance("instance", {
name: "my-instance",
region: "us-central1",
databaseVersion: "MYSQL_8_0",
host: "10.20.30.40",
port: 3306,
username: "some-user",
password: "password-for-the-user",
dumpFilePath: "gs://replica-bucket/source-database.sql.gz",
});
import pulumi
import pulumi_gcp as gcp
instance = gcp.sql.SourceRepresentationInstance("instance",
name="my-instance",
region="us-central1",
database_version="MYSQL_8_0",
host="10.20.30.40",
port=3306,
username="some-user",
password="password-for-the-user",
dump_file_path="gs://replica-bucket/source-database.sql.gz")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var instance = new Gcp.Sql.SourceRepresentationInstance("instance", new()
{
Name = "my-instance",
Region = "us-central1",
DatabaseVersion = "MYSQL_8_0",
Host = "10.20.30.40",
Port = 3306,
Username = "some-user",
Password = "password-for-the-user",
DumpFilePath = "gs://replica-bucket/source-database.sql.gz",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/sql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sql.NewSourceRepresentationInstance(ctx, "instance", &sql.SourceRepresentationInstanceArgs{
Name: pulumi.String("my-instance"),
Region: pulumi.String("us-central1"),
DatabaseVersion: pulumi.String("MYSQL_8_0"),
Host: pulumi.String("10.20.30.40"),
Port: pulumi.Int(3306),
Username: pulumi.String("some-user"),
Password: pulumi.String("password-for-the-user"),
DumpFilePath: pulumi.String("gs://replica-bucket/source-database.sql.gz"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_sql_sourcerepresentationinstance" "instance" {
name = "my-instance"
region = "us-central1"
database_version = "MYSQL_8_0"
host = "10.20.30.40"
port = 3306
username = "some-user"
password = "password-for-the-user"
dump_file_path = "gs://replica-bucket/source-database.sql.gz"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sql.SourceRepresentationInstance;
import com.pulumi.gcp.sql.SourceRepresentationInstanceArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var instance = new SourceRepresentationInstance("instance", SourceRepresentationInstanceArgs.builder()
.name("my-instance")
.region("us-central1")
.databaseVersion("MYSQL_8_0")
.host("10.20.30.40")
.port(3306)
.username("some-user")
.password("password-for-the-user")
.dumpFilePath("gs://replica-bucket/source-database.sql.gz")
.build());
}
}
resources:
instance:
type: gcp:sql:SourceRepresentationInstance
properties:
name: my-instance
region: us-central1
databaseVersion: MYSQL_8_0
host: 10.20.30.40
port: 3306
username: some-user
password: password-for-the-user
dumpFilePath: gs://replica-bucket/source-database.sql.gz
Sql Source Representation Instance Postgres
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const instance = new gcp.sql.SourceRepresentationInstance("instance", {
name: "my-instance",
region: "us-central1",
databaseVersion: "POSTGRES_9_6",
host: "10.20.30.40",
port: 3306,
username: "some-user",
password: "password-for-the-user",
dumpFilePath: "gs://replica-bucket/source-database.sql.gz",
});
import pulumi
import pulumi_gcp as gcp
instance = gcp.sql.SourceRepresentationInstance("instance",
name="my-instance",
region="us-central1",
database_version="POSTGRES_9_6",
host="10.20.30.40",
port=3306,
username="some-user",
password="password-for-the-user",
dump_file_path="gs://replica-bucket/source-database.sql.gz")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var instance = new Gcp.Sql.SourceRepresentationInstance("instance", new()
{
Name = "my-instance",
Region = "us-central1",
DatabaseVersion = "POSTGRES_9_6",
Host = "10.20.30.40",
Port = 3306,
Username = "some-user",
Password = "password-for-the-user",
DumpFilePath = "gs://replica-bucket/source-database.sql.gz",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/sql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := sql.NewSourceRepresentationInstance(ctx, "instance", &sql.SourceRepresentationInstanceArgs{
Name: pulumi.String("my-instance"),
Region: pulumi.String("us-central1"),
DatabaseVersion: pulumi.String("POSTGRES_9_6"),
Host: pulumi.String("10.20.30.40"),
Port: pulumi.Int(3306),
Username: pulumi.String("some-user"),
Password: pulumi.String("password-for-the-user"),
DumpFilePath: pulumi.String("gs://replica-bucket/source-database.sql.gz"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_sql_sourcerepresentationinstance" "instance" {
name = "my-instance"
region = "us-central1"
database_version = "POSTGRES_9_6"
host = "10.20.30.40"
port = 3306
username = "some-user"
password = "password-for-the-user"
dump_file_path = "gs://replica-bucket/source-database.sql.gz"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sql.SourceRepresentationInstance;
import com.pulumi.gcp.sql.SourceRepresentationInstanceArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var instance = new SourceRepresentationInstance("instance", SourceRepresentationInstanceArgs.builder()
.name("my-instance")
.region("us-central1")
.databaseVersion("POSTGRES_9_6")
.host("10.20.30.40")
.port(3306)
.username("some-user")
.password("password-for-the-user")
.dumpFilePath("gs://replica-bucket/source-database.sql.gz")
.build());
}
}
resources:
instance:
type: gcp:sql:SourceRepresentationInstance
properties:
name: my-instance
region: us-central1
databaseVersion: POSTGRES_9_6
host: 10.20.30.40
port: 3306
username: some-user
password: password-for-the-user
dumpFilePath: gs://replica-bucket/source-database.sql.gz
Import
SourceRepresentationInstance can be imported using any of these accepted formats:
projects/{{project}}/instances/{{name}}{{project}}/{{name}}{{name}}
When using the pulumi import command, SourceRepresentationInstance can be imported using one of the formats above. For example:
$ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default projects/{{project}}/instances/{{name}}
$ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default {{project}}/{{name}}
$ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default {{name}}
Constructors
- SourceRepresentationInstance(String name, {SourceRepresentationInstanceArgs? args, CustomResourceOptions? options})
-
Creates a new SourceRepresentationInstance.
nameThe Pulumi resource name.argsArguments used to configure this SourceRepresentationInstance. The set of arguments for SourceRepresentationInstance.optionsResource options controlling this resource's behavior. - SourceRepresentationInstance.reference(String urn)
- Creates a typed reference to an existing SourceRepresentationInstance resource.
Properties
-
caCertificate
↔ Output<
String?> -
The CA certificate on the external server. Include only if SSL/TLS is used on the external server.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
clientCertificate
↔ Output<
String?> -
The client certificate on the external server. Required only for server-client authentication. Include only if SSL/TLS is used on the external server.
latefinal
-
clientKey
↔ Output<
String?> -
The private key file for the client certificate on the external server. Required only for server-client authentication. Include only if SSL/TLS is used on the external server.
latefinal
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
databaseVersion
↔ Output<
String> -
The MySQL, PostgreSQL or SQL Server (beta) version to use. Supported values include MYSQL_5_6, MYSQL_5_7, MYSQL_8_0, MYSQL_8_4, POSTGRES_9_6, POSTGRES_10, POSTGRES_11, POSTGRES_12, POSTGRES_13, POSTGRES_14, POSTGRES_15, POSTGRES_16, POSTGRES_17, POSTGRES_18, SQLSERVER_2022_STANDARD, SQLSERVER_2022_ENTERPRISE, SQLSERVER_2022_EXPRESS, SQLSERVER_2022_WEB, SQLSERVER_2025_STANDARD, SQLSERVER_2025_ENTERPRISE, SQLSERVER_2025_EXPRESS, SQLSERVER_2025_WEB. Database Version Policies includes an up-to-date reference of supported versions.
latefinal
-
deletionPolicy
↔ Output<
String> -
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
When a 'terraform destroy' or 'pulumi up' would delete the resource,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
dumpFilePath
↔ Output<
String?> -
A file in the bucket that contains the data from the external server.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
host
↔ Output<
String> -
The IPv4 address and port for the external server, or the the DNS address for the external server. If the external server is hosted on Cloud SQL, the port is 5432.
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
The name of the source representation instance. Use any valid Cloud SQL instance name.
latefinal
-
password
↔ Output<
String?> -
The password for the replication user account.
Note: This property is sensitive and will not be displayed in the plan.
latefinal
-
port
↔ Output<
int?> -
The externally accessible port for the source database server.
Defaults to 3306.
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
latefinal
-
region
↔ Output<
String> -
The Region in which the created instance should reside.
If it is not provided, the provider region is used.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
username
↔ Output<
String?> -
The replication user account on the external server.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {SourceRepresentationInstanceState? state, CustomResourceOptions? options}) → SourceRepresentationInstance -
Gets an existing SourceRepresentationInstance resource's state with the given
nameandid.