GoogleComputeBackendBucket class final

Factory wrapper for google_compute_backend_bucket (provider hashicorp/google ~> 7.0).

A global backend bucket — the load-balancing target that points an HTTPS load balancer at a Google Cloud Storage bucket of static objects. Use this when the load balancer needs to serve static content (images, JS/CSS bundles, downloadable assets) directly out of GCS without routing through a VM or serverless backend. Pair it with a URL map (a google_compute_url_map path_matcher typically has the form default_service = backendService and path_rule = backendBucket for a /static/* prefix).

Required identity:

  • localName: Terraform local name (the address segment after google_compute_backend_bucket.).
  • name: GCP resource name (1-63 chars, lowercase RFC1035).
  • bucket_name: the name of an existing Cloud Storage bucket (e.g. 'my-static-assets'). This is the bucket name only — not a gs:// URI and not the bucket's self-link. The bucket must exist in the same project and be readable by the load balancer's service identity (allUsers-readable for public CDN serving, or granted via the Cloud CDN signed-URL key for private content).

Cross-resource references:

  • edgeSecurityPolicy is the self-link of a google_compute_security_policy of type CLOUD_ARMOR_EDGE (distinct from a regular Cloud Armor policy — edge policies attach at the load balancer's edge, ahead of the cache). Use var.security_policy_id in real configs: edgeSecurityPolicy: TfArg.literal('projects/p/global/securityPolicies/edge-deny-all').
  • The compositional inverse is at a URL map: a google_compute_url_map.path_rule.service references this bucket's selfLink.

Example (CDN-fronted static assets with custom cache headers):

final assets = GoogleComputeBackendBucket(
  localName: 'static_assets',
  name: TfArg.literal('static-assets'),
  bucketName: TfArg.literal('my-static-assets'),
  enableCdn: TfArg.literal(true),
  cdnPolicy: const ComputeBackendBucketBackendBucketCdnPolicy(
    cacheMode: BackendBucketCacheMode.cacheAllStatic,
    defaultTtl: 3600,
    maxTtl: 86400,
    clientTtl: 3600,
    negativeCaching: true,
    negativeCachingPolicy: [
      ComputeBackendBucketBackendBucketCdnNegativeCachingPolicy(code: 404, ttl: 120),
      ComputeBackendBucketBackendBucketCdnNegativeCachingPolicy(code: 410, ttl: 120),
    ],
    serveWhileStale: 60,
  ),
  customResponseHeaders: TfArg.literal([
    'X-Cache: \$(cache_status)',
  ]),
  compressionMode:
      TfArg.literal(BackendBucketCompressionMode.automatic),
);

Example (private bucket fronted by Cloud Armor edge policy):

final secured = GoogleComputeBackendBucket(
  localName: 'secured_assets',
  name: TfArg.literal('secured-assets'),
  bucketName: TfArg.literal('private-static-assets'),
  enableCdn: TfArg.literal(true),
  edgeSecurityPolicy: TfArg.literal(
    // var.security_policy_id — a CLOUD_ARMOR_EDGE-typed
    // google_compute_security_policy self-link.
    'projects/p/global/securityPolicies/edge-rate-limit',
  ),
);

Nested-type prefix: every helper class for a cdn_policy sub-block is BackendBucket-prefixed (e.g. ComputeBackendBucketBackendBucketCdnPolicy, ComputeBackendBucketBackendBucketCdnCacheKeyPolicy, ComputeBackendBucketBackendBucketCdnNegativeCachingPolicy, ComputeBackendBucketBackendBucketCdnBypassCacheOnRequestHeader). The shape mirrors the BackendService* family but is a distinct type — the bucket and service CDN configurations are not interchangeable, even where the schema field names agree.

Composition pattern: extends Resource<$GoogleComputeBackendBucket> for runtime behavior.

Constructors

GoogleComputeBackendBucket({required String localName, required TfArg<String> name, required TfArg<String> bucketName, TfArg<String>? description, TfArg<bool>? enableCdn, TfArg<BackendBucketCompressionMode>? compressionMode, TfArg<List<String>>? customResponseHeaders, TfArg<String>? edgeSecurityPolicy, TfArg<BackendBucketLoadBalancingScheme>? loadBalancingScheme, ComputeBackendBucketBackendBucketCdnPolicy? cdnPolicy, ComputeBackendBucketBackendBucketParams? params, TfArg<String>? project, LifecycleOptions? lifecycle, List<DependencyTarget>? dependsOn})

Properties

$sensitiveFields Set<String>
Field names that are @Sensitive per the IR-derived per-resource constant. Curated factories override with a baked-in static const Set<String> (file-private in v0.5+).
no setter
$supportsDeletionProtection bool
Capability flag: true when this resource's underlying Terraform schema has a deletion_protection boolean attribute that the synth-time devMode flow can flip to false. Defaults to false; the codegen emitter overrides this to true for wrappers whose schema includes the attribute.
no setterinherited
argMap Map<String, TfArg?>
Argument-name → TfArg map. Keys are snake_case (Terraform JSON name). Synth emits these keys directly; the factory is responsible for the camelCase → snake_case translation at construction time.
finalinherited
creationTimestamp → TfRef<String>
Reference to creation_timestamp (RFC3339).
no setter
dependsOn List<DependencyTarget>?
Optional depends_on = [...]. Each entry is a DependencyTarget — either a wholesale resource (rendered as bare address) or an explicit TfRef (rendered via bareAddress).
finalinherited
hashCode int
The hash code for this object.
no setterinherited
id → TfRef<String>
Reference to id attribute (full path projects/{project}/global/backendBuckets/{name}).
no setter
kind → ResourceKind
Always ResourceKind.resource. Overridden by Data.
no setterinherited
lifecycle → LifecycleOptions?
Optional lifecycle { ... } block.
finalinherited
localName String
User-supplied local name within a Stack.
finalinherited
nameRef → TfRef<String>
Reference to name attribute.
no setter
provider → ProviderBinding?
Optional explicit provider binding. Only the type is referenced here; the concrete Provider class lives in terradart_google (provider classes are defined per-provider, outside the core runtime).
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
Reference to self_link attribute (HTTPS API path). The canonical reference a downstream google_compute_url_map uses to bind a path rule to this bucket.
no setter
terraformType String
Terraform resource type, e.g. google_pubsub_topic.
finalinherited
tfAddress String
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

$tfType → const String