Google Cloud (GCP) Classic
getDisk
Get information about a Google Compute Persistent disks.
the official documentation and its API.
Example Usage
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var persistent_boot_disk = Output.Create(Gcp.Compute.GetDisk.InvokeAsync(new Gcp.Compute.GetDiskArgs
{
Name = "persistent-boot-disk",
Project = "example",
}));
// ...
var @default = new Gcp.Compute.Instance("default", new Gcp.Compute.InstanceArgs
{
BootDisk = new Gcp.Compute.Inputs.InstanceBootDiskArgs
{
Source = persistent_boot_disk.Apply(persistent_boot_disk => persistent_boot_disk.SelfLink),
AutoDelete = false,
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
persistent_boot_disk, err := compute.LookupDisk(ctx, &compute.LookupDiskArgs{
Name: "persistent-boot-disk",
Project: pulumi.StringRef("example"),
}, nil)
if err != nil {
return err
}
_, err = compute.NewInstance(ctx, "default", &compute.InstanceArgs{
BootDisk: &compute.InstanceBootDiskArgs{
Source: pulumi.String(persistent_boot_disk.SelfLink),
AutoDelete: pulumi.Bool(false),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var persistent-boot-disk = Output.of(ComputeFunctions.getDisk(GetDiskArgs.builder()
.name("persistent-boot-disk")
.project("example")
.build()));
var default_ = new Instance("default", InstanceArgs.builder()
.bootDisk(InstanceBootDisk.builder()
.source(persistent_boot_disk.getSelfLink())
.autoDelete(false)
.build())
.build());
}
}
import pulumi
import pulumi_gcp as gcp
persistent_boot_disk = gcp.compute.get_disk(name="persistent-boot-disk",
project="example")
# ...
default = gcp.compute.Instance("default", boot_disk=gcp.compute.InstanceBootDiskArgs(
source=persistent_boot_disk.self_link,
auto_delete=False,
))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const persistent-boot-disk = gcp.compute.getDisk({
name: "persistent-boot-disk",
project: "example",
});
// ...
const _default = new gcp.compute.Instance("default", {bootDisk: {
source: persistent_boot_disk.then(persistent_boot_disk => persistent_boot_disk.selfLink),
autoDelete: false,
}});
resources:
default:
type: gcp:compute:Instance
properties:
bootDisk:
source: ${["persistent-boot-disk"].selfLink}
autoDelete: false
variables:
persistent-boot-disk:
Fn::Invoke:
Function: gcp:compute:getDisk
Arguments:
name: persistent-boot-disk
project: example
Using getDisk
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 getDisk(args: GetDiskArgs, opts?: InvokeOptions): Promise<GetDiskResult>
function getDiskOutput(args: GetDiskOutputArgs, opts?: InvokeOptions): Output<GetDiskResult>
def get_disk(name: Optional[str] = None,
project: Optional[str] = None,
zone: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetDiskResult
def get_disk_output(name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
zone: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetDiskResult]
func LookupDisk(ctx *Context, args *LookupDiskArgs, opts ...InvokeOption) (*LookupDiskResult, error)
func LookupDiskOutput(ctx *Context, args *LookupDiskOutputArgs, opts ...InvokeOption) LookupDiskResultOutput
> Note: This function is named LookupDisk
in the Go SDK.
public static class GetDisk
{
public static Task<GetDiskResult> InvokeAsync(GetDiskArgs args, InvokeOptions? opts = null)
public static Output<GetDiskResult> Invoke(GetDiskInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDiskResult> getDisk(GetDiskArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
Function: gcp:compute/getDisk:getDisk
Arguments:
# Arguments dictionary
The following arguments are supported:
getDisk Result
The following output properties are available:
- Creation
Timestamp string - Description string
- Disk
Encryption List<GetKeys Disk Disk Encryption Key> - Id string
The provider-assigned unique ID for this managed resource.
- Image string
- Interface string
- Label
Fingerprint string - Labels Dictionary<string, string>
A map of labels applied to this disk.
- Last
Attach stringTimestamp - Last
Detach stringTimestamp - Multi
Writer bool - Name string
- Physical
Block intSize Bytes - Provisioned
Iops int - Resource
Policies List<string> - Self
Link string The URI of the created resource.
- Size int
- Snapshot string
- Source
Image List<GetEncryption Keys Disk Source Image Encryption Key> - Source
Image stringId - Source
Snapshot List<GetEncryption Keys Disk Source Snapshot Encryption Key> - Source
Snapshot stringId - Type string
- Users List<string>
- Project string
- Zone string
- Creation
Timestamp string - Description string
- Disk
Encryption []GetKeys Disk Disk Encryption Key - Id string
The provider-assigned unique ID for this managed resource.
- Image string
- Interface string
- Label
Fingerprint string - Labels map[string]string
A map of labels applied to this disk.
- Last
Attach stringTimestamp - Last
Detach stringTimestamp - Multi
Writer bool - Name string
- Physical
Block intSize Bytes - Provisioned
Iops int - Resource
Policies []string - Self
Link string The URI of the created resource.
- Size int
- Snapshot string
- Source
Image []GetEncryption Keys Disk Source Image Encryption Key - Source
Image stringId - Source
Snapshot []GetEncryption Keys Disk Source Snapshot Encryption Key - Source
Snapshot stringId - Type string
- Users []string
- Project string
- Zone string
- creation
Timestamp String - description String
- disk
Encryption ListKeys Disk Disk Encryption Key> - id String
The provider-assigned unique ID for this managed resource.
- image String
- interface_ String
- label
Fingerprint String - labels
Map
A map of labels applied to this disk.
- last
Attach StringTimestamp - last
Detach StringTimestamp - multi
Writer Boolean - name String
- physical
Block IntegerSize Bytes - provisioned
Iops Integer - resource
Policies List - self
Link String The URI of the created resource.
- size Integer
- snapshot String
- source
Image ListEncryption Keys Disk Source Image Encryption Key> - source
Image StringId - source
Snapshot ListEncryption Keys Disk Source Snapshot Encryption Key> - source
Snapshot StringId - type String
- users
List
- project String
- zone String
- creation
Timestamp string - description string
- disk
Encryption GetKeys Disk Disk Encryption Key[] - id string
The provider-assigned unique ID for this managed resource.
- image string
- interface string
- label
Fingerprint string - labels {[key: string]: string}
A map of labels applied to this disk.
- last
Attach stringTimestamp - last
Detach stringTimestamp - multi
Writer boolean - name string
- physical
Block numberSize Bytes - provisioned
Iops number - resource
Policies string[] - self
Link string The URI of the created resource.
- size number
- snapshot string
- source
Image GetEncryption Keys Disk Source Image Encryption Key[] - source
Image stringId - source
Snapshot GetEncryption Keys Disk Source Snapshot Encryption Key[] - source
Snapshot stringId - type string
- users string[]
- project string
- zone string
- creation_
timestamp str - description str
- disk_
encryption_ Sequence[Getkeys Disk Disk Encryption Key] - id str
The provider-assigned unique ID for this managed resource.
- image str
- interface str
- label_
fingerprint str - labels Mapping[str, str]
A map of labels applied to this disk.
- last_
attach_ strtimestamp - last_
detach_ strtimestamp - multi_
writer bool - name str
- physical_
block_ intsize_ bytes - provisioned_
iops int - resource_
policies Sequence[str] - self_
link str The URI of the created resource.
- size int
- snapshot str
- source_
image_ Sequence[Getencryption_ keys Disk Source Image Encryption Key] - source_
image_ strid - source_
snapshot_ Sequence[Getencryption_ keys Disk Source Snapshot Encryption Key] - source_
snapshot_ strid - type str
- users Sequence[str]
- project str
- zone str
- creation
Timestamp String - description String
- disk
Encryption ListKeys - id String
The provider-assigned unique ID for this managed resource.
- image String
- interface String
- label
Fingerprint String - labels
Map
A map of labels applied to this disk.
- last
Attach StringTimestamp - last
Detach StringTimestamp - multi
Writer Boolean - name String
- physical
Block NumberSize Bytes - provisioned
Iops Number - resource
Policies List - self
Link String The URI of the created resource.
- size Number
- snapshot String
- source
Image ListEncryption Keys - source
Image StringId - source
Snapshot ListEncryption Keys - source
Snapshot StringId - type String
- users
List
- project String
- zone String
Supporting Types
GetDiskDiskEncryptionKey
- Kms
Key stringSelf Link - Kms
Key stringService Account - Raw
Key string - Sha256 string
- Kms
Key stringSelf Link - Kms
Key stringService Account - Raw
Key string - Sha256 string
- kms
Key StringSelf Link - kms
Key StringService Account - raw
Key String - sha256 String
- kms
Key stringSelf Link - kms
Key stringService Account - raw
Key string - sha256 string
- kms_
key_ strself_ link - kms_
key_ strservice_ account - raw_
key str - sha256 str
- kms
Key StringSelf Link - kms
Key StringService Account - raw
Key String - sha256 String
GetDiskSourceImageEncryptionKey
- Kms
Key stringSelf Link - Kms
Key stringService Account - Raw
Key string - Sha256 string
- Kms
Key stringSelf Link - Kms
Key stringService Account - Raw
Key string - Sha256 string
- kms
Key StringSelf Link - kms
Key StringService Account - raw
Key String - sha256 String
- kms
Key stringSelf Link - kms
Key stringService Account - raw
Key string - sha256 string
- kms_
key_ strself_ link - kms_
key_ strservice_ account - raw_
key str - sha256 str
- kms
Key StringSelf Link - kms
Key StringService Account - raw
Key String - sha256 String
GetDiskSourceSnapshotEncryptionKey
- Kms
Key stringSelf Link - Kms
Key stringService Account - Raw
Key string - Sha256 string
- Kms
Key stringSelf Link - Kms
Key stringService Account - Raw
Key string - Sha256 string
- kms
Key StringSelf Link - kms
Key StringService Account - raw
Key String - sha256 String
- kms
Key stringSelf Link - kms
Key stringService Account - raw
Key string - sha256 string
- kms_
key_ strself_ link - kms_
key_ strservice_ account - raw_
key str - sha256 str
- kms
Key StringSelf Link - kms
Key StringService Account - raw
Key String - sha256 String
Package Details
- Repository
- https://github.com/pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
google-beta
Terraform Provider.