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

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

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.ec2.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [NetworkAclAssociation].
 */
@PulumiTagMarker
public class NetworkAclAssociationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NetworkAclAssociationArgs = NetworkAclAssociationArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend NetworkAclAssociationArgsBuilder.() -> Unit) {
        val builder = NetworkAclAssociationArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): NetworkAclAssociation {
        val builtJavaResource = com.pulumi.aws.ec2.NetworkAclAssociation(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return NetworkAclAssociation(builtJavaResource)
    }
}

/**
 * Provides an network ACL association resource which allows you to associate your network ACL with any subnet(s).
 * > **NOTE on Network ACLs and Network ACL Associations:** the provider provides both a standalone network ACL association resource
 * and a network ACL resource with a `subnet_ids` attribute. Do not use the same subnet ID in both a network ACL
 * resource and a network ACL association resource. Doing so will cause a conflict of associations and will overwrite the association.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const main = new aws.ec2.NetworkAclAssociation("main", {
 *     networkAclId: mainAwsNetworkAcl.id,
 *     subnetId: mainAwsSubnet.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * main = aws.ec2.NetworkAclAssociation("main",
 *     network_acl_id=main_aws_network_acl["id"],
 *     subnet_id=main_aws_subnet["id"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var main = new Aws.Ec2.NetworkAclAssociation("main", new()
 *     {
 *         NetworkAclId = mainAwsNetworkAcl.Id,
 *         SubnetId = mainAwsSubnet.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.NewNetworkAclAssociation(ctx, "main", &ec2.NetworkAclAssociationArgs{
 * 			NetworkAclId: pulumi.Any(mainAwsNetworkAcl.Id),
 * 			SubnetId:     pulumi.Any(mainAwsSubnet.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.NetworkAclAssociation;
 * import com.pulumi.aws.ec2.NetworkAclAssociationArgs;
 * 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 main = new NetworkAclAssociation("main", NetworkAclAssociationArgs.builder()
 *             .networkAclId(mainAwsNetworkAcl.id())
 *             .subnetId(mainAwsSubnet.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   main:
 *     type: aws:ec2:NetworkAclAssociation
 *     properties:
 *       networkAclId: ${mainAwsNetworkAcl.id}
 *       subnetId: ${mainAwsSubnet.id}
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import Network ACL associations using the `id`. For example:
 * ```sh
 * $ pulumi import aws:ec2/networkAclAssociation:NetworkAclAssociation main aclassoc-02baf37f20966b3e6
 * ```
 */
public class NetworkAclAssociation internal constructor(
    override val javaResource: com.pulumi.aws.ec2.NetworkAclAssociation,
) : KotlinCustomResource(javaResource, NetworkAclAssociationMapper) {
    /**
     * The ID of the network ACL.
     */
    public val networkAclId: Output
        get() = javaResource.networkAclId().applyValue({ args0 -> args0 })

    /**
     * The ID of the associated Subnet.
     */
    public val subnetId: Output
        get() = javaResource.subnetId().applyValue({ args0 -> args0 })
}

public object NetworkAclAssociationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.ec2.NetworkAclAssociation::class == javaResource::class

    override fun map(javaResource: Resource): NetworkAclAssociation =
        NetworkAclAssociation(javaResource as com.pulumi.aws.ec2.NetworkAclAssociation)
}

/**
 * @see [NetworkAclAssociation].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [NetworkAclAssociation].
 */
public suspend fun networkAclAssociation(
    name: String,
    block: suspend NetworkAclAssociationResourceBuilder.() -> Unit,
): NetworkAclAssociation {
    val builder = NetworkAclAssociationResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [NetworkAclAssociation].
 * @param name The _unique_ name of the resulting resource.
 */
public fun networkAclAssociation(name: String): NetworkAclAssociation {
    val builder = NetworkAclAssociationResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy