@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
151 lines • 8.27 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.NetworkInterface = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an Elastic network interface (ENI) resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = new aws.ec2.NetworkInterface("test", {
* subnetId: publicA.id,
* privateIps: ["10.0.0.50"],
* securityGroups: [web.id],
* attachments: [{
* instance: testAwsInstance.id,
* deviceIndex: 1,
* }],
* });
* ```
*
* ### Example of Managing Multiple IPs on a Network Interface
*
* By default, private IPs are managed through the `privateIps` and `privateIpsCount` arguments which manage IPs as a set of IPs that are configured without regard to order. For a new network interface, the same primary IP address is consistently selected from a given set of addresses, regardless of the order provided. However, modifications of the set of addresses of an existing interface will not alter the current primary IP address unless it has been removed from the set.
*
* In order to manage the private IPs as a sequentially ordered list, configure `privateIpListEnabled` to `true` and use `privateIpList` to manage the IPs. This will disable the `privateIps` and `privateIpsCount` settings, which must be removed from the config file but are still exported. Note that changing the first address of `privateIpList`, which is the primary, always requires a new interface.
*
* If you are managing a specific set or list of IPs, instead of just using `privateIpsCount`, this is a potential workflow for also leveraging `privateIpsCount` to have AWS automatically assign additional IP addresses:
*
* 1. Comment out `privateIps`, `privateIpList`, `privateIpListEnabled` in your configuration
* 2. Set the desired `privateIpsCount` (count of the number of secondaries, the primary is not included)
* 3. Apply to assign the extra IPs
* 4. Remove `privateIpsCount` and restore your settings from the first step
* 5. Add the new IPs to your current settings
* 6. Apply again to update the stored state
*
* This process can also be used to remove IP addresses in addition to the option of manually removing them. Adding IP addresses in a manually is more difficult because it requires knowledge of which addresses are available.
*
* ## Import
*
* Using `pulumi import`, import Network Interfaces using the `id`. For example:
*
* ```sh
* $ pulumi import aws:ec2/networkInterface:NetworkInterface test eni-e5aa89a3
* ```
*/
class NetworkInterface extends pulumi.CustomResource {
/**
* Get an existing NetworkInterface 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, id, state, opts) {
return new NetworkInterface(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of NetworkInterface. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === NetworkInterface.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["attachments"] = state?.attachments;
resourceInputs["description"] = state?.description;
resourceInputs["enablePrimaryIpv6"] = state?.enablePrimaryIpv6;
resourceInputs["interfaceType"] = state?.interfaceType;
resourceInputs["ipv4PrefixCount"] = state?.ipv4PrefixCount;
resourceInputs["ipv4Prefixes"] = state?.ipv4Prefixes;
resourceInputs["ipv6AddressCount"] = state?.ipv6AddressCount;
resourceInputs["ipv6AddressListEnabled"] = state?.ipv6AddressListEnabled;
resourceInputs["ipv6AddressLists"] = state?.ipv6AddressLists;
resourceInputs["ipv6Addresses"] = state?.ipv6Addresses;
resourceInputs["ipv6PrefixCount"] = state?.ipv6PrefixCount;
resourceInputs["ipv6Prefixes"] = state?.ipv6Prefixes;
resourceInputs["macAddress"] = state?.macAddress;
resourceInputs["outpostArn"] = state?.outpostArn;
resourceInputs["ownerId"] = state?.ownerId;
resourceInputs["privateDnsName"] = state?.privateDnsName;
resourceInputs["privateIp"] = state?.privateIp;
resourceInputs["privateIpListEnabled"] = state?.privateIpListEnabled;
resourceInputs["privateIpLists"] = state?.privateIpLists;
resourceInputs["privateIps"] = state?.privateIps;
resourceInputs["privateIpsCount"] = state?.privateIpsCount;
resourceInputs["region"] = state?.region;
resourceInputs["securityGroups"] = state?.securityGroups;
resourceInputs["sourceDestCheck"] = state?.sourceDestCheck;
resourceInputs["subnetId"] = state?.subnetId;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
if (args?.subnetId === undefined && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
resourceInputs["attachments"] = args?.attachments;
resourceInputs["description"] = args?.description;
resourceInputs["enablePrimaryIpv6"] = args?.enablePrimaryIpv6;
resourceInputs["interfaceType"] = args?.interfaceType;
resourceInputs["ipv4PrefixCount"] = args?.ipv4PrefixCount;
resourceInputs["ipv4Prefixes"] = args?.ipv4Prefixes;
resourceInputs["ipv6AddressCount"] = args?.ipv6AddressCount;
resourceInputs["ipv6AddressListEnabled"] = args?.ipv6AddressListEnabled;
resourceInputs["ipv6AddressLists"] = args?.ipv6AddressLists;
resourceInputs["ipv6Addresses"] = args?.ipv6Addresses;
resourceInputs["ipv6PrefixCount"] = args?.ipv6PrefixCount;
resourceInputs["ipv6Prefixes"] = args?.ipv6Prefixes;
resourceInputs["privateIp"] = args?.privateIp;
resourceInputs["privateIpListEnabled"] = args?.privateIpListEnabled;
resourceInputs["privateIpLists"] = args?.privateIpLists;
resourceInputs["privateIps"] = args?.privateIps;
resourceInputs["privateIpsCount"] = args?.privateIpsCount;
resourceInputs["region"] = args?.region;
resourceInputs["securityGroups"] = args?.securityGroups;
resourceInputs["sourceDestCheck"] = args?.sourceDestCheck;
resourceInputs["subnetId"] = args?.subnetId;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["macAddress"] = undefined /*out*/;
resourceInputs["outpostArn"] = undefined /*out*/;
resourceInputs["ownerId"] = undefined /*out*/;
resourceInputs["privateDnsName"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkInterface.__pulumiType, name, resourceInputs, opts);
}
}
exports.NetworkInterface = NetworkInterface;
/** @internal */
NetworkInterface.__pulumiType = 'aws:ec2/networkInterface:NetworkInterface';
//# sourceMappingURL=networkInterface.js.map