UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

128 lines 5.87 kB
"use strict"; // *** 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.VpcIpamPoolCidr = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provisions a CIDR from an IPAM address pool. * * > **NOTE:** Provisioning Public IPv4 or Public IPv6 require [steps outside the scope of this resource](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html#prepare-for-byoip). The resource accepts `message` and `signature` as part of the `cidrAuthorizationContext` attribute but those must be generated ahead of time. Public IPv6 CIDRs that are provisioned into a Pool with `publiclyAdvertisable = true` and all public IPv4 CIDRs also require creating a Route Origin Authorization (ROA) object in your Regional Internet Registry (RIR). * * > **NOTE:** In order to deprovision CIDRs all Allocations must be released. Allocations created by a VPC take up to 30 minutes to be released. However, for IPAM to properly manage the removal of allocation records created by VPCs and other resources, you must [grant it permissions](https://docs.aws.amazon.com/vpc/latest/ipam/choose-single-user-or-orgs-ipam.html) in * either a single account or organizationally. If you are unable to deprovision a cidr after waiting over 30 minutes, you may be missing the Service Linked Role. * * ## Example Usage * * Basic usage: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getRegion({}); * const example = new aws.ec2.VpcIpam("example", {operatingRegions: [{ * regionName: current.then(current => current.region), * }]}); * const exampleVpcIpamPool = new aws.ec2.VpcIpamPool("example", { * addressFamily: "ipv4", * ipamScopeId: example.privateDefaultScopeId, * locale: current.then(current => current.region), * }); * const exampleVpcIpamPoolCidr = new aws.ec2.VpcIpamPoolCidr("example", { * ipamPoolId: exampleVpcIpamPool.id, * cidr: "172.20.0.0/16", * }); * ``` * * Provision Public IPv6 Pool CIDRs: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getRegion({}); * const example = new aws.ec2.VpcIpam("example", {operatingRegions: [{ * regionName: current.then(current => current.region), * }]}); * const ipv6TestPublic = new aws.ec2.VpcIpamPool("ipv6_test_public", { * addressFamily: "ipv6", * ipamScopeId: example.publicDefaultScopeId, * locale: "us-east-1", * description: "public ipv6", * publiclyAdvertisable: false, * publicIpSource: "amazon", * awsService: "ec2", * }); * const ipv6TestPublicVpcIpamPoolCidr = new aws.ec2.VpcIpamPoolCidr("ipv6_test_public", { * ipamPoolId: ipv6TestPublic.id, * netmaskLength: 52, * }); * ``` * * ## Import * * Using `pulumi import`, import IPAMs using the `<cidr>_<ipam-pool-id>`. For example: * * __NOTE:__ Do not use the IPAM Pool Cidr ID as this was introduced after the resource already existed. * * ```sh * $ pulumi import aws:ec2/vpcIpamPoolCidr:VpcIpamPoolCidr example 172.20.0.0/24_ipam-pool-0e634f5a1517cccdc * ``` */ class VpcIpamPoolCidr extends pulumi.CustomResource { /** * Get an existing VpcIpamPoolCidr 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 VpcIpamPoolCidr(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of VpcIpamPoolCidr. 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'] === VpcIpamPoolCidr.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["cidr"] = state?.cidr; resourceInputs["cidrAuthorizationContext"] = state?.cidrAuthorizationContext; resourceInputs["ipamPoolCidrId"] = state?.ipamPoolCidrId; resourceInputs["ipamPoolId"] = state?.ipamPoolId; resourceInputs["netmaskLength"] = state?.netmaskLength; resourceInputs["region"] = state?.region; } else { const args = argsOrState; if (args?.ipamPoolId === undefined && !opts.urn) { throw new Error("Missing required property 'ipamPoolId'"); } resourceInputs["cidr"] = args?.cidr; resourceInputs["cidrAuthorizationContext"] = args?.cidrAuthorizationContext; resourceInputs["ipamPoolId"] = args?.ipamPoolId; resourceInputs["netmaskLength"] = args?.netmaskLength; resourceInputs["region"] = args?.region; resourceInputs["ipamPoolCidrId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VpcIpamPoolCidr.__pulumiType, name, resourceInputs, opts); } } exports.VpcIpamPoolCidr = VpcIpamPoolCidr; /** @internal */ VpcIpamPoolCidr.__pulumiType = 'aws:ec2/vpcIpamPoolCidr:VpcIpamPoolCidr'; //# sourceMappingURL=vpcIpamPoolCidr.js.map