1. Packages
  2. Scaleway
  3. API Docs
  4. VpcRoute
Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse

scaleway.VpcRoute

Explore with Pulumi AI

scaleway logo
Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse

    Creates and manages Scaleway VPC Routes. For more information, see the main documentation.

    Example Usage

    Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const vpc01 = new scaleway.Vpc("vpc01", {name: "tf-vpc-vpn"});
    const pn01 = new scaleway.VpcPrivateNetwork("pn01", {
        name: "tf-pn-vpn",
        ipv4Subnet: {
            subnet: "172.16.64.0/22",
        },
        vpcId: vpc01.id,
    });
    const server01 = new scaleway.InstanceServer("server01", {
        name: "tf-server-vpn",
        type: "PLAY2-MICRO",
        image: "openvpn",
    });
    const pnic01 = new scaleway.InstancePrivateNic("pnic01", {
        privateNetworkId: pn01.id,
        serverId: server01.id,
    });
    const rt01 = new scaleway.VpcRoute("rt01", {
        vpcId: vpc01.id,
        description: "tf-route-vpn",
        tags: [
            "tf",
            "route",
        ],
        destination: "10.0.0.0/24",
        nexthopResourceId: pnic01.id,
    });
    
    import pulumi
    import pulumiverse_scaleway as scaleway
    
    vpc01 = scaleway.Vpc("vpc01", name="tf-vpc-vpn")
    pn01 = scaleway.VpcPrivateNetwork("pn01",
        name="tf-pn-vpn",
        ipv4_subnet={
            "subnet": "172.16.64.0/22",
        },
        vpc_id=vpc01.id)
    server01 = scaleway.InstanceServer("server01",
        name="tf-server-vpn",
        type="PLAY2-MICRO",
        image="openvpn")
    pnic01 = scaleway.InstancePrivateNic("pnic01",
        private_network_id=pn01.id,
        server_id=server01.id)
    rt01 = scaleway.VpcRoute("rt01",
        vpc_id=vpc01.id,
        description="tf-route-vpn",
        tags=[
            "tf",
            "route",
        ],
        destination="10.0.0.0/24",
        nexthop_resource_id=pnic01.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		vpc01, err := scaleway.NewVpc(ctx, "vpc01", &scaleway.VpcArgs{
    			Name: pulumi.String("tf-vpc-vpn"),
    		})
    		if err != nil {
    			return err
    		}
    		pn01, err := scaleway.NewVpcPrivateNetwork(ctx, "pn01", &scaleway.VpcPrivateNetworkArgs{
    			Name: pulumi.String("tf-pn-vpn"),
    			Ipv4Subnet: &scaleway.VpcPrivateNetworkIpv4SubnetArgs{
    				Subnet: pulumi.String("172.16.64.0/22"),
    			},
    			VpcId: vpc01.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		server01, err := scaleway.NewInstanceServer(ctx, "server01", &scaleway.InstanceServerArgs{
    			Name:  pulumi.String("tf-server-vpn"),
    			Type:  pulumi.String("PLAY2-MICRO"),
    			Image: pulumi.String("openvpn"),
    		})
    		if err != nil {
    			return err
    		}
    		pnic01, err := scaleway.NewInstancePrivateNic(ctx, "pnic01", &scaleway.InstancePrivateNicArgs{
    			PrivateNetworkId: pn01.ID(),
    			ServerId:         server01.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = scaleway.NewVpcRoute(ctx, "rt01", &scaleway.VpcRouteArgs{
    			VpcId:       vpc01.ID(),
    			Description: pulumi.String("tf-route-vpn"),
    			Tags: pulumi.StringArray{
    				pulumi.String("tf"),
    				pulumi.String("route"),
    			},
    			Destination:       pulumi.String("10.0.0.0/24"),
    			NexthopResourceId: pnic01.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumiverse.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        var vpc01 = new Scaleway.Vpc("vpc01", new()
        {
            Name = "tf-vpc-vpn",
        });
    
        var pn01 = new Scaleway.VpcPrivateNetwork("pn01", new()
        {
            Name = "tf-pn-vpn",
            Ipv4Subnet = new Scaleway.Inputs.VpcPrivateNetworkIpv4SubnetArgs
            {
                Subnet = "172.16.64.0/22",
            },
            VpcId = vpc01.Id,
        });
    
        var server01 = new Scaleway.InstanceServer("server01", new()
        {
            Name = "tf-server-vpn",
            Type = "PLAY2-MICRO",
            Image = "openvpn",
        });
    
        var pnic01 = new Scaleway.InstancePrivateNic("pnic01", new()
        {
            PrivateNetworkId = pn01.Id,
            ServerId = server01.Id,
        });
    
        var rt01 = new Scaleway.VpcRoute("rt01", new()
        {
            VpcId = vpc01.Id,
            Description = "tf-route-vpn",
            Tags = new[]
            {
                "tf",
                "route",
            },
            Destination = "10.0.0.0/24",
            NexthopResourceId = pnic01.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.Vpc;
    import com.pulumi.scaleway.VpcArgs;
    import com.pulumi.scaleway.VpcPrivateNetwork;
    import com.pulumi.scaleway.VpcPrivateNetworkArgs;
    import com.pulumi.scaleway.inputs.VpcPrivateNetworkIpv4SubnetArgs;
    import com.pulumi.scaleway.InstanceServer;
    import com.pulumi.scaleway.InstanceServerArgs;
    import com.pulumi.scaleway.InstancePrivateNic;
    import com.pulumi.scaleway.InstancePrivateNicArgs;
    import com.pulumi.scaleway.VpcRoute;
    import com.pulumi.scaleway.VpcRouteArgs;
    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) {
            var vpc01 = new Vpc("vpc01", VpcArgs.builder()
                .name("tf-vpc-vpn")
                .build());
    
            var pn01 = new VpcPrivateNetwork("pn01", VpcPrivateNetworkArgs.builder()
                .name("tf-pn-vpn")
                .ipv4Subnet(VpcPrivateNetworkIpv4SubnetArgs.builder()
                    .subnet("172.16.64.0/22")
                    .build())
                .vpcId(vpc01.id())
                .build());
    
            var server01 = new InstanceServer("server01", InstanceServerArgs.builder()
                .name("tf-server-vpn")
                .type("PLAY2-MICRO")
                .image("openvpn")
                .build());
    
            var pnic01 = new InstancePrivateNic("pnic01", InstancePrivateNicArgs.builder()
                .privateNetworkId(pn01.id())
                .serverId(server01.id())
                .build());
    
            var rt01 = new VpcRoute("rt01", VpcRouteArgs.builder()
                .vpcId(vpc01.id())
                .description("tf-route-vpn")
                .tags(            
                    "tf",
                    "route")
                .destination("10.0.0.0/24")
                .nexthopResourceId(pnic01.id())
                .build());
    
        }
    }
    
    resources:
      vpc01:
        type: scaleway:Vpc
        properties:
          name: tf-vpc-vpn
      pn01:
        type: scaleway:VpcPrivateNetwork
        properties:
          name: tf-pn-vpn
          ipv4Subnet:
            subnet: 172.16.64.0/22
          vpcId: ${vpc01.id}
      server01:
        type: scaleway:InstanceServer
        properties:
          name: tf-server-vpn
          type: PLAY2-MICRO
          image: openvpn
      pnic01:
        type: scaleway:InstancePrivateNic
        properties:
          privateNetworkId: ${pn01.id}
          serverId: ${server01.id}
      rt01:
        type: scaleway:VpcRoute
        properties:
          vpcId: ${vpc01.id}
          description: tf-route-vpn
          tags:
            - tf
            - route
          destination: 10.0.0.0/24
          nexthopResourceId: ${pnic01.id}
    

    Create VpcRoute Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new VpcRoute(name: string, args: VpcRouteArgs, opts?: CustomResourceOptions);
    @overload
    def VpcRoute(resource_name: str,
                 args: VpcRouteArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def VpcRoute(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 vpc_id: Optional[str] = None,
                 description: Optional[str] = None,
                 destination: Optional[str] = None,
                 nexthop_private_network_id: Optional[str] = None,
                 nexthop_resource_id: Optional[str] = None,
                 region: Optional[str] = None,
                 tags: Optional[Sequence[str]] = None)
    func NewVpcRoute(ctx *Context, name string, args VpcRouteArgs, opts ...ResourceOption) (*VpcRoute, error)
    public VpcRoute(string name, VpcRouteArgs args, CustomResourceOptions? opts = null)
    public VpcRoute(String name, VpcRouteArgs args)
    public VpcRoute(String name, VpcRouteArgs args, CustomResourceOptions options)
    
    type: scaleway:VpcRoute
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args VpcRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args VpcRouteArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args VpcRouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VpcRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VpcRouteArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var vpcRouteResource = new Scaleway.VpcRoute("vpcRouteResource", new()
    {
        VpcId = "string",
        Description = "string",
        Destination = "string",
        NexthopPrivateNetworkId = "string",
        NexthopResourceId = "string",
        Region = "string",
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := scaleway.NewVpcRoute(ctx, "vpcRouteResource", &scaleway.VpcRouteArgs{
    	VpcId:                   pulumi.String("string"),
    	Description:             pulumi.String("string"),
    	Destination:             pulumi.String("string"),
    	NexthopPrivateNetworkId: pulumi.String("string"),
    	NexthopResourceId:       pulumi.String("string"),
    	Region:                  pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var vpcRouteResource = new VpcRoute("vpcRouteResource", VpcRouteArgs.builder()
        .vpcId("string")
        .description("string")
        .destination("string")
        .nexthopPrivateNetworkId("string")
        .nexthopResourceId("string")
        .region("string")
        .tags("string")
        .build());
    
    vpc_route_resource = scaleway.VpcRoute("vpcRouteResource",
        vpc_id="string",
        description="string",
        destination="string",
        nexthop_private_network_id="string",
        nexthop_resource_id="string",
        region="string",
        tags=["string"])
    
    const vpcRouteResource = new scaleway.VpcRoute("vpcRouteResource", {
        vpcId: "string",
        description: "string",
        destination: "string",
        nexthopPrivateNetworkId: "string",
        nexthopResourceId: "string",
        region: "string",
        tags: ["string"],
    });
    
    type: scaleway:VpcRoute
    properties:
        description: string
        destination: string
        nexthopPrivateNetworkId: string
        nexthopResourceId: string
        region: string
        tags:
            - string
        vpcId: string
    

    VpcRoute Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The VpcRoute resource accepts the following input properties:

    VpcId string
    The VPC ID the route belongs to.
    Description string
    The route description.
    Destination string
    The destination of the route.
    NexthopPrivateNetworkId string
    The ID of the nexthop private network.
    NexthopResourceId string
    The ID of the nexthop resource.
    Region string
    region) The region of the route.
    Tags List<string>
    The tags to associate with the route.
    VpcId string
    The VPC ID the route belongs to.
    Description string
    The route description.
    Destination string
    The destination of the route.
    NexthopPrivateNetworkId string
    The ID of the nexthop private network.
    NexthopResourceId string
    The ID of the nexthop resource.
    Region string
    region) The region of the route.
    Tags []string
    The tags to associate with the route.
    vpcId String
    The VPC ID the route belongs to.
    description String
    The route description.
    destination String
    The destination of the route.
    nexthopPrivateNetworkId String
    The ID of the nexthop private network.
    nexthopResourceId String
    The ID of the nexthop resource.
    region String
    region) The region of the route.
    tags List<String>
    The tags to associate with the route.
    vpcId string
    The VPC ID the route belongs to.
    description string
    The route description.
    destination string
    The destination of the route.
    nexthopPrivateNetworkId string
    The ID of the nexthop private network.
    nexthopResourceId string
    The ID of the nexthop resource.
    region string
    region) The region of the route.
    tags string[]
    The tags to associate with the route.
    vpc_id str
    The VPC ID the route belongs to.
    description str
    The route description.
    destination str
    The destination of the route.
    nexthop_private_network_id str
    The ID of the nexthop private network.
    nexthop_resource_id str
    The ID of the nexthop resource.
    region str
    region) The region of the route.
    tags Sequence[str]
    The tags to associate with the route.
    vpcId String
    The VPC ID the route belongs to.
    description String
    The route description.
    destination String
    The destination of the route.
    nexthopPrivateNetworkId String
    The ID of the nexthop private network.
    nexthopResourceId String
    The ID of the nexthop resource.
    region String
    region) The region of the route.
    tags List<String>
    The tags to associate with the route.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VpcRoute resource produces the following output properties:

    CreatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    CreatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    createdAt String
    The date and time of the creation of the route (RFC 3339 format).
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    The date and time of the creation of the route (RFC 3339 format).
    createdAt string
    The date and time of the creation of the route (RFC 3339 format).
    id string
    The provider-assigned unique ID for this managed resource.
    updatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    created_at str
    The date and time of the creation of the route (RFC 3339 format).
    id str
    The provider-assigned unique ID for this managed resource.
    updated_at str
    The date and time of the creation of the route (RFC 3339 format).
    createdAt String
    The date and time of the creation of the route (RFC 3339 format).
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    The date and time of the creation of the route (RFC 3339 format).

    Look up Existing VpcRoute Resource

    Get an existing VpcRoute resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: VpcRouteState, opts?: CustomResourceOptions): VpcRoute
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            description: Optional[str] = None,
            destination: Optional[str] = None,
            nexthop_private_network_id: Optional[str] = None,
            nexthop_resource_id: Optional[str] = None,
            region: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            updated_at: Optional[str] = None,
            vpc_id: Optional[str] = None) -> VpcRoute
    func GetVpcRoute(ctx *Context, name string, id IDInput, state *VpcRouteState, opts ...ResourceOption) (*VpcRoute, error)
    public static VpcRoute Get(string name, Input<string> id, VpcRouteState? state, CustomResourceOptions? opts = null)
    public static VpcRoute get(String name, Output<String> id, VpcRouteState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    Description string
    The route description.
    Destination string
    The destination of the route.
    NexthopPrivateNetworkId string
    The ID of the nexthop private network.
    NexthopResourceId string
    The ID of the nexthop resource.
    Region string
    region) The region of the route.
    Tags List<string>
    The tags to associate with the route.
    UpdatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    VpcId string
    The VPC ID the route belongs to.
    CreatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    Description string
    The route description.
    Destination string
    The destination of the route.
    NexthopPrivateNetworkId string
    The ID of the nexthop private network.
    NexthopResourceId string
    The ID of the nexthop resource.
    Region string
    region) The region of the route.
    Tags []string
    The tags to associate with the route.
    UpdatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    VpcId string
    The VPC ID the route belongs to.
    createdAt String
    The date and time of the creation of the route (RFC 3339 format).
    description String
    The route description.
    destination String
    The destination of the route.
    nexthopPrivateNetworkId String
    The ID of the nexthop private network.
    nexthopResourceId String
    The ID of the nexthop resource.
    region String
    region) The region of the route.
    tags List<String>
    The tags to associate with the route.
    updatedAt String
    The date and time of the creation of the route (RFC 3339 format).
    vpcId String
    The VPC ID the route belongs to.
    createdAt string
    The date and time of the creation of the route (RFC 3339 format).
    description string
    The route description.
    destination string
    The destination of the route.
    nexthopPrivateNetworkId string
    The ID of the nexthop private network.
    nexthopResourceId string
    The ID of the nexthop resource.
    region string
    region) The region of the route.
    tags string[]
    The tags to associate with the route.
    updatedAt string
    The date and time of the creation of the route (RFC 3339 format).
    vpcId string
    The VPC ID the route belongs to.
    created_at str
    The date and time of the creation of the route (RFC 3339 format).
    description str
    The route description.
    destination str
    The destination of the route.
    nexthop_private_network_id str
    The ID of the nexthop private network.
    nexthop_resource_id str
    The ID of the nexthop resource.
    region str
    region) The region of the route.
    tags Sequence[str]
    The tags to associate with the route.
    updated_at str
    The date and time of the creation of the route (RFC 3339 format).
    vpc_id str
    The VPC ID the route belongs to.
    createdAt String
    The date and time of the creation of the route (RFC 3339 format).
    description String
    The route description.
    destination String
    The destination of the route.
    nexthopPrivateNetworkId String
    The ID of the nexthop private network.
    nexthopResourceId String
    The ID of the nexthop resource.
    region String
    region) The region of the route.
    tags List<String>
    The tags to associate with the route.
    updatedAt String
    The date and time of the creation of the route (RFC 3339 format).
    vpcId String
    The VPC ID the route belongs to.

    Import

    Routes can be imported using {region}/{id}, e.g.

    bash

    $ pulumi import scaleway:index/vpcRoute:VpcRoute main fr-par/11111111-1111-1111-1111-111111111111
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.20.0 published on Monday, Nov 4, 2024 by pulumiverse