getFastlyIpRanges

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

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;
using Fastly = Pulumi.Fastly;

return await Deployment.RunAsync(() => 
{
    var fastly = Fastly.GetFastlyIpRanges.Invoke();

    var fromFastly = new Aws.Ec2.SecurityGroup("fromFastly", new()
    {
        Ingress = new[]
        {
            new Aws.Ec2.Inputs.SecurityGroupIngressArgs
            {
                FromPort = 443,
                ToPort = 443,
                Protocol = "tcp",
                CidrBlocks = fastly.Apply(getFastlyIpRangesResult => getFastlyIpRangesResult.CidrBlocks),
                Ipv6CidrBlocks = fastly.Apply(getFastlyIpRangesResult => getFastlyIpRangesResult.Ipv6CidrBlocks),
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
	"github.com/pulumi/pulumi-fastly/sdk/v5/go/fastly"
	"github.com/pulumi/pulumi/sdk/v3/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:     interface{}(fastly.CidrBlocks),
					Ipv6CidrBlocks: interface{}(fastly.Ipv6CidrBlocks),
				},
			},
		})
		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.fastly.FastlyFunctions;
import com.pulumi.aws.ec2.SecurityGroup;
import com.pulumi.aws.ec2.SecurityGroupArgs;
import com.pulumi.aws.ec2.inputs.SecurityGroupIngressArgs;
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 fastly = FastlyFunctions.getFastlyIpRanges();

        var fromFastly = new SecurityGroup("fromFastly", SecurityGroupArgs.builder()        
            .ingress(SecurityGroupIngressArgs.builder()
                .fromPort("443")
                .toPort("443")
                .protocol("tcp")
                .cidrBlocks(fastly.applyValue(getFastlyIpRangesResult -> getFastlyIpRangesResult.cidrBlocks()))
                .ipv6CidrBlocks(fastly.applyValue(getFastlyIpRangesResult -> getFastlyIpRangesResult.ipv6CidrBlocks()))
                .build())
            .build());

    }
}
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),
}]});
resources:
  fromFastly:
    type: aws:ec2:SecurityGroup
    properties:
      ingress:
        - fromPort: 443
          toPort: 443
          protocol: tcp
          cidrBlocks: ${fastly.cidrBlocks}
          ipv6CidrBlocks: ${fastly.ipv6CidrBlocks}
variables:
  fastly:
    Fn::Invoke:
      Function: fastly:getFastlyIpRanges
      Arguments: {}

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)
}
public static CompletableFuture<GetFastlyIpRangesResult> getFastlyIpRanges(InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: fastly:index/getFastlyIpRanges:getFastlyIpRanges
  arguments:
    # arguments dictionary

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 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.

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.

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.

Package Details

Repository
https://github.com/pulumi/pulumi-fastly
License
Apache-2.0
Notes

This Pulumi package is based on the fastly Terraform Provider.