1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. sql
  5. ProvisionScript
Viewing docs for Google Cloud v9.18.0
published on Wednesday, Apr 1, 2026 by Pulumi
gcp logo
Viewing docs for Google Cloud v9.18.0
published on Wednesday, Apr 1, 2026 by Pulumi

    Executes a SQL script to provision in-database resources on a Cloud SQL Instance. For more information, see the Cloud SQL official documentation, or the JSON API.

    Warning: The SQL script and its execution response might transit through intermediate locations between your client and the location of the target instance.

    Note: Terraform connects to the instance via IAM database authentication to execute the script, so the identity account used to apply your Terraform config must exist as an IAM user or IAM service account in the instance. You also need to grant roles or privileges to this IAM user or IAM service account so it has permission to execute statements in your provision scripts. See the example below.

    Example Usage

    Example managing a Cloud SQL Postgres instance with a provision script.

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const instance = new gcp.sql.DatabaseInstance("instance", {
        name: "my-instance",
        databaseVersion: "POSTGRES_17",
        settings: {
            tier: "db-perf-optimized-N-2",
            dataApiAccess: "ALLOW_DATA_API",
            databaseFlags: [{
                name: "cloudsql.iam_authentication",
                value: "on",
            }],
        },
    });
    // Create a database user for your account and grant roles so it has privilege to access the database.
    // Set the type to "CLOUD_IAM_USER" for huamn account or "CLOUD_IAM_SERVICE_ACCOUNT" for service account.
    // If a service account is used and the instance is Postgres, please trim the ".gserviceaccount.com" suffix
    // to avoid exceeding the username length limit.
    const iamUser = new gcp.sql.User("iam_user", {
        name: "account-used-to-apply-this-config@example.com",
        instance: instance.name,
        type: "CLOUD_IAM_USER",
        databaseRoles: ["cloudsqlsuperuser"],
    });
    const database = new gcp.sql.Database("database", {
        name: "my-database",
        instance: instance.name,
    });
    const table = new gcp.sql.ProvisionScript("table", {
        script: "CREATE TABLE IF NOT EXISTS table1 ( col VARCHAR(16) NOT NULL );",
        instance: instance.name,
        database: database.name,
        description: "sql script to create tables",
    }, {
        dependsOn: [iamUser],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    instance = gcp.sql.DatabaseInstance("instance",
        name="my-instance",
        database_version="POSTGRES_17",
        settings={
            "tier": "db-perf-optimized-N-2",
            "data_api_access": "ALLOW_DATA_API",
            "database_flags": [{
                "name": "cloudsql.iam_authentication",
                "value": "on",
            }],
        })
    # Create a database user for your account and grant roles so it has privilege to access the database.
    # Set the type to "CLOUD_IAM_USER" for huamn account or "CLOUD_IAM_SERVICE_ACCOUNT" for service account.
    # If a service account is used and the instance is Postgres, please trim the ".gserviceaccount.com" suffix
    # to avoid exceeding the username length limit.
    iam_user = gcp.sql.User("iam_user",
        name="account-used-to-apply-this-config@example.com",
        instance=instance.name,
        type="CLOUD_IAM_USER",
        database_roles=["cloudsqlsuperuser"])
    database = gcp.sql.Database("database",
        name="my-database",
        instance=instance.name)
    table = gcp.sql.ProvisionScript("table",
        script="CREATE TABLE IF NOT EXISTS table1 ( col VARCHAR(16) NOT NULL );",
        instance=instance.name,
        database=database.name,
        description="sql script to create tables",
        opts = pulumi.ResourceOptions(depends_on=[iam_user]))
    
    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 {
    		instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
    			Name:            pulumi.String("my-instance"),
    			DatabaseVersion: pulumi.String("POSTGRES_17"),
    			Settings: &sql.DatabaseInstanceSettingsArgs{
    				Tier:          pulumi.String("db-perf-optimized-N-2"),
    				DataApiAccess: pulumi.String("ALLOW_DATA_API"),
    				DatabaseFlags: sql.DatabaseInstanceSettingsDatabaseFlagArray{
    					&sql.DatabaseInstanceSettingsDatabaseFlagArgs{
    						Name:  pulumi.String("cloudsql.iam_authentication"),
    						Value: pulumi.String("on"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Create a database user for your account and grant roles so it has privilege to access the database.
    		// Set the type to "CLOUD_IAM_USER" for huamn account or "CLOUD_IAM_SERVICE_ACCOUNT" for service account.
    		// If a service account is used and the instance is Postgres, please trim the ".gserviceaccount.com" suffix
    		// to avoid exceeding the username length limit.
    		iamUser, err := sql.NewUser(ctx, "iam_user", &sql.UserArgs{
    			Name:     pulumi.String("account-used-to-apply-this-config@example.com"),
    			Instance: instance.Name,
    			Type:     pulumi.String("CLOUD_IAM_USER"),
    			DatabaseRoles: pulumi.StringArray{
    				pulumi.String("cloudsqlsuperuser"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		database, err := sql.NewDatabase(ctx, "database", &sql.DatabaseArgs{
    			Name:     pulumi.String("my-database"),
    			Instance: instance.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = sql.NewProvisionScript(ctx, "table", &sql.ProvisionScriptArgs{
    			Script:      pulumi.String("CREATE TABLE IF NOT EXISTS table1 ( col VARCHAR(16) NOT NULL );"),
    			Instance:    instance.Name,
    			Database:    database.Name,
    			Description: pulumi.String("sql script to create tables"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			iamUser,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var instance = new Gcp.Sql.DatabaseInstance("instance", new()
        {
            Name = "my-instance",
            DatabaseVersion = "POSTGRES_17",
            Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
            {
                Tier = "db-perf-optimized-N-2",
                DataApiAccess = "ALLOW_DATA_API",
                DatabaseFlags = new[]
                {
                    new Gcp.Sql.Inputs.DatabaseInstanceSettingsDatabaseFlagArgs
                    {
                        Name = "cloudsql.iam_authentication",
                        Value = "on",
                    },
                },
            },
        });
    
        // Create a database user for your account and grant roles so it has privilege to access the database.
        // Set the type to "CLOUD_IAM_USER" for huamn account or "CLOUD_IAM_SERVICE_ACCOUNT" for service account.
        // If a service account is used and the instance is Postgres, please trim the ".gserviceaccount.com" suffix
        // to avoid exceeding the username length limit.
        var iamUser = new Gcp.Sql.User("iam_user", new()
        {
            Name = "account-used-to-apply-this-config@example.com",
            Instance = instance.Name,
            Type = "CLOUD_IAM_USER",
            DatabaseRoles = new[]
            {
                "cloudsqlsuperuser",
            },
        });
    
        var database = new Gcp.Sql.Database("database", new()
        {
            Name = "my-database",
            Instance = instance.Name,
        });
    
        var table = new Gcp.Sql.ProvisionScript("table", new()
        {
            Script = "CREATE TABLE IF NOT EXISTS table1 ( col VARCHAR(16) NOT NULL );",
            Instance = instance.Name,
            Database = database.Name,
            Description = "sql script to create tables",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                iamUser,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.sql.DatabaseInstance;
    import com.pulumi.gcp.sql.DatabaseInstanceArgs;
    import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
    import com.pulumi.gcp.sql.User;
    import com.pulumi.gcp.sql.UserArgs;
    import com.pulumi.gcp.sql.Database;
    import com.pulumi.gcp.sql.DatabaseArgs;
    import com.pulumi.gcp.sql.ProvisionScript;
    import com.pulumi.gcp.sql.ProvisionScriptArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    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 DatabaseInstance("instance", DatabaseInstanceArgs.builder()
                .name("my-instance")
                .databaseVersion("POSTGRES_17")
                .settings(DatabaseInstanceSettingsArgs.builder()
                    .tier("db-perf-optimized-N-2")
                    .dataApiAccess("ALLOW_DATA_API")
                    .databaseFlags(DatabaseInstanceSettingsDatabaseFlagArgs.builder()
                        .name("cloudsql.iam_authentication")
                        .value("on")
                        .build())
                    .build())
                .build());
    
            // Create a database user for your account and grant roles so it has privilege to access the database.
            // Set the type to "CLOUD_IAM_USER" for huamn account or "CLOUD_IAM_SERVICE_ACCOUNT" for service account.
            // If a service account is used and the instance is Postgres, please trim the ".gserviceaccount.com" suffix
            // to avoid exceeding the username length limit.
            var iamUser = new User("iamUser", UserArgs.builder()
                .name("account-used-to-apply-this-config@example.com")
                .instance(instance.name())
                .type("CLOUD_IAM_USER")
                .databaseRoles("cloudsqlsuperuser")
                .build());
    
            var database = new Database("database", DatabaseArgs.builder()
                .name("my-database")
                .instance(instance.name())
                .build());
    
            var table = new ProvisionScript("table", ProvisionScriptArgs.builder()
                .script("CREATE TABLE IF NOT EXISTS table1 ( col VARCHAR(16) NOT NULL );")
                .instance(instance.name())
                .database(database.name())
                .description("sql script to create tables")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(iamUser)
                    .build());
    
        }
    }
    
    resources:
      instance:
        type: gcp:sql:DatabaseInstance
        properties:
          name: my-instance
          databaseVersion: POSTGRES_17
          settings:
            tier: db-perf-optimized-N-2
            dataApiAccess: ALLOW_DATA_API
            databaseFlags:
              - name: cloudsql.iam_authentication
                value: on
      # Create a database user for your account and grant roles so it has privilege to access the database.
      # Set the type to "CLOUD_IAM_USER" for huamn account or "CLOUD_IAM_SERVICE_ACCOUNT" for service account.
      # If a service account is used and the instance is Postgres, please trim the ".gserviceaccount.com" suffix
      # to avoid exceeding the username length limit.
      iamUser:
        type: gcp:sql:User
        name: iam_user
        properties:
          name: account-used-to-apply-this-config@example.com
          instance: ${instance.name}
          type: CLOUD_IAM_USER
          databaseRoles: # Roles granted to the user. Smaller roles are preferred, if exist.
            - cloudsqlsuperuser
      database:
        type: gcp:sql:Database
        properties:
          name: my-database
          instance: ${instance.name}
      table:
        type: gcp:sql:ProvisionScript
        properties:
          script: CREATE TABLE IF NOT EXISTS table1 ( col VARCHAR(16) NOT NULL );
          instance: ${instance.name}
          database: ${database.name}
          description: sql script to create tables
        options:
          dependsOn:
            - ${iamUser}
    

    Example managing a Cloud SQL MySQL instance with a provision script.

    Create ProvisionScript Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ProvisionScript(name: string, args: ProvisionScriptArgs, opts?: CustomResourceOptions);
    @overload
    def ProvisionScript(resource_name: str,
                        args: ProvisionScriptArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProvisionScript(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        instance: Optional[str] = None,
                        script: Optional[str] = None,
                        database: Optional[str] = None,
                        deletion_policy: Optional[str] = None,
                        description: Optional[str] = None,
                        project: Optional[str] = None)
    func NewProvisionScript(ctx *Context, name string, args ProvisionScriptArgs, opts ...ResourceOption) (*ProvisionScript, error)
    public ProvisionScript(string name, ProvisionScriptArgs args, CustomResourceOptions? opts = null)
    public ProvisionScript(String name, ProvisionScriptArgs args)
    public ProvisionScript(String name, ProvisionScriptArgs args, CustomResourceOptions options)
    
    type: gcp:sql:ProvisionScript
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ProvisionScriptArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ProvisionScriptArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ProvisionScriptArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProvisionScriptArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProvisionScriptArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var provisionScriptResource = new Gcp.Sql.ProvisionScript("provisionScriptResource", new()
    {
        Instance = "string",
        Script = "string",
        Database = "string",
        DeletionPolicy = "string",
        Description = "string",
        Project = "string",
    });
    
    example, err := sql.NewProvisionScript(ctx, "provisionScriptResource", &sql.ProvisionScriptArgs{
    	Instance:       pulumi.String("string"),
    	Script:         pulumi.String("string"),
    	Database:       pulumi.String("string"),
    	DeletionPolicy: pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	Project:        pulumi.String("string"),
    })
    
    var provisionScriptResource = new ProvisionScript("provisionScriptResource", ProvisionScriptArgs.builder()
        .instance("string")
        .script("string")
        .database("string")
        .deletionPolicy("string")
        .description("string")
        .project("string")
        .build());
    
    provision_script_resource = gcp.sql.ProvisionScript("provisionScriptResource",
        instance="string",
        script="string",
        database="string",
        deletion_policy="string",
        description="string",
        project="string")
    
    const provisionScriptResource = new gcp.sql.ProvisionScript("provisionScriptResource", {
        instance: "string",
        script: "string",
        database: "string",
        deletionPolicy: "string",
        description: "string",
        project: "string",
    });
    
    type: gcp:sql:ProvisionScript
    properties:
        database: string
        deletionPolicy: string
        description: string
        instance: string
        project: string
        script: string
    

    ProvisionScript Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ProvisionScript resource accepts the following input properties:

    Instance string
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    Script string
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    Database string
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    DeletionPolicy string
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    Description string
    The description of the provision script.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Instance string
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    Script string
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    Database string
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    DeletionPolicy string
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    Description string
    The description of the provision script.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance String
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    script String
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database String
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletionPolicy String
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description String
    The description of the provision script.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance string
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    script string
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database string
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletionPolicy string
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description string
    The description of the provision script.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance str
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    script str
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database str
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletion_policy str
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description str
    The description of the provision script.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    instance String
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    script String
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database String
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletionPolicy String
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description String
    The description of the provision script.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ProvisionScript resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ProvisionScript Resource

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

    public static get(name: string, id: Input<ID>, state?: ProvisionScriptState, opts?: CustomResourceOptions): ProvisionScript
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            database: Optional[str] = None,
            deletion_policy: Optional[str] = None,
            description: Optional[str] = None,
            instance: Optional[str] = None,
            project: Optional[str] = None,
            script: Optional[str] = None) -> ProvisionScript
    func GetProvisionScript(ctx *Context, name string, id IDInput, state *ProvisionScriptState, opts ...ResourceOption) (*ProvisionScript, error)
    public static ProvisionScript Get(string name, Input<string> id, ProvisionScriptState? state, CustomResourceOptions? opts = null)
    public static ProvisionScript get(String name, Output<String> id, ProvisionScriptState state, CustomResourceOptions options)
    resources:  _:    type: gcp:sql:ProvisionScript    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Database string
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    DeletionPolicy string
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    Description string
    The description of the provision script.
    Instance string
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Script string
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    Database string
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    DeletionPolicy string
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    Description string
    The description of the provision script.
    Instance string
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Script string
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database String
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletionPolicy String
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description String
    The description of the provision script.
    instance String
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    script String
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database string
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletionPolicy string
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description string
    The description of the provision script.
    instance string
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    script string
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database str
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletion_policy str
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description str
    The description of the provision script.
    instance str
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    script str
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.
    database String
    The name of the database to which Terraform connects. Changing this forces Terraform to connect to the new database and run the script. This argument is required for Postgres instances. It's optional for MySQL, but some of your queries may require a database. You can create and use a database in the script or explicitly reference a google_sql_database.
    deletionPolicy String
    The deletion policy for the resources created by the script. The default is "ABANDON". It must be "ABANDON" to allow Terraform to abandon the resources. If you want to delete resources, add statements in the script such as drop … if exists.
    description String
    The description of the provision script.
    instance String
    The name of the Cloud SQL instance. Changing this forces the script to be run on the new instance.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    script String
    The SQL script to provision database resources. Its execution time limit is 30 s and it will be canceled if it takes longer than 30 s. You can use patterns like create if not exists … or if not exists (select …) then … end if to avoid existence-related errors. If it's not possible to make a statement idempotent, you can run it once and then remove it from this script.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Viewing docs for Google Cloud v9.18.0
    published on Wednesday, Apr 1, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.