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

alicloud.vpc.GatewayEndpointRouteTableAttachment

Explore with Pulumi AI

Provides a VPC Gateway Endpoint Route Table Attachment resource. VPC gateway node association route.

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

NOTE: Available since v1.208.0.

Example Usage

Basic Usage

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

const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const defaulteVpc = new alicloud.vpc.Network("defaulteVpc", {description: "test"});
const defaultGE = new alicloud.vpc.GatewayEndpoint("defaultGE", {
    serviceName: "com.aliyun.cn-hangzhou.oss",
    policyDocument: `        {
          "Version": "1",
          "Statement": [{
            "Effect": "Allow",
            "Resource": ["*"],
            "Action": ["*"],
            "Principal": ["*"]
          }]
        }
`,
    vpcId: defaulteVpc.id,
    gatewayEndpointDescrption: "test-gateway-endpoint",
    gatewayEndpointName: `${name}1`,
});
const defaultRT = new alicloud.vpc.RouteTable("defaultRT", {
    vpcId: defaulteVpc.id,
    routeTableName: `${name}2`,
});
const _default = new alicloud.vpc.GatewayEndpointRouteTableAttachment("default", {
    gatewayEndpointId: defaultGE.id,
    routeTableId: defaultRT.id,
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
defaulte_vpc = alicloud.vpc.Network("defaulteVpc", description="test")
default_ge = alicloud.vpc.GatewayEndpoint("defaultGE",
    service_name="com.aliyun.cn-hangzhou.oss",
    policy_document="""        {
          "Version": "1",
          "Statement": [{
            "Effect": "Allow",
            "Resource": ["*"],
            "Action": ["*"],
            "Principal": ["*"]
          }]
        }
""",
    vpc_id=defaulte_vpc.id,
    gateway_endpoint_descrption="test-gateway-endpoint",
    gateway_endpoint_name=f"{name}1")
default_rt = alicloud.vpc.RouteTable("defaultRT",
    vpc_id=defaulte_vpc.id,
    route_table_name=f"{name}2")
default = alicloud.vpc.GatewayEndpointRouteTableAttachment("default",
    gateway_endpoint_id=default_ge.id,
    route_table_id=default_rt.id)
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"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, "")
		name := "terraform-example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		defaulteVpc, err := vpc.NewNetwork(ctx, "defaulteVpc", &vpc.NetworkArgs{
			Description: pulumi.String("test"),
		})
		if err != nil {
			return err
		}
		defaultGE, err := vpc.NewGatewayEndpoint(ctx, "defaultGE", &vpc.GatewayEndpointArgs{
			ServiceName: pulumi.String("com.aliyun.cn-hangzhou.oss"),
			PolicyDocument: pulumi.String(`        {
          "Version": "1",
          "Statement": [{
            "Effect": "Allow",
            "Resource": ["*"],
            "Action": ["*"],
            "Principal": ["*"]
          }]
        }
`),
			VpcId:                     defaulteVpc.ID(),
			GatewayEndpointDescrption: pulumi.String("test-gateway-endpoint"),
			GatewayEndpointName:       pulumi.Sprintf("%v1", name),
		})
		if err != nil {
			return err
		}
		defaultRT, err := vpc.NewRouteTable(ctx, "defaultRT", &vpc.RouteTableArgs{
			VpcId:          defaulteVpc.ID(),
			RouteTableName: pulumi.Sprintf("%v2", name),
		})
		if err != nil {
			return err
		}
		_, err = vpc.NewGatewayEndpointRouteTableAttachment(ctx, "default", &vpc.GatewayEndpointRouteTableAttachmentArgs{
			GatewayEndpointId: defaultGE.ID(),
			RouteTableId:      defaultRT.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 config = new Config();
    var name = config.Get("name") ?? "terraform-example";
    var defaulteVpc = new AliCloud.Vpc.Network("defaulteVpc", new()
    {
        Description = "test",
    });

    var defaultGE = new AliCloud.Vpc.GatewayEndpoint("defaultGE", new()
    {
        ServiceName = "com.aliyun.cn-hangzhou.oss",
        PolicyDocument = @"        {
          ""Version"": ""1"",
          ""Statement"": [{
            ""Effect"": ""Allow"",
            ""Resource"": [""*""],
            ""Action"": [""*""],
            ""Principal"": [""*""]
          }]
        }
",
        VpcId = defaulteVpc.Id,
        GatewayEndpointDescrption = "test-gateway-endpoint",
        GatewayEndpointName = $"{name}1",
    });

    var defaultRT = new AliCloud.Vpc.RouteTable("defaultRT", new()
    {
        VpcId = defaulteVpc.Id,
        RouteTableName = $"{name}2",
    });

    var @default = new AliCloud.Vpc.GatewayEndpointRouteTableAttachment("default", new()
    {
        GatewayEndpointId = defaultGE.Id,
        RouteTableId = defaultRT.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.GatewayEndpoint;
import com.pulumi.alicloud.vpc.GatewayEndpointArgs;
import com.pulumi.alicloud.vpc.RouteTable;
import com.pulumi.alicloud.vpc.RouteTableArgs;
import com.pulumi.alicloud.vpc.GatewayEndpointRouteTableAttachment;
import com.pulumi.alicloud.vpc.GatewayEndpointRouteTableAttachmentArgs;
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 name = config.get("name").orElse("terraform-example");
        var defaulteVpc = new Network("defaulteVpc", NetworkArgs.builder()
            .description("test")
            .build());

        var defaultGE = new GatewayEndpoint("defaultGE", GatewayEndpointArgs.builder()
            .serviceName("com.aliyun.cn-hangzhou.oss")
            .policyDocument("""
        {
          "Version": "1",
          "Statement": [{
            "Effect": "Allow",
            "Resource": ["*"],
            "Action": ["*"],
            "Principal": ["*"]
          }]
        }
            """)
            .vpcId(defaulteVpc.id())
            .gatewayEndpointDescrption("test-gateway-endpoint")
            .gatewayEndpointName(String.format("%s1", name))
            .build());

        var defaultRT = new RouteTable("defaultRT", RouteTableArgs.builder()
            .vpcId(defaulteVpc.id())
            .routeTableName(String.format("%s2", name))
            .build());

        var default_ = new GatewayEndpointRouteTableAttachment("default", GatewayEndpointRouteTableAttachmentArgs.builder()
            .gatewayEndpointId(defaultGE.id())
            .routeTableId(defaultRT.id())
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: terraform-example
resources:
  defaulteVpc:
    type: alicloud:vpc:Network
    properties:
      description: test
  defaultGE:
    type: alicloud:vpc:GatewayEndpoint
    properties:
      serviceName: com.aliyun.cn-hangzhou.oss
      policyDocument: |2
                {
                  "Version": "1",
                  "Statement": [{
                    "Effect": "Allow",
                    "Resource": ["*"],
                    "Action": ["*"],
                    "Principal": ["*"]
                  }]
                }
      vpcId: ${defaulteVpc.id}
      gatewayEndpointDescrption: test-gateway-endpoint
      gatewayEndpointName: ${name}1
  defaultRT:
    type: alicloud:vpc:RouteTable
    properties:
      vpcId: ${defaulteVpc.id}
      routeTableName: ${name}2
  default:
    type: alicloud:vpc:GatewayEndpointRouteTableAttachment
    properties:
      gatewayEndpointId: ${defaultGE.id}
      routeTableId: ${defaultRT.id}
Copy

Create GatewayEndpointRouteTableAttachment Resource

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

Constructor syntax

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

@overload
def GatewayEndpointRouteTableAttachment(resource_name: str,
                                        opts: Optional[ResourceOptions] = None,
                                        gateway_endpoint_id: Optional[str] = None,
                                        route_table_id: Optional[str] = None)
func NewGatewayEndpointRouteTableAttachment(ctx *Context, name string, args GatewayEndpointRouteTableAttachmentArgs, opts ...ResourceOption) (*GatewayEndpointRouteTableAttachment, error)
public GatewayEndpointRouteTableAttachment(string name, GatewayEndpointRouteTableAttachmentArgs args, CustomResourceOptions? opts = null)
public GatewayEndpointRouteTableAttachment(String name, GatewayEndpointRouteTableAttachmentArgs args)
public GatewayEndpointRouteTableAttachment(String name, GatewayEndpointRouteTableAttachmentArgs args, CustomResourceOptions options)
type: alicloud:vpc:GatewayEndpointRouteTableAttachment
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. GatewayEndpointRouteTableAttachmentArgs
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. GatewayEndpointRouteTableAttachmentArgs
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. GatewayEndpointRouteTableAttachmentArgs
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. GatewayEndpointRouteTableAttachmentArgs
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. GatewayEndpointRouteTableAttachmentArgs
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 gatewayEndpointRouteTableAttachmentResource = new AliCloud.Vpc.GatewayEndpointRouteTableAttachment("gatewayEndpointRouteTableAttachmentResource", new()
{
    GatewayEndpointId = "string",
    RouteTableId = "string",
});
Copy
example, err := vpc.NewGatewayEndpointRouteTableAttachment(ctx, "gatewayEndpointRouteTableAttachmentResource", &vpc.GatewayEndpointRouteTableAttachmentArgs{
	GatewayEndpointId: pulumi.String("string"),
	RouteTableId:      pulumi.String("string"),
})
Copy
var gatewayEndpointRouteTableAttachmentResource = new GatewayEndpointRouteTableAttachment("gatewayEndpointRouteTableAttachmentResource", GatewayEndpointRouteTableAttachmentArgs.builder()
    .gatewayEndpointId("string")
    .routeTableId("string")
    .build());
Copy
gateway_endpoint_route_table_attachment_resource = alicloud.vpc.GatewayEndpointRouteTableAttachment("gatewayEndpointRouteTableAttachmentResource",
    gateway_endpoint_id="string",
    route_table_id="string")
Copy
const gatewayEndpointRouteTableAttachmentResource = new alicloud.vpc.GatewayEndpointRouteTableAttachment("gatewayEndpointRouteTableAttachmentResource", {
    gatewayEndpointId: "string",
    routeTableId: "string",
});
Copy
type: alicloud:vpc:GatewayEndpointRouteTableAttachment
properties:
    gatewayEndpointId: string
    routeTableId: string
Copy

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

GatewayEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the gateway endpoint instance to which you want to associate the route table.
RouteTableId
This property is required.
Changes to this property will trigger replacement.
string
Routing table ID.
GatewayEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the gateway endpoint instance to which you want to associate the route table.
RouteTableId
This property is required.
Changes to this property will trigger replacement.
string
Routing table ID.
gatewayEndpointId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the gateway endpoint instance to which you want to associate the route table.
routeTableId
This property is required.
Changes to this property will trigger replacement.
String
Routing table ID.
gatewayEndpointId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the gateway endpoint instance to which you want to associate the route table.
routeTableId
This property is required.
Changes to this property will trigger replacement.
string
Routing table ID.
gateway_endpoint_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the gateway endpoint instance to which you want to associate the route table.
route_table_id
This property is required.
Changes to this property will trigger replacement.
str
Routing table ID.
gatewayEndpointId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the gateway endpoint instance to which you want to associate the route table.
routeTableId
This property is required.
Changes to this property will trigger replacement.
String
Routing table ID.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Status string
Status of the gateway endpoint.
Id string
The provider-assigned unique ID for this managed resource.
Status string
Status of the gateway endpoint.
id String
The provider-assigned unique ID for this managed resource.
status String
Status of the gateway endpoint.
id string
The provider-assigned unique ID for this managed resource.
status string
Status of the gateway endpoint.
id str
The provider-assigned unique ID for this managed resource.
status str
Status of the gateway endpoint.
id String
The provider-assigned unique ID for this managed resource.
status String
Status of the gateway endpoint.

Look up Existing GatewayEndpointRouteTableAttachment Resource

Get an existing GatewayEndpointRouteTableAttachment 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?: GatewayEndpointRouteTableAttachmentState, opts?: CustomResourceOptions): GatewayEndpointRouteTableAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        gateway_endpoint_id: Optional[str] = None,
        route_table_id: Optional[str] = None,
        status: Optional[str] = None) -> GatewayEndpointRouteTableAttachment
func GetGatewayEndpointRouteTableAttachment(ctx *Context, name string, id IDInput, state *GatewayEndpointRouteTableAttachmentState, opts ...ResourceOption) (*GatewayEndpointRouteTableAttachment, error)
public static GatewayEndpointRouteTableAttachment Get(string name, Input<string> id, GatewayEndpointRouteTableAttachmentState? state, CustomResourceOptions? opts = null)
public static GatewayEndpointRouteTableAttachment get(String name, Output<String> id, GatewayEndpointRouteTableAttachmentState state, CustomResourceOptions options)
resources:  _:    type: alicloud:vpc:GatewayEndpointRouteTableAttachment    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:
GatewayEndpointId Changes to this property will trigger replacement. string
The ID of the gateway endpoint instance to which you want to associate the route table.
RouteTableId Changes to this property will trigger replacement. string
Routing table ID.
Status string
Status of the gateway endpoint.
GatewayEndpointId Changes to this property will trigger replacement. string
The ID of the gateway endpoint instance to which you want to associate the route table.
RouteTableId Changes to this property will trigger replacement. string
Routing table ID.
Status string
Status of the gateway endpoint.
gatewayEndpointId Changes to this property will trigger replacement. String
The ID of the gateway endpoint instance to which you want to associate the route table.
routeTableId Changes to this property will trigger replacement. String
Routing table ID.
status String
Status of the gateway endpoint.
gatewayEndpointId Changes to this property will trigger replacement. string
The ID of the gateway endpoint instance to which you want to associate the route table.
routeTableId Changes to this property will trigger replacement. string
Routing table ID.
status string
Status of the gateway endpoint.
gateway_endpoint_id Changes to this property will trigger replacement. str
The ID of the gateway endpoint instance to which you want to associate the route table.
route_table_id Changes to this property will trigger replacement. str
Routing table ID.
status str
Status of the gateway endpoint.
gatewayEndpointId Changes to this property will trigger replacement. String
The ID of the gateway endpoint instance to which you want to associate the route table.
routeTableId Changes to this property will trigger replacement. String
Routing table ID.
status String
Status of the gateway endpoint.

Import

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

$ pulumi import alicloud:vpc/gatewayEndpointRouteTableAttachment:GatewayEndpointRouteTableAttachment example <gateway_endpoint_id>:<route_table_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.