1. Packages
  2. Netbox Provider
  3. API Docs
  4. RouteTarget
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.RouteTarget

Explore with Pulumi AI

From the official documentation:

A route target is a particular type of extended BGP community used to control the redistribution of routes among VRF tables in a network. Route targets can be assigned to individual VRFs in NetBox as import or export targets (or both) to model this exchange in an L3VPN. Each route target must be given a unique name, which should be in a format prescribed by RFC 4364, similar to a VR route distinguisher.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";

const testTenant = new netbox.Tenant("testTenant", {});
const testRouteTarget = new netbox.RouteTarget("testRouteTarget", {
    description: "my description",
    tenantId: testTenant.tenantId,
});
Copy
import pulumi
import pulumi_netbox as netbox

test_tenant = netbox.Tenant("testTenant")
test_route_target = netbox.RouteTarget("testRouteTarget",
    description="my description",
    tenant_id=test_tenant.tenant_id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testTenant, err := netbox.NewTenant(ctx, "testTenant", nil)
		if err != nil {
			return err
		}
		_, err = netbox.NewRouteTarget(ctx, "testRouteTarget", &netbox.RouteTargetArgs{
			Description: pulumi.String("my description"),
			TenantId:    testTenant.TenantId,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;

return await Deployment.RunAsync(() => 
{
    var testTenant = new Netbox.Tenant("testTenant");

    var testRouteTarget = new Netbox.RouteTarget("testRouteTarget", new()
    {
        Description = "my description",
        TenantId = testTenant.TenantId,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Tenant;
import com.pulumi.netbox.RouteTarget;
import com.pulumi.netbox.RouteTargetArgs;
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 testTenant = new Tenant("testTenant");

        var testRouteTarget = new RouteTarget("testRouteTarget", RouteTargetArgs.builder()
            .description("my description")
            .tenantId(testTenant.tenantId())
            .build());

    }
}
Copy
resources:
  testTenant:
    type: netbox:Tenant
  testRouteTarget:
    type: netbox:RouteTarget
    properties:
      description: my description
      tenantId: ${testTenant.tenantId}
Copy

Create RouteTarget Resource

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

Constructor syntax

new RouteTarget(name: string, args?: RouteTargetArgs, opts?: CustomResourceOptions);
@overload
def RouteTarget(resource_name: str,
                args: Optional[RouteTargetArgs] = None,
                opts: Optional[ResourceOptions] = None)

@overload
def RouteTarget(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                description: Optional[str] = None,
                name: Optional[str] = None,
                route_target_id: Optional[str] = None,
                tags: Optional[Sequence[str]] = None,
                tenant_id: Optional[float] = None)
func NewRouteTarget(ctx *Context, name string, args *RouteTargetArgs, opts ...ResourceOption) (*RouteTarget, error)
public RouteTarget(string name, RouteTargetArgs? args = null, CustomResourceOptions? opts = null)
public RouteTarget(String name, RouteTargetArgs args)
public RouteTarget(String name, RouteTargetArgs args, CustomResourceOptions options)
type: netbox:RouteTarget
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args RouteTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args RouteTargetArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args RouteTargetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args RouteTargetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RouteTargetArgs
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 routeTargetResource = new Netbox.RouteTarget("routeTargetResource", new()
{
    Description = "string",
    Name = "string",
    RouteTargetId = "string",
    Tags = new[]
    {
        "string",
    },
    TenantId = 0,
});
Copy
example, err := netbox.NewRouteTarget(ctx, "routeTargetResource", &netbox.RouteTargetArgs{
Description: pulumi.String("string"),
Name: pulumi.String("string"),
RouteTargetId: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TenantId: pulumi.Float64(0),
})
Copy
var routeTargetResource = new RouteTarget("routeTargetResource", RouteTargetArgs.builder()
    .description("string")
    .name("string")
    .routeTargetId("string")
    .tags("string")
    .tenantId(0)
    .build());
Copy
route_target_resource = netbox.RouteTarget("routeTargetResource",
    description="string",
    name="string",
    route_target_id="string",
    tags=["string"],
    tenant_id=0)
Copy
const routeTargetResource = new netbox.RouteTarget("routeTargetResource", {
    description: "string",
    name: "string",
    routeTargetId: "string",
    tags: ["string"],
    tenantId: 0,
});
Copy
type: netbox:RouteTarget
properties:
    description: string
    name: string
    routeTargetId: string
    tags:
        - string
    tenantId: 0
Copy

RouteTarget 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 RouteTarget resource accepts the following input properties:

Description string
Name string
RouteTargetId string
The ID of this resource.
Tags List<string>
TenantId double
Description string
Name string
RouteTargetId string
The ID of this resource.
Tags []string
TenantId float64
description String
name String
routeTargetId String
The ID of this resource.
tags List<String>
tenantId Double
description string
name string
routeTargetId string
The ID of this resource.
tags string[]
tenantId number
description str
name str
route_target_id str
The ID of this resource.
tags Sequence[str]
tenant_id float
description String
name String
routeTargetId String
The ID of this resource.
tags List<String>
tenantId Number

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing RouteTarget Resource

Get an existing RouteTarget 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?: RouteTargetState, opts?: CustomResourceOptions): RouteTarget
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        route_target_id: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        tenant_id: Optional[float] = None) -> RouteTarget
func GetRouteTarget(ctx *Context, name string, id IDInput, state *RouteTargetState, opts ...ResourceOption) (*RouteTarget, error)
public static RouteTarget Get(string name, Input<string> id, RouteTargetState? state, CustomResourceOptions? opts = null)
public static RouteTarget get(String name, Output<String> id, RouteTargetState state, CustomResourceOptions options)
resources:  _:    type: netbox:RouteTarget    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Description string
Name string
RouteTargetId string
The ID of this resource.
Tags List<string>
TenantId double
Description string
Name string
RouteTargetId string
The ID of this resource.
Tags []string
TenantId float64
description String
name String
routeTargetId String
The ID of this resource.
tags List<String>
tenantId Double
description string
name string
routeTargetId string
The ID of this resource.
tags string[]
tenantId number
description str
name str
route_target_id str
The ID of this resource.
tags Sequence[str]
tenant_id float
description String
name String
routeTargetId String
The ID of this resource.
tags List<String>
tenantId Number

Package Details

Repository
netbox e-breuninger/terraform-provider-netbox
License
Notes
This Pulumi package is based on the netbox Terraform Provider.