Google Cloud v9.4.0 published on Tuesday, Nov 4, 2025 by Pulumi
gcp.storage.getBucketObjectContent
Start a Neo task
Explain and create a gcp.storage.getBucketObjectContent resource
Gets an existing object content inside an existing bucket in Google Cloud Storage service (GCS). See the official documentation and API.
Warning: The object content will be saved in the state, and visible to everyone who has access to the state file.
Example Usage
Example file object stored within a folder.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const key = gcp.storage.getBucketObjectContent({
name: "encryptedkey",
bucket: "keystore",
});
export const encrypted = key.then(key => key.content);
import pulumi
import pulumi_gcp as gcp
key = gcp.storage.get_bucket_object_content(name="encryptedkey",
bucket="keystore")
pulumi.export("encrypted", key.content)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
key, err := storage.GetBucketObjectContent(ctx, &storage.GetBucketObjectContentArgs{
Name: "encryptedkey",
Bucket: "keystore",
}, nil)
if err != nil {
return err
}
ctx.Export("encrypted", key.Content)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var key = Gcp.Storage.GetBucketObjectContent.Invoke(new()
{
Name = "encryptedkey",
Bucket = "keystore",
});
return new Dictionary<string, object?>
{
["encrypted"] = key.Apply(getBucketObjectContentResult => getBucketObjectContentResult.Content),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.StorageFunctions;
import com.pulumi.gcp.storage.inputs.GetBucketObjectContentArgs;
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 key = StorageFunctions.getBucketObjectContent(GetBucketObjectContentArgs.builder()
.name("encryptedkey")
.bucket("keystore")
.build());
ctx.export("encrypted", key.content());
}
}
variables:
key:
fn::invoke:
function: gcp:storage:getBucketObjectContent
arguments:
name: encryptedkey
bucket: keystore
outputs:
encrypted: ${key.content}
Using getBucketObjectContent
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 getBucketObjectContent(args: GetBucketObjectContentArgs, opts?: InvokeOptions): Promise<GetBucketObjectContentResult>
function getBucketObjectContentOutput(args: GetBucketObjectContentOutputArgs, opts?: InvokeOptions): Output<GetBucketObjectContentResult>def get_bucket_object_content(bucket: Optional[str] = None,
content: Optional[str] = None,
name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetBucketObjectContentResult
def get_bucket_object_content_output(bucket: Optional[pulumi.Input[str]] = None,
content: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetBucketObjectContentResult]func GetBucketObjectContent(ctx *Context, args *GetBucketObjectContentArgs, opts ...InvokeOption) (*GetBucketObjectContentResult, error)
func GetBucketObjectContentOutput(ctx *Context, args *GetBucketObjectContentOutputArgs, opts ...InvokeOption) GetBucketObjectContentResultOutput> Note: This function is named GetBucketObjectContent in the Go SDK.
public static class GetBucketObjectContent
{
public static Task<GetBucketObjectContentResult> InvokeAsync(GetBucketObjectContentArgs args, InvokeOptions? opts = null)
public static Output<GetBucketObjectContentResult> Invoke(GetBucketObjectContentInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetBucketObjectContentResult> getBucketObjectContent(GetBucketObjectContentArgs args, InvokeOptions options)
public static Output<GetBucketObjectContentResult> getBucketObjectContent(GetBucketObjectContentArgs args, InvokeOptions options)
fn::invoke:
function: gcp:storage/getBucketObjectContent:getBucketObjectContent
arguments:
# arguments dictionaryThe following arguments are supported:
getBucketObjectContent Result
The following output properties are available:
- Bucket string
- Cache
Control string - Content string
- (Computed) The content of the object.
- Content
Base64 string - (Computed) Base64 encoded version of the object content. Use this when dealing with binary data.
- Content
Base64sha512 string - (Computed) Base64 encoded SHA512 checksum of file content.
- Content
Disposition string - Content
Encoding string - Content
Hexsha512 string - (Computed) Hex encoded SHA512 checksum of file content.
- Content
Language string - Content
Type string - Crc32c string
- Customer
Encryptions List<GetBucket Object Content Customer Encryption> - Deletion
Policy string - Detect
Md5hash string - Event
Based boolHold - Force
Empty boolContent Type - Generation int
- Id string
- The provider-assigned unique ID for this managed resource.
- Kms
Key stringName - Md5hash string
- Md5hexhash string
- Media
Link string - Metadata Dictionary<string, string>
- Name string
- Output
Name string - Retentions
List<Get
Bucket Object Content Retention> - Self
Link string - Source string
- Source
Md5hash string - Storage
Class string - Temporary
Hold bool
- Bucket string
- Cache
Control string - Content string
- (Computed) The content of the object.
- Content
Base64 string - (Computed) Base64 encoded version of the object content. Use this when dealing with binary data.
- Content
Base64sha512 string - (Computed) Base64 encoded SHA512 checksum of file content.
- Content
Disposition string - Content
Encoding string - Content
Hexsha512 string - (Computed) Hex encoded SHA512 checksum of file content.
- Content
Language string - Content
Type string - Crc32c string
- Customer
Encryptions []GetBucket Object Content Customer Encryption - Deletion
Policy string - Detect
Md5hash string - Event
Based boolHold - Force
Empty boolContent Type - Generation int
- Id string
- The provider-assigned unique ID for this managed resource.
- Kms
Key stringName - Md5hash string
- Md5hexhash string
- Media
Link string - Metadata map[string]string
- Name string
- Output
Name string - Retentions
[]Get
Bucket Object Content Retention - Self
Link string - Source string
- Source
Md5hash string - Storage
Class string - Temporary
Hold bool
- bucket String
- cache
Control String - content String
- (Computed) The content of the object.
- content
Base64 String - (Computed) Base64 encoded version of the object content. Use this when dealing with binary data.
- content
Base64sha512 String - (Computed) Base64 encoded SHA512 checksum of file content.
- content
Disposition String - content
Encoding String - content
Hexsha512 String - (Computed) Hex encoded SHA512 checksum of file content.
- content
Language String - content
Type String - crc32c String
- customer
Encryptions List<GetBucket Object Content Customer Encryption> - deletion
Policy String - detect
Md5hash String - event
Based BooleanHold - force
Empty BooleanContent Type - generation Integer
- id String
- The provider-assigned unique ID for this managed resource.
- kms
Key StringName - md5hash String
- md5hexhash String
- media
Link String - metadata Map<String,String>
- name String
- output
Name String - retentions
List<Get
Bucket Object Content Retention> - self
Link String - source String
- source
Md5hash String - storage
Class String - temporary
Hold Boolean
- bucket string
- cache
Control string - content string
- (Computed) The content of the object.
- content
Base64 string - (Computed) Base64 encoded version of the object content. Use this when dealing with binary data.
- content
Base64sha512 string - (Computed) Base64 encoded SHA512 checksum of file content.
- content
Disposition string - content
Encoding string - content
Hexsha512 string - (Computed) Hex encoded SHA512 checksum of file content.
- content
Language string - content
Type string - crc32c string
- customer
Encryptions GetBucket Object Content Customer Encryption[] - deletion
Policy string - detect
Md5hash string - event
Based booleanHold - force
Empty booleanContent Type - generation number
- id string
- The provider-assigned unique ID for this managed resource.
- kms
Key stringName - md5hash string
- md5hexhash string
- media
Link string - metadata {[key: string]: string}
- name string
- output
Name string - retentions
Get
Bucket Object Content Retention[] - self
Link string - source string
- source
Md5hash string - storage
Class string - temporary
Hold boolean
- bucket str
- cache_
control str - content str
- (Computed) The content of the object.
- content_
base64 str - (Computed) Base64 encoded version of the object content. Use this when dealing with binary data.
- content_
base64sha512 str - (Computed) Base64 encoded SHA512 checksum of file content.
- content_
disposition str - content_
encoding str - content_
hexsha512 str - (Computed) Hex encoded SHA512 checksum of file content.
- content_
language str - content_
type str - crc32c str
- customer_
encryptions Sequence[GetBucket Object Content Customer Encryption] - deletion_
policy str - detect_
md5hash str - event_
based_ boolhold - force_
empty_ boolcontent_ type - generation int
- id str
- The provider-assigned unique ID for this managed resource.
- kms_
key_ strname - md5hash str
- md5hexhash str
- media_
link str - metadata Mapping[str, str]
- name str
- output_
name str - retentions
Sequence[Get
Bucket Object Content Retention] - self_
link str - source str
- source_
md5hash str - storage_
class str - temporary_
hold bool
- bucket String
- cache
Control String - content String
- (Computed) The content of the object.
- content
Base64 String - (Computed) Base64 encoded version of the object content. Use this when dealing with binary data.
- content
Base64sha512 String - (Computed) Base64 encoded SHA512 checksum of file content.
- content
Disposition String - content
Encoding String - content
Hexsha512 String - (Computed) Hex encoded SHA512 checksum of file content.
- content
Language String - content
Type String - crc32c String
- customer
Encryptions List<Property Map> - deletion
Policy String - detect
Md5hash String - event
Based BooleanHold - force
Empty BooleanContent Type - generation Number
- id String
- The provider-assigned unique ID for this managed resource.
- kms
Key StringName - md5hash String
- md5hexhash String
- media
Link String - metadata Map<String>
- name String
- output
Name String - retentions List<Property Map>
- self
Link String - source String
- source
Md5hash String - storage
Class String - temporary
Hold Boolean
Supporting Types
GetBucketObjectContentCustomerEncryption
- Encryption
Algorithm string - The encryption algorithm. Default: AES256
- Encryption
Key string - Base64 encoded customer supplied encryption key.
- Encryption
Algorithm string - The encryption algorithm. Default: AES256
- Encryption
Key string - Base64 encoded customer supplied encryption key.
- encryption
Algorithm String - The encryption algorithm. Default: AES256
- encryption
Key String - Base64 encoded customer supplied encryption key.
- encryption
Algorithm string - The encryption algorithm. Default: AES256
- encryption
Key string - Base64 encoded customer supplied encryption key.
- encryption_
algorithm str - The encryption algorithm. Default: AES256
- encryption_
key str - Base64 encoded customer supplied encryption key.
- encryption
Algorithm String - The encryption algorithm. Default: AES256
- encryption
Key String - Base64 encoded customer supplied encryption key.
GetBucketObjectContentRetention
- Mode string
- The object retention mode. Supported values include: "Unlocked", "Locked".
- Retain
Until stringTime - Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
- Mode string
- The object retention mode. Supported values include: "Unlocked", "Locked".
- Retain
Until stringTime - Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
- mode String
- The object retention mode. Supported values include: "Unlocked", "Locked".
- retain
Until StringTime - Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
- mode string
- The object retention mode. Supported values include: "Unlocked", "Locked".
- retain
Until stringTime - Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
- mode str
- The object retention mode. Supported values include: "Unlocked", "Locked".
- retain_
until_ strtime - Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
- mode String
- The object retention mode. Supported values include: "Unlocked", "Locked".
- retain
Until StringTime - Time in RFC 3339 (e.g. 2030-01-01T02:03:04Z) until which object retention protects this object.
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.
