Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.ec2.kotlin
import com.pulumi.aws.ec2.SubnetArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName
/**
* Provides an VPC subnet resource.
* > **NOTE:** Due to [AWS Lambda improved VPC networking changes that began deploying in September 2019](https://aws.amazon.com/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/), subnets associated with Lambda Functions can take up to 45 minutes to successfully delete. To allow for successful deletion, the provider will wait for at least 45 minutes even if a shorter delete timeout is specified.
* ## Example Usage
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const main = new aws.ec2.Subnet("main", {
* vpcId: mainAwsVpc.id,
* cidrBlock: "10.0.1.0/24",
* tags: {
* Name: "Main",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* main = aws.ec2.Subnet("main",
* vpc_id=main_aws_vpc["id"],
* cidr_block="10.0.1.0/24",
* tags={
* "Name": "Main",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var main = new Aws.Ec2.Subnet("main", new()
* {
* VpcId = mainAwsVpc.Id,
* CidrBlock = "10.0.1.0/24",
* Tags =
* {
* { "Name", "Main" },
* },
* });
* });
* ```
* ```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.NewSubnet(ctx, "main", &ec2.SubnetArgs{
* VpcId: pulumi.Any(mainAwsVpc.Id),
* CidrBlock: pulumi.String("10.0.1.0/24"),
* Tags: pulumi.StringMap{
* "Name": pulumi.String("Main"),
* },
* })
* 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.Subnet;
* import com.pulumi.aws.ec2.SubnetArgs;
* 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 Subnet("main", SubnetArgs.builder()
* .vpcId(mainAwsVpc.id())
* .cidrBlock("10.0.1.0/24")
* .tags(Map.of("Name", "Main"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* main:
* type: aws:ec2:Subnet
* properties:
* vpcId: ${mainAwsVpc.id}
* cidrBlock: 10.0.1.0/24
* tags:
* Name: Main
* ```
*
* ### Subnets In Secondary VPC CIDR Blocks
* When managing subnets in one of a VPC's secondary CIDR blocks created using a `aws.ec2.VpcIpv4CidrBlockAssociation`
* resource, it is recommended to reference that resource's `vpc_id` attribute to ensure correct dependency ordering.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const secondaryCidr = new aws.ec2.VpcIpv4CidrBlockAssociation("secondary_cidr", {
* vpcId: main.id,
* cidrBlock: "172.20.0.0/16",
* });
* const inSecondaryCidr = new aws.ec2.Subnet("in_secondary_cidr", {
* vpcId: secondaryCidr.vpcId,
* cidrBlock: "172.20.0.0/24",
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* secondary_cidr = aws.ec2.VpcIpv4CidrBlockAssociation("secondary_cidr",
* vpc_id=main["id"],
* cidr_block="172.20.0.0/16")
* in_secondary_cidr = aws.ec2.Subnet("in_secondary_cidr",
* vpc_id=secondary_cidr.vpc_id,
* cidr_block="172.20.0.0/24")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var secondaryCidr = new Aws.Ec2.VpcIpv4CidrBlockAssociation("secondary_cidr", new()
* {
* VpcId = main.Id,
* CidrBlock = "172.20.0.0/16",
* });
* var inSecondaryCidr = new Aws.Ec2.Subnet("in_secondary_cidr", new()
* {
* VpcId = secondaryCidr.VpcId,
* CidrBlock = "172.20.0.0/24",
* });
* });
* ```
* ```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 {
* secondaryCidr, err := ec2.NewVpcIpv4CidrBlockAssociation(ctx, "secondary_cidr", &ec2.VpcIpv4CidrBlockAssociationArgs{
* VpcId: pulumi.Any(main.Id),
* CidrBlock: pulumi.String("172.20.0.0/16"),
* })
* if err != nil {
* return err
* }
* _, err = ec2.NewSubnet(ctx, "in_secondary_cidr", &ec2.SubnetArgs{
* VpcId: secondaryCidr.VpcId,
* CidrBlock: pulumi.String("172.20.0.0/24"),
* })
* 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.VpcIpv4CidrBlockAssociation;
* import com.pulumi.aws.ec2.VpcIpv4CidrBlockAssociationArgs;
* import com.pulumi.aws.ec2.Subnet;
* import com.pulumi.aws.ec2.SubnetArgs;
* 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 secondaryCidr = new VpcIpv4CidrBlockAssociation("secondaryCidr", VpcIpv4CidrBlockAssociationArgs.builder()
* .vpcId(main.id())
* .cidrBlock("172.20.0.0/16")
* .build());
* var inSecondaryCidr = new Subnet("inSecondaryCidr", SubnetArgs.builder()
* .vpcId(secondaryCidr.vpcId())
* .cidrBlock("172.20.0.0/24")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* secondaryCidr:
* type: aws:ec2:VpcIpv4CidrBlockAssociation
* name: secondary_cidr
* properties:
* vpcId: ${main.id}
* cidrBlock: 172.20.0.0/16
* inSecondaryCidr:
* type: aws:ec2:Subnet
* name: in_secondary_cidr
* properties:
* vpcId: ${secondaryCidr.vpcId}
* cidrBlock: 172.20.0.0/24
* ```
*
* ## Import
* Using `pulumi import`, import subnets using the subnet `id`. For example:
* ```sh
* $ pulumi import aws:ec2/subnet:Subnet public_subnet subnet-9d4a7b6c
* ```
* @property assignIpv6AddressOnCreation Specify true to indicate
* that network interfaces created in the specified subnet should be
* assigned an IPv6 address. Default is `false`
* @property availabilityZone AZ for the subnet.
* @property availabilityZoneId AZ ID of the subnet. This argument is not supported in all regions or partitions. If necessary, use `availability_zone` instead.
* @property cidrBlock The IPv4 CIDR block for the subnet.
* @property customerOwnedIpv4Pool The customer owned IPv4 address pool. Typically used with the `map_customer_owned_ip_on_launch` argument. The `outpost_arn` argument must be specified when configured.
* @property enableDns64 Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `false`.
* @property enableLniAtDeviceIndex Indicates the device position for local network interfaces in this subnet. For example, 1 indicates local network interfaces in this subnet are the secondary network interface (eth1). A local network interface cannot be the primary network interface (eth0).
* @property enableResourceNameDnsARecordOnLaunch Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`.
* @property enableResourceNameDnsAaaaRecordOnLaunch Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `false`.
* @property ipv6CidrBlock The IPv6 network range for the subnet,
* in CIDR notation. The subnet size must use a /64 prefix length.
* @property ipv6Native Indicates whether to create an IPv6-only subnet. Default: `false`.
* @property mapCustomerOwnedIpOnLaunch Specify `true` to indicate that network interfaces created in the subnet should be assigned a customer owned IP address. The `customer_owned_ipv4_pool` and `outpost_arn` arguments must be specified when set to `true`. Default is `false`.
* @property mapPublicIpOnLaunch Specify true to indicate
* that instances launched into the subnet should be assigned
* a public IP address. Default is `false`.
* @property outpostArn The Amazon Resource Name (ARN) of the Outpost.
* @property privateDnsHostnameTypeOnLaunch The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name`.
* @property tags A map of tags to assign to the resource. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
* @property vpcId The VPC ID.
*/
public data class SubnetArgs(
public val assignIpv6AddressOnCreation: Output? = null,
public val availabilityZone: Output? = null,
public val availabilityZoneId: Output? = null,
public val cidrBlock: Output? = null,
public val customerOwnedIpv4Pool: Output? = null,
public val enableDns64: Output? = null,
public val enableLniAtDeviceIndex: Output? = null,
public val enableResourceNameDnsARecordOnLaunch: Output? = null,
public val enableResourceNameDnsAaaaRecordOnLaunch: Output? = null,
public val ipv6CidrBlock: Output? = null,
public val ipv6Native: Output? = null,
public val mapCustomerOwnedIpOnLaunch: Output? = null,
public val mapPublicIpOnLaunch: Output? = null,
public val outpostArn: Output? = null,
public val privateDnsHostnameTypeOnLaunch: Output? = null,
public val tags: Output