cloudflare.getIpRanges
Explore with Pulumi AI
Use this data source to get the IP ranges of Cloudflare network.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
using Example = Pulumi.Example;
return await Deployment.RunAsync(() =>
{
var cloudflare = Cloudflare.GetIpRanges.Invoke();
var example = new Example.Index.Example_firewall_resource("example", new()
{
Name = "from-cloudflare",
Network = "default",
SourceRanges = cloudflare.Apply(getIpRangesResult => getIpRangesResult.Ipv4CidrBlocks),
Allow = new[]
{
{
{ "ports", "443" },
{ "protocol", "tcp" },
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
"github.com/pulumi/pulumi-example/sdk/v1/go/example"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cloudflare, err := cloudflare.GetIpRanges(ctx, nil, nil)
if err != nil {
return err
}
_, err = index.NewExample_firewall_resource(ctx, "example", &index.Example_firewall_resourceArgs{
Name: "from-cloudflare",
Network: "default",
SourceRanges: cloudflare.Ipv4CidrBlocks,
Allow: []map[string]interface{}{
map[string]interface{}{
"ports": "443",
"protocol": "tcp",
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.CloudflareFunctions;
import com.pulumi.example.example_firewall_resource;
import com.pulumi.example.Example_firewall_resourceArgs;
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 cloudflare = CloudflareFunctions.getIpRanges();
var example = new Example_firewall_resource("example", Example_firewall_resourceArgs.builder()
.name("from-cloudflare")
.network("default")
.sourceRanges(cloudflare.applyValue(getIpRangesResult -> getIpRangesResult.ipv4CidrBlocks()))
.allow(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.build());
}
}
import pulumi
import pulumi_cloudflare as cloudflare
import pulumi_example as example
cloudflare = cloudflare.get_ip_ranges()
example = example.index.Example_firewall_resource("example",
name=from-cloudflare,
network=default,
source_ranges=cloudflare.ipv4_cidr_blocks,
allow=[{
ports: 443,
protocol: tcp,
}])
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
import * as example from "@pulumi/example";
const cloudflare = cloudflare.getIpRanges({});
const example = new example.index.Example_firewall_resource("example", {
name: "from-cloudflare",
network: "default",
sourceRanges: cloudflare.ipv4CidrBlocks,
allow: [{
ports: "443",
protocol: "tcp",
}],
});
resources:
example:
type: example:example_firewall_resource
properties:
name: from-cloudflare
network: default
sourceRanges: ${cloudflare.ipv4CidrBlocks}
allow:
- ports: '443'
protocol: tcp
variables:
cloudflare:
fn::invoke:
Function: cloudflare:getIpRanges
Arguments: {}
Using getIpRanges
function getIpRanges(opts?: InvokeOptions): Promise<GetIpRangesResult>
def get_ip_ranges(opts: Optional[InvokeOptions] = None) -> GetIpRangesResult
func GetIpRanges(ctx *Context, opts ...InvokeOption) (*GetIpRangesResult, error)
> Note: This function is named GetIpRanges
in the Go SDK.
public static class GetIpRanges
{
public static Task<GetIpRangesResult> InvokeAsync(InvokeOptions? opts = null)
}
public static CompletableFuture<GetIpRangesResult> getIpRanges(InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: cloudflare:index/getIpRanges:getIpRanges
arguments:
# arguments dictionary
getIpRanges Result
The following output properties are available:
- China
Ipv4Cidr List<string>Blocks The lexically ordered list of only the IPv4 China CIDR blocks.
- China
Ipv6Cidr List<string>Blocks The lexically ordered list of only the IPv6 China CIDR blocks.
- Cidr
Blocks List<string> The lexically ordered list of all non-China CIDR blocks.
- Id string
The provider-assigned unique ID for this managed resource.
- Ipv4Cidr
Blocks List<string> The lexically ordered list of only the IPv4 CIDR blocks.
- Ipv6Cidr
Blocks List<string> The lexically ordered list of only the IPv6 CIDR blocks.
- China
Ipv4Cidr []stringBlocks The lexically ordered list of only the IPv4 China CIDR blocks.
- China
Ipv6Cidr []stringBlocks The lexically ordered list of only the IPv6 China CIDR blocks.
- Cidr
Blocks []string The lexically ordered list of all non-China CIDR blocks.
- Id string
The provider-assigned unique ID for this managed resource.
- Ipv4Cidr
Blocks []string The lexically ordered list of only the IPv4 CIDR blocks.
- Ipv6Cidr
Blocks []string The lexically ordered list of only the IPv6 CIDR blocks.
- china
Ipv4Cidr List<String>Blocks The lexically ordered list of only the IPv4 China CIDR blocks.
- china
Ipv6Cidr List<String>Blocks The lexically ordered list of only the IPv6 China CIDR blocks.
- cidr
Blocks List<String> The lexically ordered list of all non-China CIDR blocks.
- id String
The provider-assigned unique ID for this managed resource.
- ipv4Cidr
Blocks List<String> The lexically ordered list of only the IPv4 CIDR blocks.
- ipv6Cidr
Blocks List<String> The lexically ordered list of only the IPv6 CIDR blocks.
- china
Ipv4Cidr string[]Blocks The lexically ordered list of only the IPv4 China CIDR blocks.
- china
Ipv6Cidr string[]Blocks The lexically ordered list of only the IPv6 China CIDR blocks.
- cidr
Blocks string[] The lexically ordered list of all non-China CIDR blocks.
- id string
The provider-assigned unique ID for this managed resource.
- ipv4Cidr
Blocks string[] The lexically ordered list of only the IPv4 CIDR blocks.
- ipv6Cidr
Blocks string[] The lexically ordered list of only the IPv6 CIDR blocks.
- china_
ipv4_ Sequence[str]cidr_ blocks The lexically ordered list of only the IPv4 China CIDR blocks.
- china_
ipv6_ Sequence[str]cidr_ blocks The lexically ordered list of only the IPv6 China CIDR blocks.
- cidr_
blocks Sequence[str] The lexically ordered list of all non-China CIDR blocks.
- id str
The provider-assigned unique ID for this managed resource.
- ipv4_
cidr_ Sequence[str]blocks The lexically ordered list of only the IPv4 CIDR blocks.
- ipv6_
cidr_ Sequence[str]blocks The lexically ordered list of only the IPv6 CIDR blocks.
- china
Ipv4Cidr List<String>Blocks The lexically ordered list of only the IPv4 China CIDR blocks.
- china
Ipv6Cidr List<String>Blocks The lexically ordered list of only the IPv6 China CIDR blocks.
- cidr
Blocks List<String> The lexically ordered list of all non-China CIDR blocks.
- id String
The provider-assigned unique ID for this managed resource.
- ipv4Cidr
Blocks List<String> The lexically ordered list of only the IPv4 CIDR blocks.
- ipv6Cidr
Blocks List<String> The lexically ordered list of only the IPv6 CIDR blocks.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
cloudflare
Terraform Provider.