import * as pulumi from "@pulumi/pulumi"; /** * 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. * * > **NOTE:** When AWS GuardDuty is enabled in your account, it automatically creates VPC endpoints in your VPCs to monitor network traffic. During subnet deletion, the provider automatically detects and dissociates the subnet from these GuardDuty-managed VPC endpoints if they are blocking the deletion, preserving GuardDuty protection for other subnets in the VPC. This cleanup only targets resources tagged with `GuardDutyManaged=true` and happens automatically during destroy operations with no manual intervention required. For optimal functionality, the IAM role used by Terraform should have the optional permissions listed below. If these permissions are not available, the provider will continue with the deletion attempt and surface warnings only if the deletion ultimately fails. * * ## 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", * }, * }); * ``` * * ### 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 `vpcId` 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", * }); * ``` * * ### IPAM-Managed Subnets * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getRegion({}); * const test = new aws.ec2.VpcIpam("test", {operatingRegions: [{ * regionName: current.then(current => current.region), * }]}); * const testVpcIpamPool = new aws.ec2.VpcIpamPool("test", { * addressFamily: "ipv4", * ipamScopeId: test.privateDefaultScopeId, * locale: current.then(current => current.region), * }); * const testVpcIpamPoolCidr = new aws.ec2.VpcIpamPoolCidr("test", { * ipamPoolId: testVpcIpamPool.id, * cidr: "10.0.0.0/16", * }); * const testVpc = new aws.ec2.Vpc("test", { * ipv4IpamPoolId: testVpcIpamPool.id, * ipv4NetmaskLength: 24, * }, { * dependsOn: [testVpcIpamPoolCidr], * }); * const vpc = new aws.ec2.VpcIpamPool("vpc", { * sourceResource: { * resourceId: testVpc.id, * resourceOwner: currentAwsCallerIdentity.accountId, * resourceRegion: current.then(current => current.region), * resourceType: "vpc", * }, * addressFamily: "ipv4", * ipamScopeId: test.privateDefaultScopeId, * locale: current.then(current => current.region), * sourceIpamPoolId: testVpcIpamPool.id, * }); * const vpcVpcIpamPoolCidr = new aws.ec2.VpcIpamPoolCidr("vpc", { * ipamPoolId: vpc.id, * cidr: testVpc.cidrBlock, * }); * const testSubnet = new aws.ec2.Subnet("test", { * vpcId: testVpc.id, * ipv4IpamPoolId: vpc.id, * ipv4NetmaskLength: 28, * availabilityZone: available.names[0], * }, { * dependsOn: [vpcVpcIpamPoolCidr], * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * * `id` (String) ID of the subnet. * * #### Optional * * * `accountId` (String) AWS Account where this resource is managed. * * `region` (String) Region where this resource is managed. * * Using `pulumi import`, import subnets using the subnet `id`. For example: * * ```sh * $ pulumi import aws:ec2/subnet:Subnet example subnet-9d4a7b6c * ``` */ export declare class Subnet extends pulumi.CustomResource { /** * Get an existing Subnet resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: SubnetState, opts?: pulumi.CustomResourceOptions): Subnet; /** * Returns true if the given object is an instance of Subnet. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Subnet; /** * The ARN of the subnet. */ readonly arn: pulumi.Output; /** * Specify true to indicate * that network interfaces created in the specified subnet should be * assigned an IPv6 address. Default is `false` */ readonly assignIpv6AddressOnCreation: pulumi.Output; /** * AZ for the subnet. */ readonly availabilityZone: pulumi.Output; /** * AZ ID of the subnet. This argument is not supported in all regions or partitions. If necessary, use `availabilityZone` instead. */ readonly availabilityZoneId: pulumi.Output; /** * The IPv4 CIDR block for the subnet. */ readonly cidrBlock: pulumi.Output; /** * The customer owned IPv4 address pool. Typically used with the `mapCustomerOwnedIpOnLaunch` argument. The `outpostArn` argument must be specified when configured. */ readonly customerOwnedIpv4Pool: pulumi.Output; /** * 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`. */ readonly enableDns64: pulumi.Output; /** * 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). */ readonly enableLniAtDeviceIndex: pulumi.Output; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`. */ readonly enableResourceNameDnsARecordOnLaunch: pulumi.Output; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `false`. */ readonly enableResourceNameDnsAaaaRecordOnLaunch: pulumi.Output; /** * ID of an IPv4 VPC Resource Planning IPAM Pool. The CIDR of this pool is used to allocate the CIDR for the subnet. */ readonly ipv4IpamPoolId: pulumi.Output; /** * Netmask. Requires specifying a `ipv4IpamPoolId`. */ readonly ipv4NetmaskLength: pulumi.Output; /** * The IPv6 network range for the subnet, * in CIDR notation. The subnet size must use a /64 prefix length. If the existing IPv6 subnet was created with `assignIpv6AddressOnCreation = true`, changing this value will force resource recreation. */ readonly ipv6CidrBlock: pulumi.Output; /** * The association ID for the IPv6 CIDR block. */ readonly ipv6CidrBlockAssociationId: pulumi.Output; /** * ID of an IPv6 VPC Resource Planning IPAM Pool. The CIDR of this pool is used to allocate the CIDR for the subnet. */ readonly ipv6IpamPoolId: pulumi.Output; /** * Indicates whether to create an IPv6-only subnet. Default: `false`. */ readonly ipv6Native: pulumi.Output; /** * Netmask. Requires specifying a `ipv6IpamPoolId`. Valid values are from 44 to 64 in increments of 4. */ readonly ipv6NetmaskLength: pulumi.Output; /** * Specify `true` to indicate that network interfaces created in the subnet should be assigned a customer owned IP address. The `customerOwnedIpv4Pool` and `outpostArn` arguments must be specified when set to `true`. Default is `false`. */ readonly mapCustomerOwnedIpOnLaunch: pulumi.Output; /** * Specify true to indicate that instances launched into the subnet should be assigned a public IP address. Default is `false`. */ readonly mapPublicIpOnLaunch: pulumi.Output; /** * ARN of the Outpost. */ readonly outpostArn: pulumi.Output; /** * The ID of the AWS account that owns the subnet. */ readonly ownerId: pulumi.Output; /** * 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`. */ readonly privateDnsHostnameTypeOnLaunch: pulumi.Output; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output; /** * A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ readonly tagsAll: pulumi.Output<{ [key: string]: string; }>; /** * The VPC ID. */ readonly vpcId: pulumi.Output; /** * Create a Subnet resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: SubnetArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Subnet resources. */ export interface SubnetState { /** * The ARN of the subnet. */ arn?: pulumi.Input; /** * Specify true to indicate * that network interfaces created in the specified subnet should be * assigned an IPv6 address. Default is `false` */ assignIpv6AddressOnCreation?: pulumi.Input; /** * AZ for the subnet. */ availabilityZone?: pulumi.Input; /** * AZ ID of the subnet. This argument is not supported in all regions or partitions. If necessary, use `availabilityZone` instead. */ availabilityZoneId?: pulumi.Input; /** * The IPv4 CIDR block for the subnet. */ cidrBlock?: pulumi.Input; /** * The customer owned IPv4 address pool. Typically used with the `mapCustomerOwnedIpOnLaunch` argument. The `outpostArn` argument must be specified when configured. */ customerOwnedIpv4Pool?: pulumi.Input; /** * 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`. */ enableDns64?: pulumi.Input; /** * 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). */ enableLniAtDeviceIndex?: pulumi.Input; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`. */ enableResourceNameDnsARecordOnLaunch?: pulumi.Input; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `false`. */ enableResourceNameDnsAaaaRecordOnLaunch?: pulumi.Input; /** * ID of an IPv4 VPC Resource Planning IPAM Pool. The CIDR of this pool is used to allocate the CIDR for the subnet. */ ipv4IpamPoolId?: pulumi.Input; /** * Netmask. Requires specifying a `ipv4IpamPoolId`. */ ipv4NetmaskLength?: pulumi.Input; /** * The IPv6 network range for the subnet, * in CIDR notation. The subnet size must use a /64 prefix length. If the existing IPv6 subnet was created with `assignIpv6AddressOnCreation = true`, changing this value will force resource recreation. */ ipv6CidrBlock?: pulumi.Input; /** * The association ID for the IPv6 CIDR block. */ ipv6CidrBlockAssociationId?: pulumi.Input; /** * ID of an IPv6 VPC Resource Planning IPAM Pool. The CIDR of this pool is used to allocate the CIDR for the subnet. */ ipv6IpamPoolId?: pulumi.Input; /** * Indicates whether to create an IPv6-only subnet. Default: `false`. */ ipv6Native?: pulumi.Input; /** * Netmask. Requires specifying a `ipv6IpamPoolId`. Valid values are from 44 to 64 in increments of 4. */ ipv6NetmaskLength?: pulumi.Input; /** * Specify `true` to indicate that network interfaces created in the subnet should be assigned a customer owned IP address. The `customerOwnedIpv4Pool` and `outpostArn` arguments must be specified when set to `true`. Default is `false`. */ mapCustomerOwnedIpOnLaunch?: pulumi.Input; /** * Specify true to indicate that instances launched into the subnet should be assigned a public IP address. Default is `false`. */ mapPublicIpOnLaunch?: pulumi.Input; /** * ARN of the Outpost. */ outpostArn?: pulumi.Input; /** * The ID of the AWS account that owns the subnet. */ ownerId?: pulumi.Input; /** * 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`. */ privateDnsHostnameTypeOnLaunch?: pulumi.Input; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input; /** * A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; } | undefined>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ tagsAll?: pulumi.Input<{ [key: string]: pulumi.Input; } | undefined>; /** * The VPC ID. */ vpcId?: pulumi.Input; } /** * The set of arguments for constructing a Subnet resource. */ export interface SubnetArgs { /** * Specify true to indicate * that network interfaces created in the specified subnet should be * assigned an IPv6 address. Default is `false` */ assignIpv6AddressOnCreation?: pulumi.Input; /** * AZ for the subnet. */ availabilityZone?: pulumi.Input; /** * AZ ID of the subnet. This argument is not supported in all regions or partitions. If necessary, use `availabilityZone` instead. */ availabilityZoneId?: pulumi.Input; /** * The IPv4 CIDR block for the subnet. */ cidrBlock?: pulumi.Input; /** * The customer owned IPv4 address pool. Typically used with the `mapCustomerOwnedIpOnLaunch` argument. The `outpostArn` argument must be specified when configured. */ customerOwnedIpv4Pool?: pulumi.Input; /** * 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`. */ enableDns64?: pulumi.Input; /** * 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). */ enableLniAtDeviceIndex?: pulumi.Input; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false`. */ enableResourceNameDnsARecordOnLaunch?: pulumi.Input; /** * Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `false`. */ enableResourceNameDnsAaaaRecordOnLaunch?: pulumi.Input; /** * ID of an IPv4 VPC Resource Planning IPAM Pool. The CIDR of this pool is used to allocate the CIDR for the subnet. */ ipv4IpamPoolId?: pulumi.Input; /** * Netmask. Requires specifying a `ipv4IpamPoolId`. */ ipv4NetmaskLength?: pulumi.Input; /** * The IPv6 network range for the subnet, * in CIDR notation. The subnet size must use a /64 prefix length. If the existing IPv6 subnet was created with `assignIpv6AddressOnCreation = true`, changing this value will force resource recreation. */ ipv6CidrBlock?: pulumi.Input; /** * ID of an IPv6 VPC Resource Planning IPAM Pool. The CIDR of this pool is used to allocate the CIDR for the subnet. */ ipv6IpamPoolId?: pulumi.Input; /** * Indicates whether to create an IPv6-only subnet. Default: `false`. */ ipv6Native?: pulumi.Input; /** * Netmask. Requires specifying a `ipv6IpamPoolId`. Valid values are from 44 to 64 in increments of 4. */ ipv6NetmaskLength?: pulumi.Input; /** * Specify `true` to indicate that network interfaces created in the subnet should be assigned a customer owned IP address. The `customerOwnedIpv4Pool` and `outpostArn` arguments must be specified when set to `true`. Default is `false`. */ mapCustomerOwnedIpOnLaunch?: pulumi.Input; /** * Specify true to indicate that instances launched into the subnet should be assigned a public IP address. Default is `false`. */ mapPublicIpOnLaunch?: pulumi.Input; /** * ARN of the Outpost. */ outpostArn?: pulumi.Input; /** * 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`. */ privateDnsHostnameTypeOnLaunch?: pulumi.Input; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input; /** * A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; } | undefined>; /** * The VPC ID. */ vpcId: pulumi.Input; } //# sourceMappingURL=subnet.d.ts.map