Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

getFastlyIpRanges

Use this data source to get the IP ranges of Fastly edge nodes.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;
using Fastly = Pulumi.Fastly;

class MyStack : Stack
{
    public MyStack()
    {
        var fastly = Output.Create(Fastly.GetFastlyIpRanges.InvokeAsync());
        var fromFastly = new Aws.Ec2.SecurityGroup("fromFastly", new Aws.Ec2.SecurityGroupArgs
        {
            Ingress = 
            {
                new Aws.Ec2.Inputs.SecurityGroupIngressArgs
                {
                    FromPort = 443,
                    ToPort = 443,
                    Protocol = "tcp",
                    CidrBlocks = fastly.Apply(fastly => fastly.CidrBlocks),
                    Ipv6CidrBlocks = fastly.Apply(fastly => fastly.Ipv6CidrBlocks),
                },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/ec2"
    "github.com/pulumi/pulumi-fastly/sdk/v2/go/fastly"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        fastly, err := fastly.GetFastlyIpRanges(ctx, nil, nil)
        if err != nil {
            return err
        }
        _, err = ec2.NewSecurityGroup(ctx, "fromFastly", &ec2.SecurityGroupArgs{
            Ingress: ec2.SecurityGroupIngressArray{
                &ec2.SecurityGroupIngressArgs{
                    FromPort:       pulumi.Int(443),
                    ToPort:         pulumi.Int(443),
                    Protocol:       pulumi.String("tcp"),
                    CidrBlocks:     toPulumiStringArray(fastly.CidrBlocks),
                    Ipv6CidrBlocks: toPulumiStringArray(fastly.Ipv6CidrBlocks),
                },
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
func toPulumiStringArray(arr []string) pulumi.StringArray {
    var pulumiArr pulumi.StringArray
    for _, v := range arr {
        pulumiArr = append(pulumiArr, pulumi.String(v))
    }
    return pulumiArr
}
import pulumi
import pulumi_aws as aws
import pulumi_fastly as fastly

fastly = fastly.get_fastly_ip_ranges()
from_fastly = aws.ec2.SecurityGroup("fromFastly", ingress=[aws.ec2.SecurityGroupIngressArgs(
    from_port="443",
    to_port="443",
    protocol="tcp",
    cidr_blocks=fastly.cidr_blocks,
    ipv6_cidr_blocks=fastly.ipv6_cidr_blocks,
)])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as fastly from "@pulumi/fastly";

const fastly = fastly.getFastlyIpRanges({});
const fromFastly = new aws.ec2.SecurityGroup("fromFastly", {ingress: [{
    fromPort: "443",
    toPort: "443",
    protocol: "tcp",
    cidrBlocks: fastly.then(fastly => fastly.cidrBlocks),
    ipv6CidrBlocks: fastly.then(fastly => fastly.ipv6CidrBlocks),
}]});

Using getFastlyIpRanges

function getFastlyIpRanges(opts?: InvokeOptions): Promise<GetFastlyIpRangesResult>
def get_fastly_ip_ranges(opts: Optional[InvokeOptions] = None) -> GetFastlyIpRangesResult
func GetFastlyIpRanges(ctx *Context, opts ...InvokeOption) (*GetFastlyIpRangesResult, error)

Note: This function is named GetFastlyIpRanges in the Go SDK.

public static class GetFastlyIpRanges {
    public static Task<GetFastlyIpRangesResult> InvokeAsync(InvokeOptions? opts = null)
}

getFastlyIpRanges Result

The following output properties are available:

CidrBlocks List<string>

The lexically ordered list of ipv4 CIDR blocks.

Id string

The provider-assigned unique ID for this managed resource.

Ipv6CidrBlocks List<string>

The lexically ordered list of ipv6 CIDR blocks.

CidrBlocks []string

The lexically ordered list of ipv4 CIDR blocks.

Id string

The provider-assigned unique ID for this managed resource.

Ipv6CidrBlocks []string

The lexically ordered list of ipv6 CIDR blocks.

cidrBlocks string[]

The lexically ordered list of ipv4 CIDR blocks.

id string

The provider-assigned unique ID for this managed resource.

ipv6CidrBlocks string[]

The lexically ordered list of ipv6 CIDR blocks.

cidr_blocks Sequence[str]

The lexically ordered list of ipv4 CIDR blocks.

id str

The provider-assigned unique ID for this managed resource.

ipv6_cidr_blocks Sequence[str]

The lexically ordered list of ipv6 CIDR blocks.

Package Details

Repository
https://github.com/pulumi/pulumi-fastly
License
Apache-2.0
Notes
This Pulumi package is based on the fastly Terraform Provider.