get Netblock IPRanges
Use this data source to get the IP addresses from different special IP ranges on Google Cloud Platform.
Example Usage
Cloud Ranges
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetNetblockIPRangesArgs;
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 netblock = ComputeFunctions.getNetblockIPRanges();
ctx.export("cidrBlocks", netblock.applyValue(getNetblockIPRangesResult -> getNetblockIPRangesResult.cidrBlocks()));
ctx.export("cidrBlocksIpv4", netblock.applyValue(getNetblockIPRangesResult -> getNetblockIPRangesResult.cidrBlocksIpv4s()));
ctx.export("cidrBlocksIpv6", netblock.applyValue(getNetblockIPRangesResult -> getNetblockIPRangesResult.cidrBlocksIpv6s()));
}
}
Allow Health Checks
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetNetblockIPRangesArgs;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.Firewall;
import com.pulumi.gcp.compute.FirewallArgs;
import com.pulumi.gcp.compute.inputs.FirewallAllowArgs;
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 legacy-hcs = ComputeFunctions.getNetblockIPRanges(GetNetblockIPRangesArgs.builder()
.rangeType("legacy-health-checkers")
.build());
var default_ = new Network("default");
var allow_hcs = new Firewall("allow-hcs", FirewallArgs.builder()
.network(default_.name())
.allows(FirewallAllowArgs.builder()
.protocol("tcp")
.ports("80")
.build())
.sourceRanges(legacy_hcs.cidrBlocksIpv4s())
.build());
}
}
Return
A collection of values returned by getNetblockIPRanges.
Parameters
A collection of arguments for invoking getNetblockIPRanges.
Return
A collection of values returned by getNetblockIPRanges.
Parameters
The type of range for which to provide results. Defaults to cloud-netblocks
. The following range_type
s 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.
See also
Return
A collection of values returned by getNetblockIPRanges.
Parameters
Builder for com.pulumi.gcp.compute.kotlin.inputs.GetNetblockIPRangesPlainArgs.