Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi
gcp.sql.getBackupRun
Explore with Pulumi AI
Use this data source to get information about a Cloud SQL instance backup run.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const backup = gcp.sql.getBackupRun({
    instance: main.name,
    mostRecent: true,
});
import pulumi
import pulumi_gcp as gcp
backup = gcp.sql.get_backup_run(instance=main["name"],
    most_recent=True)
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/sql"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sql.GetBackupRun(ctx, &sql.GetBackupRunArgs{
			Instance:   main.Name,
			MostRecent: pulumi.BoolRef(true),
		}, nil)
		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 backup = Gcp.Sql.GetBackupRun.Invoke(new()
    {
        Instance = main.Name,
        MostRecent = true,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.sql.SqlFunctions;
import com.pulumi.gcp.sql.inputs.GetBackupRunArgs;
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) {
        final var backup = SqlFunctions.getBackupRun(GetBackupRunArgs.builder()
            .instance(main.name())
            .mostRecent(true)
            .build());
    }
}
variables:
  backup:
    fn::invoke:
      function: gcp:sql:getBackupRun
      arguments:
        instance: ${main.name}
        mostRecent: true
Using getBackupRun
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getBackupRun(args: GetBackupRunArgs, opts?: InvokeOptions): Promise<GetBackupRunResult>
function getBackupRunOutput(args: GetBackupRunOutputArgs, opts?: InvokeOptions): Output<GetBackupRunResult>def get_backup_run(backup_id: Optional[int] = None,
                   instance: Optional[str] = None,
                   most_recent: Optional[bool] = None,
                   project: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetBackupRunResult
def get_backup_run_output(backup_id: Optional[pulumi.Input[int]] = None,
                   instance: Optional[pulumi.Input[str]] = None,
                   most_recent: Optional[pulumi.Input[bool]] = None,
                   project: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetBackupRunResult]func GetBackupRun(ctx *Context, args *GetBackupRunArgs, opts ...InvokeOption) (*GetBackupRunResult, error)
func GetBackupRunOutput(ctx *Context, args *GetBackupRunOutputArgs, opts ...InvokeOption) GetBackupRunResultOutput> Note: This function is named GetBackupRun in the Go SDK.
public static class GetBackupRun 
{
    public static Task<GetBackupRunResult> InvokeAsync(GetBackupRunArgs args, InvokeOptions? opts = null)
    public static Output<GetBackupRunResult> Invoke(GetBackupRunInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetBackupRunResult> getBackupRun(GetBackupRunArgs args, InvokeOptions options)
public static Output<GetBackupRunResult> getBackupRun(GetBackupRunArgs args, InvokeOptions options)
fn::invoke:
  function: gcp:sql/getBackupRun:getBackupRun
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Instance string
 - The name of the instance the backup is taken from.
 - Backup
Id int - The identifier for this backup run. Unique only for a specific Cloud SQL instance.
If left empty and multiple backups exist for the instance, 
most_recentmust be set totrue. - Most
Recent bool - Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
 - Project string
 - The project to list instances for. If it is not provided, the provider project is used.
 
- Instance string
 - The name of the instance the backup is taken from.
 - Backup
Id int - The identifier for this backup run. Unique only for a specific Cloud SQL instance.
If left empty and multiple backups exist for the instance, 
most_recentmust be set totrue. - Most
Recent bool - Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
 - Project string
 - The project to list instances for. If it is not provided, the provider project is used.
 
- instance String
 - The name of the instance the backup is taken from.
 - backup
Id Integer - The identifier for this backup run. Unique only for a specific Cloud SQL instance.
If left empty and multiple backups exist for the instance, 
most_recentmust be set totrue. - most
Recent Boolean - Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
 - project String
 - The project to list instances for. If it is not provided, the provider project is used.
 
- instance string
 - The name of the instance the backup is taken from.
 - backup
Id number - The identifier for this backup run. Unique only for a specific Cloud SQL instance.
If left empty and multiple backups exist for the instance, 
most_recentmust be set totrue. - most
Recent boolean - Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
 - project string
 - The project to list instances for. If it is not provided, the provider project is used.
 
- instance str
 - The name of the instance the backup is taken from.
 - backup_
id int - The identifier for this backup run. Unique only for a specific Cloud SQL instance.
If left empty and multiple backups exist for the instance, 
most_recentmust be set totrue. - most_
recent bool - Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
 - project str
 - The project to list instances for. If it is not provided, the provider project is used.
 
- instance String
 - The name of the instance the backup is taken from.
 - backup
Id Number - The identifier for this backup run. Unique only for a specific Cloud SQL instance.
If left empty and multiple backups exist for the instance, 
most_recentmust be set totrue. - most
Recent Boolean - Toggles use of the most recent backup run if multiple backups exist for a Cloud SQL instance.
 - project String
 - The project to list instances for. If it is not provided, the provider project is used.
 
getBackupRun Result
The following output properties are available:
- Backup
Id int - Id string
 - The provider-assigned unique ID for this managed resource.
 - Instance string
 - Location string
 - Location of the backups.
 - Project string
 - Start
Time string - The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
 - Status string
 - The status of this run. Refer to API reference for possible status values.
 - Most
Recent bool 
- Backup
Id int - Id string
 - The provider-assigned unique ID for this managed resource.
 - Instance string
 - Location string
 - Location of the backups.
 - Project string
 - Start
Time string - The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
 - Status string
 - The status of this run. Refer to API reference for possible status values.
 - Most
Recent bool 
- backup
Id Integer - id String
 - The provider-assigned unique ID for this managed resource.
 - instance String
 - location String
 - Location of the backups.
 - project String
 - start
Time String - The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
 - status String
 - The status of this run. Refer to API reference for possible status values.
 - most
Recent Boolean 
- backup
Id number - id string
 - The provider-assigned unique ID for this managed resource.
 - instance string
 - location string
 - Location of the backups.
 - project string
 - start
Time string - The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
 - status string
 - The status of this run. Refer to API reference for possible status values.
 - most
Recent boolean 
- backup_
id int - id str
 - The provider-assigned unique ID for this managed resource.
 - instance str
 - location str
 - Location of the backups.
 - project str
 - start_
time str - The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
 - status str
 - The status of this run. Refer to API reference for possible status values.
 - most_
recent bool 
- backup
Id Number - id String
 - The provider-assigned unique ID for this managed resource.
 - instance String
 - location String
 - Location of the backups.
 - project String
 - start
Time String - The time the backup operation actually started in UTC timezone in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
 - status String
 - The status of this run. Refer to API reference for possible status values.
 - most
Recent Boolean 
Package Details
- Repository
 - Google Cloud (GCP) Classic pulumi/pulumi-gcp
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
google-betaTerraform Provider.