UNPKG

@pulumi/aws

Version:

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

106 lines 3.52 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.getVpcOutput = exports.getVpc = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * `aws.ec2.Vpc` provides details about a specific VPC. * * This resource can prove useful when a module accepts a vpc id as * an input variable and needs to, for example, determine the CIDR block of that * VPC. * * ## Example Usage * * The following example shows how one might accept a VPC id as a variable * and use this data source to obtain the data necessary to create a subnet * within it. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as std from "@pulumi/std"; * * const config = new pulumi.Config(); * const vpcId = config.requireObject<any>("vpcId"); * const selected = aws.ec2.getVpc({ * id: vpcId, * }); * const example = new aws.ec2.Subnet("example", { * vpcId: selected.then(selected => selected.id), * availabilityZone: "us-west-2a", * cidrBlock: selected.then(selected => std.cidrsubnet({ * input: selected.cidrBlock, * newbits: 4, * netnum: 1, * })).then(invoke => invoke.result), * }); * ``` */ function getVpc(args, opts) { args = args || {}; opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invoke("aws:ec2/getVpc:getVpc", { "cidrBlock": args.cidrBlock, "default": args.default, "dhcpOptionsId": args.dhcpOptionsId, "filters": args.filters, "id": args.id, "region": args.region, "state": args.state, "tags": args.tags, }, opts); } exports.getVpc = getVpc; /** * `aws.ec2.Vpc` provides details about a specific VPC. * * This resource can prove useful when a module accepts a vpc id as * an input variable and needs to, for example, determine the CIDR block of that * VPC. * * ## Example Usage * * The following example shows how one might accept a VPC id as a variable * and use this data source to obtain the data necessary to create a subnet * within it. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * import * as std from "@pulumi/std"; * * const config = new pulumi.Config(); * const vpcId = config.requireObject<any>("vpcId"); * const selected = aws.ec2.getVpc({ * id: vpcId, * }); * const example = new aws.ec2.Subnet("example", { * vpcId: selected.then(selected => selected.id), * availabilityZone: "us-west-2a", * cidrBlock: selected.then(selected => std.cidrsubnet({ * input: selected.cidrBlock, * newbits: 4, * netnum: 1, * })).then(invoke => invoke.result), * }); * ``` */ function getVpcOutput(args, opts) { args = args || {}; opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invokeOutput("aws:ec2/getVpc:getVpc", { "cidrBlock": args.cidrBlock, "default": args.default, "dhcpOptionsId": args.dhcpOptionsId, "filters": args.filters, "id": args.id, "region": args.region, "state": args.state, "tags": args.tags, }, opts); } exports.getVpcOutput = getVpcOutput; //# sourceMappingURL=getVpc.js.map