GoogleComputeForwardingRule class final
Factory wrapper for google_compute_forwarding_rule.
A ForwardingRule resource. A ForwardingRule resource specifies which pool of
target virtual machines to forward a packet to if it matches the given
IPAddress, IPProtocol, portRange tuple.
The entry point ("frontend") of a GCP regional load balancer. A
regional forwarding rule binds a VIP + port range (or port list) to
either a regional target proxy (HTTP / HTTPS / TCP / SSL) for L7 /
proxy-based balancing, or to a region_backend_service for L4
passthrough balancing.
The typical Regional Internal Application LB (L7 ILB) chain looks like:
google_compute_forwarding_rule (this resource)
→ google_compute_region_target_https_proxy
→ google_compute_region_url_map
→ google_compute_region_backend_service
The L4 Internal Network LB chain instead routes traffic directly:
google_compute_forwarding_rule
→ google_compute_region_backend_service (via backendService)
Required identity:
localName: Terraform local name (the address segment aftergoogle_compute_forwarding_rule.).name: GCP forwarding rule resource name. 1-63 chars, RFC1035.
Strongly recommended:
region: GCP region the rule lives in. Schema marks the fieldOptional + Computed(provider falls back to the provider's default region), but production callers almost always pin it explicitly so the chain composes deterministically with sibling regional targets, subnetworks, and backend services.targetorbackendService(exactly one):target: self-link of an upstream regional target proxy. Required for proxy / Application Load Balancers. Typical L7 callers passTfArg.ref(regionTargetHttpsProxy.selfLink).backendService: self-link of a regional backend service. Required for Internal TCP/UDP Load Balancing and Network Load Balancing; must be omitted for all other LB types. Wave 6 focuses on the L7 path, so the dominant production pattern istarget-only.
loadBalancingScheme: the dominant production setting for Regional Internal Application Load Balancers is ForwardingRuleLoadBalancingScheme.internalManaged. The legacyEXTERNALvalue (default when unset) targets the older Regional external passthrough / proxy NLB family.INTERNALis the L4 ILB passthrough scheme.EXTERNAL_MANAGEDis the modern Regional external Application Load Balancer.ipAddress: self-link or literal IP of a reserved GoogleComputeAddress (the regional sibling of GoogleComputeGlobalAddress). When omitted GCP allocates an ephemeral IP — surprising in CI, set explicitly for stable VIPs.portRange: a single port (e.g.'443') or a range (e.g.'80-443'). Required for proxy / Application LBs.
For Internal forwarding rules (loadBalancingScheme: INTERNAL or
INTERNAL_MANAGED):
network: self-link of the VPC the rule's VIP belongs to.subnetwork: self-link of the subnet the VIP is allocated from. Both are required by the API for internal schemes; the schema marks themOptional + Computedonly because external rules omit them.
Mutual exclusivity:
targetvsbackendService: exactly one. Setting both is rejected at apply time.portRange,ports,allPorts: pairwise mutually exclusive. Pick one. Application LBs useportRange. L4 internal passthrough LBs typically useports(a discrete list, up to 5) orallPorts.
networkTier accepts both PREMIUM and STANDARD for regional
rules (unlike global rules, which only accept PREMIUM). When
ipAddress is set, the network tier must match the address's tier.
Leave null for the provider default (PREMIUM).
ipAddressRef is the output reference to ip_address — populated
with the actual VIP after apply. Useful when ipAddress was left
unset and GCP allocated an ephemeral IP, or when downstream DNS
records need the resolved address. (ip_address is
optional + computed; the derive gate skips it, so ipAddressRef
is the sole reference accessor.)
pscConnectionId is populated only for Private Service Connect
consumer forwarding rules; empty otherwise. pscConnectionStatus
values: STATUS_UNSPECIFIED / PENDING / ACCEPTED / REJECTED /
CLOSED. baseForwardingRule is set when this rule has
source_ip_ranges and shares an [ip, protocol, port] tuple with a
sibling rule without source ranges. serviceName is the internal
fully qualified service name; populated only for INTERNAL load
balancing rules that set serviceLabel.
Example (Regional Internal Application LB frontend):
final ilbFwd = GoogleComputeForwardingRule(
localName: 'ilb',
name: TfArg.literal('ilb-https-frontend'),
region: TfArg.literal('us-central1'),
target: TfArg.ref(regionTargetHttpsProxy.selfLink),
network: TfArg.ref(vpc.selfLink),
subnetwork: TfArg.ref(ilbSubnet.selfLink),
ipAddress: TfArg.ref(ilbVip.selfLink),
ipProtocol: TfArg.literal(ForwardingRuleIpProtocol.tcp),
portRange: TfArg.literal('443'),
loadBalancingScheme:
TfArg.literal(ForwardingRuleLoadBalancingScheme.internalManaged),
);
Composition pattern: extends Resource
for runtime behavior.
Constructors
-
GoogleComputeForwardingRule({required String localName, required TfArg<
String> name, TfArg<String> ? region, TfArg<String> ? target, TfArg<String> ? backendService, TfArg<String> ? ipAddress, TfArg<ForwardingRuleIpProtocol> ? ipProtocol, TfArg<ForwardingRuleIpVersion> ? ipVersion, TfArg<String> ? portRange, TfArg<List< ? ports, TfArg<String> >bool> ? allPorts, TfArg<ForwardingRuleLoadBalancingScheme> ? loadBalancingScheme, TfArg<String> ? network, TfArg<String> ? subnetwork, TfArg<ForwardingRuleNetworkTier> ? networkTier, TfArg<List< ? sourceIpRanges, TfArg<String> >String> ? serviceLabel, List<ComputeForwardingRuleForwardingRuleServiceDirectoryRegistration> ? serviceDirectoryRegistrations, TfArg<bool> ? allowGlobalAccess, TfArg<bool> ? allowPscGlobalAccess, TfArg<bool> ? isMirroringCollector, TfArg<bool> ? noAutomateDnsZone, TfArg<bool> ? recreateClosedPsc, TfArg<String> ? ipCollection, TfArg<Map< ? labels, TfArg<String, String> >String> ? description, TfArg<String> ? project, LifecycleOptions? lifecycle, List<DependencyTarget> ? dependsOn, String? provider, TfTimeouts? timeouts})
Properties
-
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
-
baseForwardingRule
→ TfRef<
String> -
Reference to
base_forwarding_ruleattribute.no setter -
creationTimestamp
→ TfRef<
String> -
Reference to
creation_timestampattribute.no setter -
dependsOn
→ List<
DependencyTarget> ? -
Optional
depends_on = [...]. Each entry is aDependencyTarget— either a wholesale resource (rendered as bare address) or an explicitTfRef(rendered viabareAddress).finalinherited -
effectiveLabels
→ TfRef<
Map< String, String> > -
Reference to
effective_labelsattribute.no setter -
forwardingRuleId
→ TfRef<
num> -
Reference to
forwarding_rule_idattribute.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
→ TfRef<
String> -
Reference to
idattribute.no setter -
ipAddressRef
→ TfRef<
String> -
Reference to
ip_address— populated with the actual VIP after apply. (ip_addressisoptional + computed; the derive gate skips it, so this is the sole reference accessor.)no setter - kind → ResourceKind
-
Always
ResourceKind.resource. Overridden byData.no setterinherited -
labelFingerprint
→ TfRef<
String> -
Reference to
label_fingerprintattribute.no setter - lifecycle → LifecycleOptions?
-
Optional
lifecycle { ... }block.finalinherited - localName → String
-
User-supplied local name within a Stack.
finalinherited
-
nameRef
→ TfRef<
String> -
Reference to
nameattribute.no setter - provider → String?
-
Optional Terraform
providermeta-argument: a provider name ('google-beta'on a GA type) or aname.aliaspair ('google.eu').finalinherited -
pscConnectionId
→ TfRef<
String> -
Reference to
psc_connection_idattribute.no setter -
pscConnectionStatus
→ TfRef<
String> -
Reference to
psc_connection_statusattribute.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selfLink
→ TfRef<
String> -
Reference to
self_linkattribute.no setter -
sensitiveFields
→ Set<
String> -
Field names that are
@Sensitiveper the IR-derived per-resource constant. Curated factories override with a baked-instatic const Set<String>(file-private in v0.5+).no setter -
serviceName
→ TfRef<
String> -
Reference to
service_nameattribute.no setter - supportsDeletionProtection → bool
-
Capability flag: true when this resource's underlying Terraform
schema has a
deletion_protectionboolean attribute that the synth-time devMode flow can flip tofalse. Defaults to false; the codegen emitter overrides this totruefor wrappers whose schema includes the attribute.no setterinherited -
terraformLabels
→ TfRef<
Map< String, String> > -
Reference to
terraform_labelsattribute.no setter - terraformType → String
-
Terraform resource type, e.g.
google_pubsub_topic.finalinherited - tfAddress → String
-
no setterinherited
- timeouts → TfTimeouts?
-
Optional
timeouts { ... }block: how long Terraform waits for each operation. Provider-neutral likelifecycle— synth copies the duration strings verbatim, andterraform validatedecides whether this resource's schema declares the operations set here.finalinherited
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