1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. vpc
  5. GatewayRouteTableAttachment
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.vpc.GatewayRouteTableAttachment

Explore with Pulumi AI

Provides a VPC Gateway Route Table Attachment resource.

For information about VPC Gateway Route Table Attachment and how to use it, see What is Gateway Route Table Attachment.

NOTE: Available in v1.194.0+.

Example Usage

Basic Usage

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

const example = new alicloud.vpc.Network("example", {
    cidrBlock: "172.16.0.0/12",
    vpcName: "terraform-example",
});
const exampleRouteTable = new alicloud.vpc.RouteTable("example", {
    vpcId: example.id,
    routeTableName: "terraform-example",
    description: "terraform-example",
    associateType: "Gateway",
});
const exampleIpv4Gateway = new alicloud.vpc.Ipv4Gateway("example", {
    ipv4GatewayName: "terraform-example",
    vpcId: example.id,
    enabled: true,
});
const exampleGatewayRouteTableAttachment = new alicloud.vpc.GatewayRouteTableAttachment("example", {
    ipv4GatewayId: exampleIpv4Gateway.id,
    routeTableId: exampleRouteTable.id,
});
Copy
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.vpc.Network("example",
    cidr_block="172.16.0.0/12",
    vpc_name="terraform-example")
example_route_table = alicloud.vpc.RouteTable("example",
    vpc_id=example.id,
    route_table_name="terraform-example",
    description="terraform-example",
    associate_type="Gateway")
example_ipv4_gateway = alicloud.vpc.Ipv4Gateway("example",
    ipv4_gateway_name="terraform-example",
    vpc_id=example.id,
    enabled=True)
example_gateway_route_table_attachment = alicloud.vpc.GatewayRouteTableAttachment("example",
    ipv4_gateway_id=example_ipv4_gateway.id,
    route_table_id=example_route_table.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := vpc.NewNetwork(ctx, "example", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/12"),
			VpcName:   pulumi.String("terraform-example"),
		})
		if err != nil {
			return err
		}
		exampleRouteTable, err := vpc.NewRouteTable(ctx, "example", &vpc.RouteTableArgs{
			VpcId:          example.ID(),
			RouteTableName: pulumi.String("terraform-example"),
			Description:    pulumi.String("terraform-example"),
			AssociateType:  pulumi.String("Gateway"),
		})
		if err != nil {
			return err
		}
		exampleIpv4Gateway, err := vpc.NewIpv4Gateway(ctx, "example", &vpc.Ipv4GatewayArgs{
			Ipv4GatewayName: pulumi.String("terraform-example"),
			VpcId:           example.ID(),
			Enabled:         pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = vpc.NewGatewayRouteTableAttachment(ctx, "example", &vpc.GatewayRouteTableAttachmentArgs{
			Ipv4GatewayId: exampleIpv4Gateway.ID(),
			RouteTableId:  exampleRouteTable.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var example = new AliCloud.Vpc.Network("example", new()
    {
        CidrBlock = "172.16.0.0/12",
        VpcName = "terraform-example",
    });

    var exampleRouteTable = new AliCloud.Vpc.RouteTable("example", new()
    {
        VpcId = example.Id,
        RouteTableName = "terraform-example",
        Description = "terraform-example",
        AssociateType = "Gateway",
    });

    var exampleIpv4Gateway = new AliCloud.Vpc.Ipv4Gateway("example", new()
    {
        Ipv4GatewayName = "terraform-example",
        VpcId = example.Id,
        Enabled = true,
    });

    var exampleGatewayRouteTableAttachment = new AliCloud.Vpc.GatewayRouteTableAttachment("example", new()
    {
        Ipv4GatewayId = exampleIpv4Gateway.Id,
        RouteTableId = exampleRouteTable.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.Network;
import com.pulumi.alicloud.vpc.NetworkArgs;
import com.pulumi.alicloud.vpc.RouteTable;
import com.pulumi.alicloud.vpc.RouteTableArgs;
import com.pulumi.alicloud.vpc.Ipv4Gateway;
import com.pulumi.alicloud.vpc.Ipv4GatewayArgs;
import com.pulumi.alicloud.vpc.GatewayRouteTableAttachment;
import com.pulumi.alicloud.vpc.GatewayRouteTableAttachmentArgs;
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 example = new Network("example", NetworkArgs.builder()
            .cidrBlock("172.16.0.0/12")
            .vpcName("terraform-example")
            .build());

        var exampleRouteTable = new RouteTable("exampleRouteTable", RouteTableArgs.builder()
            .vpcId(example.id())
            .routeTableName("terraform-example")
            .description("terraform-example")
            .associateType("Gateway")
            .build());

        var exampleIpv4Gateway = new Ipv4Gateway("exampleIpv4Gateway", Ipv4GatewayArgs.builder()
            .ipv4GatewayName("terraform-example")
            .vpcId(example.id())
            .enabled("true")
            .build());

        var exampleGatewayRouteTableAttachment = new GatewayRouteTableAttachment("exampleGatewayRouteTableAttachment", GatewayRouteTableAttachmentArgs.builder()
            .ipv4GatewayId(exampleIpv4Gateway.id())
            .routeTableId(exampleRouteTable.id())
            .build());

    }
}
Copy
resources:
  example:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/12
      vpcName: terraform-example
  exampleRouteTable:
    type: alicloud:vpc:RouteTable
    name: example
    properties:
      vpcId: ${example.id}
      routeTableName: terraform-example
      description: terraform-example
      associateType: Gateway
  exampleIpv4Gateway:
    type: alicloud:vpc:Ipv4Gateway
    name: example
    properties:
      ipv4GatewayName: terraform-example
      vpcId: ${example.id}
      enabled: 'true'
  exampleGatewayRouteTableAttachment:
    type: alicloud:vpc:GatewayRouteTableAttachment
    name: example
    properties:
      ipv4GatewayId: ${exampleIpv4Gateway.id}
      routeTableId: ${exampleRouteTable.id}
Copy

Create GatewayRouteTableAttachment Resource

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

Constructor syntax

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

@overload
def GatewayRouteTableAttachment(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                ipv4_gateway_id: Optional[str] = None,
                                route_table_id: Optional[str] = None,
                                dry_run: Optional[bool] = None)
func NewGatewayRouteTableAttachment(ctx *Context, name string, args GatewayRouteTableAttachmentArgs, opts ...ResourceOption) (*GatewayRouteTableAttachment, error)
public GatewayRouteTableAttachment(string name, GatewayRouteTableAttachmentArgs args, CustomResourceOptions? opts = null)
public GatewayRouteTableAttachment(String name, GatewayRouteTableAttachmentArgs args)
public GatewayRouteTableAttachment(String name, GatewayRouteTableAttachmentArgs args, CustomResourceOptions options)
type: alicloud:vpc:GatewayRouteTableAttachment
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 This property is required. GatewayRouteTableAttachmentArgs
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 This property is required. GatewayRouteTableAttachmentArgs
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 This property is required. GatewayRouteTableAttachmentArgs
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 This property is required. GatewayRouteTableAttachmentArgs
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. GatewayRouteTableAttachmentArgs
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 gatewayRouteTableAttachmentResource = new AliCloud.Vpc.GatewayRouteTableAttachment("gatewayRouteTableAttachmentResource", new()
{
    Ipv4GatewayId = "string",
    RouteTableId = "string",
    DryRun = false,
});
Copy
example, err := vpc.NewGatewayRouteTableAttachment(ctx, "gatewayRouteTableAttachmentResource", &vpc.GatewayRouteTableAttachmentArgs{
	Ipv4GatewayId: pulumi.String("string"),
	RouteTableId:  pulumi.String("string"),
	DryRun:        pulumi.Bool(false),
})
Copy
var gatewayRouteTableAttachmentResource = new GatewayRouteTableAttachment("gatewayRouteTableAttachmentResource", GatewayRouteTableAttachmentArgs.builder()
    .ipv4GatewayId("string")
    .routeTableId("string")
    .dryRun(false)
    .build());
Copy
gateway_route_table_attachment_resource = alicloud.vpc.GatewayRouteTableAttachment("gatewayRouteTableAttachmentResource",
    ipv4_gateway_id="string",
    route_table_id="string",
    dry_run=False)
Copy
const gatewayRouteTableAttachmentResource = new alicloud.vpc.GatewayRouteTableAttachment("gatewayRouteTableAttachmentResource", {
    ipv4GatewayId: "string",
    routeTableId: "string",
    dryRun: false,
});
Copy
type: alicloud:vpc:GatewayRouteTableAttachment
properties:
    dryRun: false
    ipv4GatewayId: string
    routeTableId: string
Copy

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

Ipv4GatewayId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the IPv4 Gateway instance.
RouteTableId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Gateway route table to be bound.
DryRun bool
Specifies whether to only precheck this request. Default value: false.
Ipv4GatewayId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the IPv4 Gateway instance.
RouteTableId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Gateway route table to be bound.
DryRun bool
Specifies whether to only precheck this request. Default value: false.
ipv4GatewayId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the IPv4 Gateway instance.
routeTableId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Gateway route table to be bound.
dryRun Boolean
Specifies whether to only precheck this request. Default value: false.
ipv4GatewayId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the IPv4 Gateway instance.
routeTableId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Gateway route table to be bound.
dryRun boolean
Specifies whether to only precheck this request. Default value: false.
ipv4_gateway_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the IPv4 Gateway instance.
route_table_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Gateway route table to be bound.
dry_run bool
Specifies whether to only precheck this request. Default value: false.
ipv4GatewayId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the IPv4 Gateway instance.
routeTableId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Gateway route table to be bound.
dryRun Boolean
Specifies whether to only precheck this request. Default value: false.

Outputs

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

CreateTime string
The creation time of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Status string
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
CreateTime string
The creation time of the resource.
Id string
The provider-assigned unique ID for this managed resource.
Status string
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
createTime String
The creation time of the resource.
id String
The provider-assigned unique ID for this managed resource.
status String
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
createTime string
The creation time of the resource.
id string
The provider-assigned unique ID for this managed resource.
status string
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
create_time str
The creation time of the resource.
id str
The provider-assigned unique ID for this managed resource.
status str
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
createTime String
The creation time of the resource.
id String
The provider-assigned unique ID for this managed resource.
status String
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.

Look up Existing GatewayRouteTableAttachment Resource

Get an existing GatewayRouteTableAttachment 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?: GatewayRouteTableAttachmentState, opts?: CustomResourceOptions): GatewayRouteTableAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        dry_run: Optional[bool] = None,
        ipv4_gateway_id: Optional[str] = None,
        route_table_id: Optional[str] = None,
        status: Optional[str] = None) -> GatewayRouteTableAttachment
func GetGatewayRouteTableAttachment(ctx *Context, name string, id IDInput, state *GatewayRouteTableAttachmentState, opts ...ResourceOption) (*GatewayRouteTableAttachment, error)
public static GatewayRouteTableAttachment Get(string name, Input<string> id, GatewayRouteTableAttachmentState? state, CustomResourceOptions? opts = null)
public static GatewayRouteTableAttachment get(String name, Output<String> id, GatewayRouteTableAttachmentState state, CustomResourceOptions options)
resources:  _:    type: alicloud:vpc:GatewayRouteTableAttachment    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:
CreateTime string
The creation time of the resource.
DryRun bool
Specifies whether to only precheck this request. Default value: false.
Ipv4GatewayId Changes to this property will trigger replacement. string
The ID of the IPv4 Gateway instance.
RouteTableId Changes to this property will trigger replacement. string
The ID of the Gateway route table to be bound.
Status string
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
CreateTime string
The creation time of the resource.
DryRun bool
Specifies whether to only precheck this request. Default value: false.
Ipv4GatewayId Changes to this property will trigger replacement. string
The ID of the IPv4 Gateway instance.
RouteTableId Changes to this property will trigger replacement. string
The ID of the Gateway route table to be bound.
Status string
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
createTime String
The creation time of the resource.
dryRun Boolean
Specifies whether to only precheck this request. Default value: false.
ipv4GatewayId Changes to this property will trigger replacement. String
The ID of the IPv4 Gateway instance.
routeTableId Changes to this property will trigger replacement. String
The ID of the Gateway route table to be bound.
status String
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
createTime string
The creation time of the resource.
dryRun boolean
Specifies whether to only precheck this request. Default value: false.
ipv4GatewayId Changes to this property will trigger replacement. string
The ID of the IPv4 Gateway instance.
routeTableId Changes to this property will trigger replacement. string
The ID of the Gateway route table to be bound.
status string
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
create_time str
The creation time of the resource.
dry_run bool
Specifies whether to only precheck this request. Default value: false.
ipv4_gateway_id Changes to this property will trigger replacement. str
The ID of the IPv4 Gateway instance.
route_table_id Changes to this property will trigger replacement. str
The ID of the Gateway route table to be bound.
status str
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.
createTime String
The creation time of the resource.
dryRun Boolean
Specifies whether to only precheck this request. Default value: false.
ipv4GatewayId Changes to this property will trigger replacement. String
The ID of the IPv4 Gateway instance.
routeTableId Changes to this property will trigger replacement. String
The ID of the Gateway route table to be bound.
status String
The status of the IPv4 Gateway instance. Value:

  • Creating: The function is being created.
  • Created: Created and available.
  • Modifying: is being modified.
  • Deleting: Deleting.
  • Deleted: Deleted.
  • Activating: enabled.

Import

VPC Gateway Route Table Attachment can be imported using the id, e.g.

$ pulumi import alicloud:vpc/gatewayRouteTableAttachment:GatewayRouteTableAttachment example <route_table_id>:<ipv4_gateway_id>
Copy

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

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.