UNPKG

@pulumi/awsx

Version:

[![Actions Status](https://github.com/pulumi/pulumi-awsx/workflows/master/badge.svg)](https://github.com/pulumi/pulumi-awsx/actions) [![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM version](https://badge.fur

287 lines (286 loc) • 13.2 kB
import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; import { InternetGateway } from "./internetGateway"; import { NatGateway, NatGatewayArgs } from "./natGateway"; import { Subnet } from "./subnet"; declare class VpcData { } export declare class Vpc extends pulumi.ComponentResource<VpcData> { readonly id: pulumi.Output<string>; readonly vpc: pulumi.Output<aws.ec2.Vpc>; constructor(name: string, args: VpcArgs | ExistingVpcArgs | ExistingVpcIdArgs, opts?: pulumi.ComponentResourceOptions); protected initialize(props: { name: string; args: any; opts: pulumi.ComponentResourceOptions; }): Promise<VpcData>; private static getProvider; addInternetGateway(name: string, subnets?: Subnet[], args?: aws.ec2.InternetGatewayArgs, opts?: pulumi.ComponentResourceOptions): Promise<void>; addNatGateway(name: string, args: NatGatewayArgs, opts?: pulumi.ComponentResourceOptions): Promise<void>; /** * Get an existing Vpc resource's state with the given name and IDs of its relevant * sub-resources. This will not cause a VPC (or any sub-resources) to be created, and removing * this Vpc from your pulumi application will not cause the existing cloud resource (or * sub-resources) to be destroyed. */ static fromExistingIds(name: string, idArgs: ExistingVpcIdArgs, opts?: pulumi.ComponentResourceOptions): Vpc; /** * Gets the default vpc for the current aws account and region. * * See https://docs.aws.amazon.com/vpc/latest/userguide/default-vpc.html for more details. * * Note: the no-arg version of this call is not recommended. It will acquire the default Vpc * for the current region and cache it. Instead, it is recommended that the `getDefault(opts)` * version be used instead with either `opts.provider` or `opts.parent` set. This version will * properly get the default vpc for the region the provider specifies. * * This method will return the same Vpc instance when passed the same `provider`. */ static getDefault(opts?: pulumi.InvokeOptions): Vpc; /** * Asynchronously retrieves the IDs for the public subnets in this Vpc. This will only retrieve * data for the subnets specified when the Vpc was created. If subnets were created externally, * they will not be included. */ get publicSubnetIds(): Promise<pulumi.Output<string>[]>; /** * Asynchronously retrieves the IDs for the private subnets in this Vpc. This will only retrieve * data for the subnets specified when the Vpc was created. If subnets were created externally, * they will not be included. */ get privateSubnetIds(): Promise<pulumi.Output<string>[]>; /** * Asynchronously retrieves the IDs for the isolated subnets in this Vpc. This will only retrieve * data for the subnets specified when the Vpc was created. If subnets were created externally, * they will not be included. */ get isolatedSubnetIds(): Promise<pulumi.Output<string>[]>; /** * Asynchronously retrieves the IDs for the subnets of a particular type in this Vpc. This will * only retrieve data for the subnets specified when the Vpc was created. If subnets were * created externally, they will not be included. */ getSubnetsIds(type: VpcSubnetType): Promise<pulumi.Output<string>[]>; /** * Asynchronously retrieves the public subnets in this Vpc. This will only retrieve data for * the subnets specified when the Vpc was created. If subnets were created externally, they * will not be included. */ get publicSubnets(): Promise<Subnet[]>; /** * Asynchronously retrieves the private subnets in this Vpc. This will only retrieve data for * the subnets specified when the Vpc was created. If subnets were created externally, they * will not be included. */ get privateSubnets(): Promise<Subnet[]>; /** * Asynchronously retrieves the isolated subnets in this Vpc. This will only retrieve data for * the subnets specified when the Vpc was created. If subnets were created externally, they * will not be included. */ get isolatedSubnets(): Promise<Subnet[]>; /** * Asynchronously retrieves the subnets of a particular type in this Vpc. This will only * retrieve data for the subnets specified when the Vpc was created. If subnets were created * externally, they will not be included. */ getSubnets(type: VpcSubnetType): Promise<Subnet[]>; /** * The internet gateway created to allow traffic to/from the internet to the public subnets. * Only available if this was created using [VpcArgs]. */ get internetGateway(): Promise<InternetGateway | undefined>; /** * The nat gateways created to allow private subnets access to the internet. * Only available if this was created using [VpcArgs]. */ get natGateways(): Promise<NatGateway[]>; } /** * The type of this subnet. * * 1. A "public" subnet will route traffic to an [InternetGateway]. If you specify a public subnet * this InternetGateway will be created on your behalf and traffic will be routed accordingly. * 2. A "private" subnet is similar to "public" except that the subnet will not have a route to the * [InternetGateway]. Instead, there will be a route entry setup for the NatGateway in that * availability zone to the subnet. * 3. Unlike "public" or "private" subnets, an "isolated" subnet has no routing specified at all. */ export type VpcSubnetType = "public" | "private" | "isolated"; /** * Information that controls how each vpc subnet should be created for each availability zone. By * default, the Vpc will control actually creating the appropriate subnets in each zone depending on * the values specified in this type. This help ensure that each subnet will reside entirely within * one Availability Zone and cannot span zones. * * For finer control of the locations of the subnets, specify the [location] property for all the * subnets. * * See https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html for more details. */ export interface VpcSubnetArgs { /** * The type of subnet to make in each availability zone. */ type: VpcSubnetType; /** * An optional name to use as part of the subnet name. If not provided, will be set to * "public"/"private"/"isolated" depending on the [type] of this subnet. Required if making * multiple subnets with the same type. */ name?: string; /** * The number of leading bits in the Vpc cidrBlock to use to define the cidrBlock for this * subnet. By providing masking bits, this can be computed in a way that ensures that each * subnet has a distinct block. * * If this is not provided, the cidrBlock for the vpc will be appropriately split based on the * number of subnets and availability zones there are. * * The allowed mask size is between a 28 netmask and 16 netmask. See * https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html for more details. * * If this property is provided, [location] cannot be provided. */ cidrMask?: number; /** * More precise information about the location of this subnet. Can either be a simple CidrBlock * (i.e. 10.0.0.0/24), or a richer object describing the CidrBlocks and Availability Zone for * the subnet. * * If this property is provided, [cidrMask] cannot be provided. * * If only a CidrBlock is provided here, then the subnet will be placed in the first * availability zone for the region. * * If this property is provided for one subnet, it must be provided for all subnets. */ location?: CidrBlock | VpcSubnetLocation; /** * Specify true to indicate that network interfaces created in the specified subnet should be * assigned an IPv6 address. Defaults to the value of VpcArgs.assignGeneratedIpv6CidrBlock. */ assignIpv6AddressOnCreation?: pulumi.Input<boolean>; /** * Specify true to indicate that instances launched into the subnet should be assigned a public * IP address. Default's to `true` if `type` is `public`. `false` otherwise. */ mapPublicIpOnLaunch?: pulumi.Input<boolean>; tags?: pulumi.Input<aws.Tags>; /** * Ignore changes to any of the specified properties of the Subnet. */ ignoreChanges?: string[]; } /** * Alias for a cidr block. */ export type CidrBlock = string; export interface VpcSubnetLocation { /** * The AZ for the subnet. */ availabilityZone?: string; /** * The AZ ID of the subnet. */ availabilityZoneId?: string; /** * The CIDR block for the subnet. */ cidrBlock: pulumi.Input<CidrBlock>; /** * The IPv6 network range for the subnet, in CIDR notation. The subnet size must use a /64 * prefix length. */ ipv6CidrBlock?: pulumi.Input<string>; } export interface ExistingVpcIdArgs { /** The id of the VPC. */ vpcId: pulumi.Input<string>; /** The public subnets for the vpc. */ publicSubnetIds?: pulumi.Input<string>[]; /** The private subnets for the vpc. */ privateSubnetIds?: pulumi.Input<string>[]; /** The isolated subnets for the vpc. */ isolatedSubnetIds?: pulumi.Input<string>[]; /** The id of the internet gateway for this VPC */ internetGatewayId?: pulumi.Input<string>; /** The ids of the nat gateways for this VPC */ natGatewayIds?: pulumi.Input<string>[]; } export interface ExistingVpcArgs { /** The id of the VPC. */ vpc: aws.ec2.Vpc; } export interface VpcArgs { /** * The information about what subnets to create per availability zone. Defaults to one public and * one private subnet if unspecified. */ subnets?: VpcSubnetArgs[]; /** * The names of the availability zones to use in the current region. Defaults to `2` if * unspecified. Use `"all"` to use all the availability zones in the current region. */ requestedAvailabilityZones?: number | "all" | [string, ...string[]] | pulumi.Input<string[]>; numberOfAvailabilityZones?: VpcArgs["requestedAvailabilityZones"]; /** * The max number of NAT gateways to create if there are any private subnets created. A NAT * gateway enables instances in a private subnet to connect to the internet or other AWS * services, but prevent the internet from initiating a connection with those instances. A * minimum of '1' gateway is needed if an instance is to be allowed connection to the internet. * * If this is not set, a nat gateway will be made for each availability zone in the current * region. The first public subnet for that availability zone will be the one used to place the * nat gateway in. If less gateways are requested than availability zones, then only that many * nat gateways will be created. * * Private subnets in an availability zone that contains a nat gateway will route through that * gateway. Private subnets in an availability zone that does not contain a nat gateway will be * routed to the other nat gateways in a round-robin fashion. * * See https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html for more details. * * Defaults to [numberOfAvailabilityZones]. */ numberOfNatGateways?: number; /** * Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot * specify the range of IP addresses, or the size of the CIDR block. Default is `false`. If set * to `true`, then subnets created will default to `assignIpv6AddressOnCreation: true` as well. */ assignGeneratedIpv6CidrBlock?: pulumi.Input<boolean>; /** * The CIDR block for the VPC. Defaults to "10.0.0.0/16" if unspecified. */ cidrBlock?: CidrBlock; /** * A boolean flag to enable/disable ClassicLink * for the VPC. Only valid in regions and accounts that support EC2 Classic. * See the [ClassicLink documentation][1] for more information. Defaults false. */ enableClassiclink?: pulumi.Input<boolean>; /** * A boolean flag to enable/disable ClassicLink DNS Support for the VPC. * Only valid in regions and accounts that support EC2 Classic. */ enableClassiclinkDnsSupport?: pulumi.Input<boolean>; /** * A boolean flag to enable/disable DNS hostnames in the VPC. Defaults to true if unspecified. */ enableDnsHostnames?: pulumi.Input<boolean>; /** * A boolean flag to enable/disable DNS support in the VPC. Defaults true if unspecified. */ enableDnsSupport?: pulumi.Input<boolean>; /** * A tenancy option for instances launched into the VPC. Defaults to "default" if unspecified. */ instanceTenancy?: pulumi.Input<"default" | "dedicated">; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<aws.Tags>; } export {};