1. How to start an existing GCP SQL instance?


    Currently, there's no direct way to start an existing GCP SQL instance using Pulumi as it's not an exposed functionality of the Google Cloud SQL Admin API that Pulumi could leverage.

    However, if you need to control the state of a GCP SQL instance, you could potentially manage the activationPolicy setting of the gcp.sql.DatabaseInstance resource in Pulumi, which indirectly affects whether the instance is started or stopped. Here's how you could do it:

    import * as pulumi from "@pulumi/pulumi"; import * as gcp from "@pulumi/gcp"; // Existing SQL instance const sqlInstance = new gcp.sql.DatabaseInstance("databaseInstance", { // include all the other necessary configuration settings... settings: { // include other settings... activationPolicy: "ALWAYS", // ALWAYS = instance is started, NEVER = instance is stopped }, });

    The activationPolicy parameter can have one of three values:

    • "ALWAYS": The instance is always up and can accept connections. It consumes resources even if no connections are made and you are billed for the resources.
    • "NEVER": The instance never starts. This mode is used when the instance should not be running most of the time. In this mode, you are not billed for CPU or storage usage, but IP addresses do have associated costs.
    • "ON_DEMAND": The instance starts upon receiving requests and stops when not in use. At least one instance per project works in ON_DEMAND mode.

    By changing this value and running pulumi up, you can control the running state of your SQL instance.

    Caution! Please ensure you understand the implications to your billing and application connectivity before changing activationPolicy settings.

    For more details about the activationPolicy and other settings you can control, please refer to Pulumi's GCP SQL DatabaseInstance documentation.