1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. SnapshotSettings
Google Cloud v8.34.0 published on Wednesday, Jun 11, 2025 by Pulumi

gcp.compute.SnapshotSettings

Explore with Pulumi AI

gcp logo
Google Cloud v8.34.0 published on Wednesday, Jun 11, 2025 by Pulumi

    Updates your project’s snapshot settings and sets a new default storage location for snapshots.

    To get more information about SnapshotSettings, see:

    Example Usage

    Snapshot Settings Specific Locations

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const tf_test_snapshot_settings = new gcp.compute.SnapshotSettings("tf-test-snapshot-settings", {storageLocation: {
        policy: "SPECIFIC_LOCATIONS",
        locations: [{
            name: "us-central1",
            location: "us-central1",
        }],
    }});
    
    import pulumi
    import pulumi_gcp as gcp
    
    tf_test_snapshot_settings = gcp.compute.SnapshotSettings("tf-test-snapshot-settings", storage_location={
        "policy": "SPECIFIC_LOCATIONS",
        "locations": [{
            "name": "us-central1",
            "location": "us-central1",
        }],
    })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewSnapshotSettings(ctx, "tf-test-snapshot-settings", &compute.SnapshotSettingsArgs{
    			StorageLocation: &compute.SnapshotSettingsStorageLocationArgs{
    				Policy: pulumi.String("SPECIFIC_LOCATIONS"),
    				Locations: compute.SnapshotSettingsStorageLocationLocationArray{
    					&compute.SnapshotSettingsStorageLocationLocationArgs{
    						Name:     pulumi.String("us-central1"),
    						Location: pulumi.String("us-central1"),
    					},
    				},
    			},
    		})
    		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 tf_test_snapshot_settings = new Gcp.Compute.SnapshotSettings("tf-test-snapshot-settings", new()
        {
            StorageLocation = new Gcp.Compute.Inputs.SnapshotSettingsStorageLocationArgs
            {
                Policy = "SPECIFIC_LOCATIONS",
                Locations = new[]
                {
                    new Gcp.Compute.Inputs.SnapshotSettingsStorageLocationLocationArgs
                    {
                        Name = "us-central1",
                        Location = "us-central1",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.SnapshotSettings;
    import com.pulumi.gcp.compute.SnapshotSettingsArgs;
    import com.pulumi.gcp.compute.inputs.SnapshotSettingsStorageLocationArgs;
    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 tf_test_snapshot_settings = new SnapshotSettings("tf-test-snapshot-settings", SnapshotSettingsArgs.builder()
                .storageLocation(SnapshotSettingsStorageLocationArgs.builder()
                    .policy("SPECIFIC_LOCATIONS")
                    .locations(SnapshotSettingsStorageLocationLocationArgs.builder()
                        .name("us-central1")
                        .location("us-central1")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      tf-test-snapshot-settings:
        type: gcp:compute:SnapshotSettings
        properties:
          storageLocation:
            policy: SPECIFIC_LOCATIONS
            locations:
              - name: us-central1
                location: us-central1
    

    Create SnapshotSettings Resource

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

    Constructor syntax

    new SnapshotSettings(name: string, args: SnapshotSettingsArgs, opts?: CustomResourceOptions);
    @overload
    def SnapshotSettings(resource_name: str,
                         args: SnapshotSettingsArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def SnapshotSettings(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         storage_location: Optional[SnapshotSettingsStorageLocationArgs] = None,
                         project: Optional[str] = None)
    func NewSnapshotSettings(ctx *Context, name string, args SnapshotSettingsArgs, opts ...ResourceOption) (*SnapshotSettings, error)
    public SnapshotSettings(string name, SnapshotSettingsArgs args, CustomResourceOptions? opts = null)
    public SnapshotSettings(String name, SnapshotSettingsArgs args)
    public SnapshotSettings(String name, SnapshotSettingsArgs args, CustomResourceOptions options)
    
    type: gcp:compute:SnapshotSettings
    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 SnapshotSettingsArgs
    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 SnapshotSettingsArgs
    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 SnapshotSettingsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SnapshotSettingsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SnapshotSettingsArgs
    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 snapshotSettingsResource = new Gcp.Compute.SnapshotSettings("snapshotSettingsResource", new()
    {
        StorageLocation = new Gcp.Compute.Inputs.SnapshotSettingsStorageLocationArgs
        {
            Policy = "string",
            Locations = new[]
            {
                new Gcp.Compute.Inputs.SnapshotSettingsStorageLocationLocationArgs
                {
                    Location = "string",
                    Name = "string",
                },
            },
        },
        Project = "string",
    });
    
    example, err := compute.NewSnapshotSettings(ctx, "snapshotSettingsResource", &compute.SnapshotSettingsArgs{
    	StorageLocation: &compute.SnapshotSettingsStorageLocationArgs{
    		Policy: pulumi.String("string"),
    		Locations: compute.SnapshotSettingsStorageLocationLocationArray{
    			&compute.SnapshotSettingsStorageLocationLocationArgs{
    				Location: pulumi.String("string"),
    				Name:     pulumi.String("string"),
    			},
    		},
    	},
    	Project: pulumi.String("string"),
    })
    
    var snapshotSettingsResource = new SnapshotSettings("snapshotSettingsResource", SnapshotSettingsArgs.builder()
        .storageLocation(SnapshotSettingsStorageLocationArgs.builder()
            .policy("string")
            .locations(SnapshotSettingsStorageLocationLocationArgs.builder()
                .location("string")
                .name("string")
                .build())
            .build())
        .project("string")
        .build());
    
    snapshot_settings_resource = gcp.compute.SnapshotSettings("snapshotSettingsResource",
        storage_location={
            "policy": "string",
            "locations": [{
                "location": "string",
                "name": "string",
            }],
        },
        project="string")
    
    const snapshotSettingsResource = new gcp.compute.SnapshotSettings("snapshotSettingsResource", {
        storageLocation: {
            policy: "string",
            locations: [{
                location: "string",
                name: "string",
            }],
        },
        project: "string",
    });
    
    type: gcp:compute:SnapshotSettings
    properties:
        project: string
        storageLocation:
            locations:
                - location: string
                  name: string
            policy: string
    

    SnapshotSettings 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 SnapshotSettings resource accepts the following input properties:

    StorageLocation SnapshotSettingsStorageLocation
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    Project string
    StorageLocation SnapshotSettingsStorageLocationArgs
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    Project string
    storageLocation SnapshotSettingsStorageLocation
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project String
    storageLocation SnapshotSettingsStorageLocation
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project string
    storage_location SnapshotSettingsStorageLocationArgs
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project str
    storageLocation Property Map
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SnapshotSettings 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 SnapshotSettings Resource

    Get an existing SnapshotSettings 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?: SnapshotSettingsState, opts?: CustomResourceOptions): SnapshotSettings
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            project: Optional[str] = None,
            storage_location: Optional[SnapshotSettingsStorageLocationArgs] = None) -> SnapshotSettings
    func GetSnapshotSettings(ctx *Context, name string, id IDInput, state *SnapshotSettingsState, opts ...ResourceOption) (*SnapshotSettings, error)
    public static SnapshotSettings Get(string name, Input<string> id, SnapshotSettingsState? state, CustomResourceOptions? opts = null)
    public static SnapshotSettings get(String name, Output<String> id, SnapshotSettingsState state, CustomResourceOptions options)
    resources:  _:    type: gcp:compute:SnapshotSettings    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:
    Project string
    StorageLocation SnapshotSettingsStorageLocation
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    Project string
    StorageLocation SnapshotSettingsStorageLocationArgs
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project String
    storageLocation SnapshotSettingsStorageLocation
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project string
    storageLocation SnapshotSettingsStorageLocation
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project str
    storage_location SnapshotSettingsStorageLocationArgs
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.
    project String
    storageLocation Property Map
    Policy of which storage location is going to be resolved, and additional data that particularizes how the policy is going to be carried out Structure is documented below.

    Supporting Types

    SnapshotSettingsStorageLocation, SnapshotSettingsStorageLocationArgs

    Policy string
    The chosen location policy Possible values are: NEAREST_MULTI_REGION, LOCAL_REGION, SPECIFIC_LOCATIONS.
    Locations List<SnapshotSettingsStorageLocationLocation>
    When the policy is SPECIFIC_LOCATIONS, snapshots will be stored in the locations listed in this field. Keys are Cloud Storage bucket locations. Only one location can be specified. Structure is documented below.
    Policy string
    The chosen location policy Possible values are: NEAREST_MULTI_REGION, LOCAL_REGION, SPECIFIC_LOCATIONS.
    Locations []SnapshotSettingsStorageLocationLocation
    When the policy is SPECIFIC_LOCATIONS, snapshots will be stored in the locations listed in this field. Keys are Cloud Storage bucket locations. Only one location can be specified. Structure is documented below.
    policy String
    The chosen location policy Possible values are: NEAREST_MULTI_REGION, LOCAL_REGION, SPECIFIC_LOCATIONS.
    locations List<SnapshotSettingsStorageLocationLocation>
    When the policy is SPECIFIC_LOCATIONS, snapshots will be stored in the locations listed in this field. Keys are Cloud Storage bucket locations. Only one location can be specified. Structure is documented below.
    policy string
    The chosen location policy Possible values are: NEAREST_MULTI_REGION, LOCAL_REGION, SPECIFIC_LOCATIONS.
    locations SnapshotSettingsStorageLocationLocation[]
    When the policy is SPECIFIC_LOCATIONS, snapshots will be stored in the locations listed in this field. Keys are Cloud Storage bucket locations. Only one location can be specified. Structure is documented below.
    policy str
    The chosen location policy Possible values are: NEAREST_MULTI_REGION, LOCAL_REGION, SPECIFIC_LOCATIONS.
    locations Sequence[SnapshotSettingsStorageLocationLocation]
    When the policy is SPECIFIC_LOCATIONS, snapshots will be stored in the locations listed in this field. Keys are Cloud Storage bucket locations. Only one location can be specified. Structure is documented below.
    policy String
    The chosen location policy Possible values are: NEAREST_MULTI_REGION, LOCAL_REGION, SPECIFIC_LOCATIONS.
    locations List<Property Map>
    When the policy is SPECIFIC_LOCATIONS, snapshots will be stored in the locations listed in this field. Keys are Cloud Storage bucket locations. Only one location can be specified. Structure is documented below.

    SnapshotSettingsStorageLocationLocation, SnapshotSettingsStorageLocationLocationArgs

    Location string
    The identifier for this object. Format specified above.
    Name string
    Name of the location. It should be one of the Cloud Storage buckets. Only one location can be specified. (should match location)


    Location string
    The identifier for this object. Format specified above.
    Name string
    Name of the location. It should be one of the Cloud Storage buckets. Only one location can be specified. (should match location)


    location String
    The identifier for this object. Format specified above.
    name String
    Name of the location. It should be one of the Cloud Storage buckets. Only one location can be specified. (should match location)


    location string
    The identifier for this object. Format specified above.
    name string
    Name of the location. It should be one of the Cloud Storage buckets. Only one location can be specified. (should match location)


    location str
    The identifier for this object. Format specified above.
    name str
    Name of the location. It should be one of the Cloud Storage buckets. Only one location can be specified. (should match location)


    location String
    The identifier for this object. Format specified above.
    name String
    Name of the location. It should be one of the Cloud Storage buckets. Only one location can be specified. (should match location)


    Import

    SnapshotSettings can be imported using any of these accepted formats:

    • projects/{{project}}/global/snapshotSettings/

    • {{project}}

    When using the pulumi import command, SnapshotSettings can be imported using one of the formats above. For example:

    $ pulumi import gcp:compute/snapshotSettings:SnapshotSettings default projects/{{project}}/global/snapshotSettings/
    
    $ pulumi import gcp:compute/snapshotSettings:SnapshotSettings default {{project}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    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
    Google Cloud v8.34.0 published on Wednesday, Jun 11, 2025 by Pulumi