tencentcloud.RouteTableEntry
Explore with Pulumi AI
Provides a resource to create an entry of a routing table.
NOTE: When setting the route item switch, do not use it together with resource
tencentcloud.RouteTableEntryConfig
.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const config = new pulumi.Config();
const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-4";
// create vpc
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// create route table
const exampleRouteTable = new tencentcloud.RouteTable("exampleRouteTable", {vpcId: vpc.vpcId});
// create subnet
const subnet = new tencentcloud.Subnet("subnet", {
vpcId: vpc.vpcId,
cidrBlock: "10.0.12.0/24",
availabilityZone: availabilityZone,
routeTableId: exampleRouteTable.routeTableId,
});
// create route table entry
const exampleRouteTableEntry = new tencentcloud.RouteTableEntry("exampleRouteTableEntry", {
routeTableId: exampleRouteTable.routeTableId,
destinationCidrBlock: "10.12.12.0/24",
nextType: "EIP",
nextHub: "0",
description: "Terraform test.",
});
export const itemId = exampleRouteTableEntry.routeItemId;
import pulumi
import pulumi_tencentcloud as tencentcloud
config = pulumi.Config()
availability_zone = config.get("availabilityZone")
if availability_zone is None:
availability_zone = "ap-guangzhou-4"
# create vpc
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# create route table
example_route_table = tencentcloud.RouteTable("exampleRouteTable", vpc_id=vpc.vpc_id)
# create subnet
subnet = tencentcloud.Subnet("subnet",
vpc_id=vpc.vpc_id,
cidr_block="10.0.12.0/24",
availability_zone=availability_zone,
route_table_id=example_route_table.route_table_id)
# create route table entry
example_route_table_entry = tencentcloud.RouteTableEntry("exampleRouteTableEntry",
route_table_id=example_route_table.route_table_id,
destination_cidr_block="10.12.12.0/24",
next_type="EIP",
next_hub="0",
description="Terraform test.")
pulumi.export("itemId", example_route_table_entry.route_item_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
availabilityZone := "ap-guangzhou-4"
if param := cfg.Get("availabilityZone"); param != "" {
availabilityZone = param
}
// create vpc
vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
// create route table
exampleRouteTable, err := tencentcloud.NewRouteTable(ctx, "exampleRouteTable", &tencentcloud.RouteTableArgs{
VpcId: vpc.VpcId,
})
if err != nil {
return err
}
// create subnet
_, err = tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
VpcId: vpc.VpcId,
CidrBlock: pulumi.String("10.0.12.0/24"),
AvailabilityZone: pulumi.String(availabilityZone),
RouteTableId: exampleRouteTable.RouteTableId,
})
if err != nil {
return err
}
// create route table entry
exampleRouteTableEntry, err := tencentcloud.NewRouteTableEntry(ctx, "exampleRouteTableEntry", &tencentcloud.RouteTableEntryArgs{
RouteTableId: exampleRouteTable.RouteTableId,
DestinationCidrBlock: pulumi.String("10.12.12.0/24"),
NextType: pulumi.String("EIP"),
NextHub: pulumi.String("0"),
Description: pulumi.String("Terraform test."),
})
if err != nil {
return err
}
ctx.Export("itemId", exampleRouteTableEntry.RouteItemId)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-4";
// create vpc
var vpc = new Tencentcloud.Vpc("vpc", new()
{
CidrBlock = "10.0.0.0/16",
});
// create route table
var exampleRouteTable = new Tencentcloud.RouteTable("exampleRouteTable", new()
{
VpcId = vpc.VpcId,
});
// create subnet
var subnet = new Tencentcloud.Subnet("subnet", new()
{
VpcId = vpc.VpcId,
CidrBlock = "10.0.12.0/24",
AvailabilityZone = availabilityZone,
RouteTableId = exampleRouteTable.RouteTableId,
});
// create route table entry
var exampleRouteTableEntry = new Tencentcloud.RouteTableEntry("exampleRouteTableEntry", new()
{
RouteTableId = exampleRouteTable.RouteTableId,
DestinationCidrBlock = "10.12.12.0/24",
NextType = "EIP",
NextHub = "0",
Description = "Terraform test.",
});
return new Dictionary<string, object?>
{
["itemId"] = exampleRouteTableEntry.RouteItemId,
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.RouteTable;
import com.pulumi.tencentcloud.RouteTableArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.RouteTableEntry;
import com.pulumi.tencentcloud.RouteTableEntryArgs;
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 config = ctx.config();
final var availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-4");
// create vpc
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
// create route table
var exampleRouteTable = new RouteTable("exampleRouteTable", RouteTableArgs.builder()
.vpcId(vpc.vpcId())
.build());
// create subnet
var subnet = new Subnet("subnet", SubnetArgs.builder()
.vpcId(vpc.vpcId())
.cidrBlock("10.0.12.0/24")
.availabilityZone(availabilityZone)
.routeTableId(exampleRouteTable.routeTableId())
.build());
// create route table entry
var exampleRouteTableEntry = new RouteTableEntry("exampleRouteTableEntry", RouteTableEntryArgs.builder()
.routeTableId(exampleRouteTable.routeTableId())
.destinationCidrBlock("10.12.12.0/24")
.nextType("EIP")
.nextHub("0")
.description("Terraform test.")
.build());
ctx.export("itemId", exampleRouteTableEntry.routeItemId());
}
}
configuration:
availabilityZone:
type: string
default: ap-guangzhou-4
resources:
# create vpc
vpc:
type: tencentcloud:Vpc
properties:
cidrBlock: 10.0.0.0/16
# create route table
exampleRouteTable:
type: tencentcloud:RouteTable
properties:
vpcId: ${vpc.vpcId}
# create subnet
subnet:
type: tencentcloud:Subnet
properties:
vpcId: ${vpc.vpcId}
cidrBlock: 10.0.12.0/24
availabilityZone: ${availabilityZone}
routeTableId: ${exampleRouteTable.routeTableId}
# create route table entry
exampleRouteTableEntry:
type: tencentcloud:RouteTableEntry
properties:
routeTableId: ${exampleRouteTable.routeTableId}
destinationCidrBlock: 10.12.12.0/24
nextType: EIP
nextHub: '0'
description: Terraform test.
outputs:
# output
itemId: ${exampleRouteTableEntry.routeItemId}
Create RouteTableEntry Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RouteTableEntry(name: string, args: RouteTableEntryArgs, opts?: CustomResourceOptions);
@overload
def RouteTableEntry(resource_name: str,
args: RouteTableEntryArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RouteTableEntry(resource_name: str,
opts: Optional[ResourceOptions] = None,
destination_cidr_block: Optional[str] = None,
next_hub: Optional[str] = None,
next_type: Optional[str] = None,
route_table_id: Optional[str] = None,
description: Optional[str] = None,
disabled: Optional[bool] = None,
route_table_entry_id: Optional[str] = None)
func NewRouteTableEntry(ctx *Context, name string, args RouteTableEntryArgs, opts ...ResourceOption) (*RouteTableEntry, error)
public RouteTableEntry(string name, RouteTableEntryArgs args, CustomResourceOptions? opts = null)
public RouteTableEntry(String name, RouteTableEntryArgs args)
public RouteTableEntry(String name, RouteTableEntryArgs args, CustomResourceOptions options)
type: tencentcloud:RouteTableEntry
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 RouteTableEntryArgs
- 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 RouteTableEntryArgs
- 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 RouteTableEntryArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouteTableEntryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RouteTableEntryArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
RouteTableEntry 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 RouteTableEntry resource accepts the following input properties:
- Destination
Cidr stringBlock - Destination address block.
- Next
Hub string - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - Next
Type string - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - Route
Table stringId - ID of routing table to which this entry belongs.
- Description string
- Description of the routing table entry.
- Disabled bool
- Whether the entry is disabled, default is
false
. - Route
Table stringEntry Id - ID of the resource.
- Destination
Cidr stringBlock - Destination address block.
- Next
Hub string - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - Next
Type string - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - Route
Table stringId - ID of routing table to which this entry belongs.
- Description string
- Description of the routing table entry.
- Disabled bool
- Whether the entry is disabled, default is
false
. - Route
Table stringEntry Id - ID of the resource.
- destination
Cidr StringBlock - Destination address block.
- next
Hub String - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next
Type String - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route
Table StringId - ID of routing table to which this entry belongs.
- description String
- Description of the routing table entry.
- disabled Boolean
- Whether the entry is disabled, default is
false
. - route
Table StringEntry Id - ID of the resource.
- destination
Cidr stringBlock - Destination address block.
- next
Hub string - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next
Type string - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route
Table stringId - ID of routing table to which this entry belongs.
- description string
- Description of the routing table entry.
- disabled boolean
- Whether the entry is disabled, default is
false
. - route
Table stringEntry Id - ID of the resource.
- destination_
cidr_ strblock - Destination address block.
- next_
hub str - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next_
type str - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route_
table_ strid - ID of routing table to which this entry belongs.
- description str
- Description of the routing table entry.
- disabled bool
- Whether the entry is disabled, default is
false
. - route_
table_ strentry_ id - ID of the resource.
- destination
Cidr StringBlock - Destination address block.
- next
Hub String - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next
Type String - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route
Table StringId - ID of routing table to which this entry belongs.
- description String
- Description of the routing table entry.
- disabled Boolean
- Whether the entry is disabled, default is
false
. - route
Table StringEntry Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the RouteTableEntry resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Route
Item stringId - ID of route table entry.
- Id string
- The provider-assigned unique ID for this managed resource.
- Route
Item stringId - ID of route table entry.
- id String
- The provider-assigned unique ID for this managed resource.
- route
Item StringId - ID of route table entry.
- id string
- The provider-assigned unique ID for this managed resource.
- route
Item stringId - ID of route table entry.
- id str
- The provider-assigned unique ID for this managed resource.
- route_
item_ strid - ID of route table entry.
- id String
- The provider-assigned unique ID for this managed resource.
- route
Item StringId - ID of route table entry.
Look up Existing RouteTableEntry Resource
Get an existing RouteTableEntry 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?: RouteTableEntryState, opts?: CustomResourceOptions): RouteTableEntry
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
destination_cidr_block: Optional[str] = None,
disabled: Optional[bool] = None,
next_hub: Optional[str] = None,
next_type: Optional[str] = None,
route_item_id: Optional[str] = None,
route_table_entry_id: Optional[str] = None,
route_table_id: Optional[str] = None) -> RouteTableEntry
func GetRouteTableEntry(ctx *Context, name string, id IDInput, state *RouteTableEntryState, opts ...ResourceOption) (*RouteTableEntry, error)
public static RouteTableEntry Get(string name, Input<string> id, RouteTableEntryState? state, CustomResourceOptions? opts = null)
public static RouteTableEntry get(String name, Output<String> id, RouteTableEntryState state, CustomResourceOptions options)
resources: _: type: tencentcloud:RouteTableEntry get: id: ${id}
- 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.
- Description string
- Description of the routing table entry.
- Destination
Cidr stringBlock - Destination address block.
- Disabled bool
- Whether the entry is disabled, default is
false
. - Next
Hub string - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - Next
Type string - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - Route
Item stringId - ID of route table entry.
- Route
Table stringEntry Id - ID of the resource.
- Route
Table stringId - ID of routing table to which this entry belongs.
- Description string
- Description of the routing table entry.
- Destination
Cidr stringBlock - Destination address block.
- Disabled bool
- Whether the entry is disabled, default is
false
. - Next
Hub string - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - Next
Type string - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - Route
Item stringId - ID of route table entry.
- Route
Table stringEntry Id - ID of the resource.
- Route
Table stringId - ID of routing table to which this entry belongs.
- description String
- Description of the routing table entry.
- destination
Cidr StringBlock - Destination address block.
- disabled Boolean
- Whether the entry is disabled, default is
false
. - next
Hub String - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next
Type String - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route
Item StringId - ID of route table entry.
- route
Table StringEntry Id - ID of the resource.
- route
Table StringId - ID of routing table to which this entry belongs.
- description string
- Description of the routing table entry.
- destination
Cidr stringBlock - Destination address block.
- disabled boolean
- Whether the entry is disabled, default is
false
. - next
Hub string - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next
Type string - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route
Item stringId - ID of route table entry.
- route
Table stringEntry Id - ID of the resource.
- route
Table stringId - ID of routing table to which this entry belongs.
- description str
- Description of the routing table entry.
- destination_
cidr_ strblock - Destination address block.
- disabled bool
- Whether the entry is disabled, default is
false
. - next_
hub str - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next_
type str - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route_
item_ strid - ID of route table entry.
- route_
table_ strentry_ id - ID of the resource.
- route_
table_ strid - ID of routing table to which this entry belongs.
- description String
- Description of the routing table entry.
- destination
Cidr StringBlock - Destination address block.
- disabled Boolean
- Whether the entry is disabled, default is
false
. - next
Hub String - ID of next-hop gateway. Note: when
next_type
is EIP,next_hub
should be0
. - next
Type String - Type of next-hop. Valid values:
CVM
,VPN
,DIRECTCONNECT
,PEERCONNECTION
,HAVIP
,NAT
,NORMAL_CVM
,EIP
,LOCAL_GATEWAY
,INTRANAT
andUSER_CCN
. - route
Item StringId - ID of route table entry.
- route
Table StringEntry Id - ID of the resource.
- route
Table StringId - ID of routing table to which this entry belongs.
Import
Route table entry can be imported using the id, e.g.
$ pulumi import tencentcloud:index/routeTableEntry:RouteTableEntry example 3065857.rtb-b050fg94
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.