published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
Use this data source to get the IP addresses from different special IP ranges on Google Cloud Platform.
Example Usage
Cloud Ranges
data "google_netblock_ip_ranges" "netblock" {
}
output "cidr_blocks" {
value = data.google_netblock_ip_ranges.netblock.cidr_blocks
}
output "cidr_blocks_ipv4" {
value = data.google_netblock_ip_ranges.netblock.cidr_blocks_ipv4
}
output "cidr_blocks_ipv6" {
value = data.google_netblock_ip_ranges.netblock.cidr_blocks_ipv6
}
Allow Health Checks
data "google_netblock_ip_ranges" "legacy-hcs" {
range_type = "legacy-health-checkers"
}
resource "google_compute_firewall" "allow-hcs" {
name = "allow-hcs"
network = google_compute_network.default.name
allow {
protocol = "tcp"
ports = ["80"]
}
source_ranges = data.google_netblock_ip_ranges.legacy-hcs.cidr_blocks_ipv4
}
resource "google_compute_network" "default" {
name = "test-network"
}
Using getNetblockIPRanges
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 getNetblockIPRanges(args: GetNetblockIPRangesArgs, opts?: InvokeOptions): Promise<GetNetblockIPRangesResult>
function getNetblockIPRangesOutput(args: GetNetblockIPRangesOutputArgs, opts?: InvokeOptions): Output<GetNetblockIPRangesResult>def get_netblock_ip_ranges(range_type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetNetblockIPRangesResult
def get_netblock_ip_ranges_output(range_type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetNetblockIPRangesResult]func GetNetblockIPRanges(ctx *Context, args *GetNetblockIPRangesArgs, opts ...InvokeOption) (*GetNetblockIPRangesResult, error)
func GetNetblockIPRangesOutput(ctx *Context, args *GetNetblockIPRangesOutputArgs, opts ...InvokeOption) GetNetblockIPRangesResultOutput> Note: This function is named GetNetblockIPRanges in the Go SDK.
public static class GetNetblockIPRanges
{
public static Task<GetNetblockIPRangesResult> InvokeAsync(GetNetblockIPRangesArgs args, InvokeOptions? opts = null)
public static Output<GetNetblockIPRangesResult> Invoke(GetNetblockIPRangesInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetNetblockIPRangesResult> getNetblockIPRanges(GetNetblockIPRangesArgs args, InvokeOptions options)
public static Output<GetNetblockIPRangesResult> getNetblockIPRanges(GetNetblockIPRangesArgs args, InvokeOptions options)
fn::invoke:
function: gcp:compute/getNetblockIPRanges:getNetblockIPRanges
arguments:
# arguments dictionaryThe following arguments are supported:
- Range
Type string The type of range for which to provide results.
Defaults to
cloud-netblocks. The followingrange_types are supported:cloud-netblocks- Corresponds to the IP addresses used for resources on Google Cloud Platform. More details.google-netblocks- Corresponds to IP addresses used for Google services. More details.restricted-googleapis- Corresponds to the IP addresses used for Private Google Access only for services that support VPC Service Controls API access. More details.private-googleapis- Corresponds to the IP addresses used for Private Google Access for services that do not support VPC Service Controls. More details.dns-forwarders- Corresponds to the IP addresses used to originate Cloud DNS outbound forwarding. More details.iap-forwarders- Corresponds to the IP addresses used for Cloud IAP for TCP forwarding. More details.health-checkers- Corresponds to the IP addresses used for health checking in Cloud Load Balancing. More details.legacy-health-checkers- Corresponds to the IP addresses used for legacy style health checkers (used by Network Load Balancing). More details.
- Range
Type string The type of range for which to provide results.
Defaults to
cloud-netblocks. The followingrange_types are supported:cloud-netblocks- Corresponds to the IP addresses used for resources on Google Cloud Platform. More details.google-netblocks- Corresponds to IP addresses used for Google services. More details.restricted-googleapis- Corresponds to the IP addresses used for Private Google Access only for services that support VPC Service Controls API access. More details.private-googleapis- Corresponds to the IP addresses used for Private Google Access for services that do not support VPC Service Controls. More details.dns-forwarders- Corresponds to the IP addresses used to originate Cloud DNS outbound forwarding. More details.iap-forwarders- Corresponds to the IP addresses used for Cloud IAP for TCP forwarding. More details.health-checkers- Corresponds to the IP addresses used for health checking in Cloud Load Balancing. More details.legacy-health-checkers- Corresponds to the IP addresses used for legacy style health checkers (used by Network Load Balancing). More details.
- range
Type String The type of range for which to provide results.
Defaults to
cloud-netblocks. The followingrange_types are supported:cloud-netblocks- Corresponds to the IP addresses used for resources on Google Cloud Platform. More details.google-netblocks- Corresponds to IP addresses used for Google services. More details.restricted-googleapis- Corresponds to the IP addresses used for Private Google Access only for services that support VPC Service Controls API access. More details.private-googleapis- Corresponds to the IP addresses used for Private Google Access for services that do not support VPC Service Controls. More details.dns-forwarders- Corresponds to the IP addresses used to originate Cloud DNS outbound forwarding. More details.iap-forwarders- Corresponds to the IP addresses used for Cloud IAP for TCP forwarding. More details.health-checkers- Corresponds to the IP addresses used for health checking in Cloud Load Balancing. More details.legacy-health-checkers- Corresponds to the IP addresses used for legacy style health checkers (used by Network Load Balancing). More details.
- range
Type string The type of range for which to provide results.
Defaults to
cloud-netblocks. The followingrange_types are supported:cloud-netblocks- Corresponds to the IP addresses used for resources on Google Cloud Platform. More details.google-netblocks- Corresponds to IP addresses used for Google services. More details.restricted-googleapis- Corresponds to the IP addresses used for Private Google Access only for services that support VPC Service Controls API access. More details.private-googleapis- Corresponds to the IP addresses used for Private Google Access for services that do not support VPC Service Controls. More details.dns-forwarders- Corresponds to the IP addresses used to originate Cloud DNS outbound forwarding. More details.iap-forwarders- Corresponds to the IP addresses used for Cloud IAP for TCP forwarding. More details.health-checkers- Corresponds to the IP addresses used for health checking in Cloud Load Balancing. More details.legacy-health-checkers- Corresponds to the IP addresses used for legacy style health checkers (used by Network Load Balancing). More details.
- range_
type str The type of range for which to provide results.
Defaults to
cloud-netblocks. The followingrange_types are supported:cloud-netblocks- Corresponds to the IP addresses used for resources on Google Cloud Platform. More details.google-netblocks- Corresponds to IP addresses used for Google services. More details.restricted-googleapis- Corresponds to the IP addresses used for Private Google Access only for services that support VPC Service Controls API access. More details.private-googleapis- Corresponds to the IP addresses used for Private Google Access for services that do not support VPC Service Controls. More details.dns-forwarders- Corresponds to the IP addresses used to originate Cloud DNS outbound forwarding. More details.iap-forwarders- Corresponds to the IP addresses used for Cloud IAP for TCP forwarding. More details.health-checkers- Corresponds to the IP addresses used for health checking in Cloud Load Balancing. More details.legacy-health-checkers- Corresponds to the IP addresses used for legacy style health checkers (used by Network Load Balancing). More details.
- range
Type String The type of range for which to provide results.
Defaults to
cloud-netblocks. The followingrange_types are supported:cloud-netblocks- Corresponds to the IP addresses used for resources on Google Cloud Platform. More details.google-netblocks- Corresponds to IP addresses used for Google services. More details.restricted-googleapis- Corresponds to the IP addresses used for Private Google Access only for services that support VPC Service Controls API access. More details.private-googleapis- Corresponds to the IP addresses used for Private Google Access for services that do not support VPC Service Controls. More details.dns-forwarders- Corresponds to the IP addresses used to originate Cloud DNS outbound forwarding. More details.iap-forwarders- Corresponds to the IP addresses used for Cloud IAP for TCP forwarding. More details.health-checkers- Corresponds to the IP addresses used for health checking in Cloud Load Balancing. More details.legacy-health-checkers- Corresponds to the IP addresses used for legacy style health checkers (used by Network Load Balancing). More details.
getNetblockIPRanges Result
The following output properties are available:
- Cidr
Blocks List<string> - Retrieve list of all CIDR blocks.
- Cidr
Blocks List<string>Ipv4s - Retrieve list of the IPv4 CIDR blocks
- Cidr
Blocks List<string>Ipv6s - Retrieve list of the IPv6 CIDR blocks, if available.
- Id string
- The provider-assigned unique ID for this managed resource.
- Range
Type string
- Cidr
Blocks []string - Retrieve list of all CIDR blocks.
- Cidr
Blocks []stringIpv4s - Retrieve list of the IPv4 CIDR blocks
- Cidr
Blocks []stringIpv6s - Retrieve list of the IPv6 CIDR blocks, if available.
- Id string
- The provider-assigned unique ID for this managed resource.
- Range
Type string
- cidr
Blocks List<String> - Retrieve list of all CIDR blocks.
- cidr
Blocks List<String>Ipv4s - Retrieve list of the IPv4 CIDR blocks
- cidr
Blocks List<String>Ipv6s - Retrieve list of the IPv6 CIDR blocks, if available.
- id String
- The provider-assigned unique ID for this managed resource.
- range
Type String
- cidr
Blocks string[] - Retrieve list of all CIDR blocks.
- cidr
Blocks string[]Ipv4s - Retrieve list of the IPv4 CIDR blocks
- cidr
Blocks string[]Ipv6s - Retrieve list of the IPv6 CIDR blocks, if available.
- id string
- The provider-assigned unique ID for this managed resource.
- range
Type string
- cidr_
blocks Sequence[str] - Retrieve list of all CIDR blocks.
- cidr_
blocks_ Sequence[str]ipv4s - Retrieve list of the IPv4 CIDR blocks
- cidr_
blocks_ Sequence[str]ipv6s - Retrieve list of the IPv6 CIDR blocks, if available.
- id str
- The provider-assigned unique ID for this managed resource.
- range_
type str
- cidr
Blocks List<String> - Retrieve list of all CIDR blocks.
- cidr
Blocks List<String>Ipv4s - Retrieve list of the IPv4 CIDR blocks
- cidr
Blocks List<String>Ipv6s - Retrieve list of the IPv6 CIDR blocks, if available.
- id String
- The provider-assigned unique ID for this managed resource.
- range
Type String
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.
published on Monday, Mar 9, 2026 by Pulumi