All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.aws.ec2.kotlin.RouteTableAssociationArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.ec2.kotlin

import com.pulumi.aws.ec2.RouteTableAssociationArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmName

/**
 * Provides a resource to create an association between a route table and a subnet or a route table and an
 * internet gateway or virtual private gateway.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const a = new aws.ec2.RouteTableAssociation("a", {
 *     subnetId: foo.id,
 *     routeTableId: bar.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * a = aws.ec2.RouteTableAssociation("a",
 *     subnet_id=foo["id"],
 *     route_table_id=bar["id"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var a = new Aws.Ec2.RouteTableAssociation("a", new()
 *     {
 *         SubnetId = foo.Id,
 *         RouteTableId = bar.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := ec2.NewRouteTableAssociation(ctx, "a", &ec2.RouteTableAssociationArgs{
 * 			SubnetId:     pulumi.Any(foo.Id),
 * 			RouteTableId: pulumi.Any(bar.Id),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.ec2.RouteTableAssociation;
 * import com.pulumi.aws.ec2.RouteTableAssociationArgs;
 * 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 a = new RouteTableAssociation("a", RouteTableAssociationArgs.builder()
 *             .subnetId(foo.id())
 *             .routeTableId(bar.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   a:
 *     type: aws:ec2:RouteTableAssociation
 *     properties:
 *       subnetId: ${foo.id}
 *       routeTableId: ${bar.id}
 * ```
 * 
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const b = new aws.ec2.RouteTableAssociation("b", {
 *     gatewayId: foo.id,
 *     routeTableId: bar.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * b = aws.ec2.RouteTableAssociation("b",
 *     gateway_id=foo["id"],
 *     route_table_id=bar["id"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var b = new Aws.Ec2.RouteTableAssociation("b", new()
 *     {
 *         GatewayId = foo.Id,
 *         RouteTableId = bar.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := ec2.NewRouteTableAssociation(ctx, "b", &ec2.RouteTableAssociationArgs{
 * 			GatewayId:    pulumi.Any(foo.Id),
 * 			RouteTableId: pulumi.Any(bar.Id),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.ec2.RouteTableAssociation;
 * import com.pulumi.aws.ec2.RouteTableAssociationArgs;
 * 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 b = new RouteTableAssociation("b", RouteTableAssociationArgs.builder()
 *             .gatewayId(foo.id())
 *             .routeTableId(bar.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   b:
 *     type: aws:ec2:RouteTableAssociation
 *     properties:
 *       gatewayId: ${foo.id}
 *       routeTableId: ${bar.id}
 * ```
 * 
 * ## Import
 * With EC2 Internet Gateways:
 * __Using `pulumi import` to import__ EC2 Route Table Associations using the associated resource ID and Route Table ID separated by a forward slash (`/`). For example:
 * With EC2 Subnets:
 * ```sh
 * $ pulumi import aws:ec2/routeTableAssociation:RouteTableAssociation assoc subnet-6777656e646f6c796e/rtb-656c65616e6f72
 * ```
 * With EC2 Internet Gateways:
 * ```sh
 * $ pulumi import aws:ec2/routeTableAssociation:RouteTableAssociation assoc igw-01b3a60780f8d034a/rtb-656c65616e6f72
 * ```
 * @property gatewayId The gateway ID to create an association. Conflicts with `subnet_id`.
 * @property routeTableId The ID of the routing table to associate with.
 * @property subnetId The subnet ID to create an association. Conflicts with `gateway_id`.
 */
public data class RouteTableAssociationArgs(
    public val gatewayId: Output? = null,
    public val routeTableId: Output? = null,
    public val subnetId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.ec2.RouteTableAssociationArgs =
        com.pulumi.aws.ec2.RouteTableAssociationArgs.builder()
            .gatewayId(gatewayId?.applyValue({ args0 -> args0 }))
            .routeTableId(routeTableId?.applyValue({ args0 -> args0 }))
            .subnetId(subnetId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [RouteTableAssociationArgs].
 */
@PulumiTagMarker
public class RouteTableAssociationArgsBuilder internal constructor() {
    private var gatewayId: Output? = null

    private var routeTableId: Output? = null

    private var subnetId: Output? = null

    /**
     * @param value The gateway ID to create an association. Conflicts with `subnet_id`.
     */
    @JvmName("ldklcnhpdacukxay")
    public suspend fun gatewayId(`value`: Output) {
        this.gatewayId = value
    }

    /**
     * @param value The ID of the routing table to associate with.
     */
    @JvmName("tbbvgjqyflyqkhpp")
    public suspend fun routeTableId(`value`: Output) {
        this.routeTableId = value
    }

    /**
     * @param value The subnet ID to create an association. Conflicts with `gateway_id`.
     */
    @JvmName("byciyjxttvxetlby")
    public suspend fun subnetId(`value`: Output) {
        this.subnetId = value
    }

    /**
     * @param value The gateway ID to create an association. Conflicts with `subnet_id`.
     */
    @JvmName("nbgftfleypdloxws")
    public suspend fun gatewayId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.gatewayId = mapped
    }

    /**
     * @param value The ID of the routing table to associate with.
     */
    @JvmName("pobnpgpcdrguaquh")
    public suspend fun routeTableId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.routeTableId = mapped
    }

    /**
     * @param value The subnet ID to create an association. Conflicts with `gateway_id`.
     */
    @JvmName("qmnktxcxhfyokobd")
    public suspend fun subnetId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.subnetId = mapped
    }

    internal fun build(): RouteTableAssociationArgs = RouteTableAssociationArgs(
        gatewayId = gatewayId,
        routeTableId = routeTableId,
        subnetId = subnetId,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy