UNPKG

@pulumi/aws

Version:

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

124 lines 3.93 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.getVpcsOutput = exports.getVpcs = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * This resource can be useful for getting back a list of VPC Ids for a region. * * The following example retrieves a list of VPC Ids with a custom tag of `service` set to a value of "production". * * ## Example Usage * * The following shows outputting all VPC Ids. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * export = async () => { * const foo = await aws.ec2.getVpcs({ * tags: { * service: "production", * }, * }); * return { * foo: foo.ids, * }; * } * ``` * * An example use case would be interpolate the `aws.ec2.getVpcs` output into `count` of an aws.ec2.FlowLog resource. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * export = async () => { * const foo = await aws.ec2.getVpcs({}); * const fooGetVpc = .map(__index => (await aws.ec2.getVpc({ * id: foo.ids[__index], * }))); * const testFlowLog: aws.ec2.FlowLog[] = []; * foo.ids.length.apply(rangeBody => { * for (const range = {value: 0}; range.value < rangeBody; range.value++) { * testFlowLog.push(new aws.ec2.FlowLog(`test_flow_log-${range.value}`, {vpcId: fooGetVpc.apply(fooGetVpc => fooGetVpc[range.value].id)})); * } * }); * return { * foo: foo.ids, * }; * } * ``` */ function getVpcs(args, opts) { args = args || {}; opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invoke("aws:ec2/getVpcs:getVpcs", { "filters": args.filters, "region": args.region, "tags": args.tags, }, opts); } exports.getVpcs = getVpcs; /** * This resource can be useful for getting back a list of VPC Ids for a region. * * The following example retrieves a list of VPC Ids with a custom tag of `service` set to a value of "production". * * ## Example Usage * * The following shows outputting all VPC Ids. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * export = async () => { * const foo = await aws.ec2.getVpcs({ * tags: { * service: "production", * }, * }); * return { * foo: foo.ids, * }; * } * ``` * * An example use case would be interpolate the `aws.ec2.getVpcs` output into `count` of an aws.ec2.FlowLog resource. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * export = async () => { * const foo = await aws.ec2.getVpcs({}); * const fooGetVpc = .map(__index => (await aws.ec2.getVpc({ * id: foo.ids[__index], * }))); * const testFlowLog: aws.ec2.FlowLog[] = []; * foo.ids.length.apply(rangeBody => { * for (const range = {value: 0}; range.value < rangeBody; range.value++) { * testFlowLog.push(new aws.ec2.FlowLog(`test_flow_log-${range.value}`, {vpcId: fooGetVpc.apply(fooGetVpc => fooGetVpc[range.value].id)})); * } * }); * return { * foo: foo.ids, * }; * } * ``` */ function getVpcsOutput(args, opts) { args = args || {}; opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invokeOutput("aws:ec2/getVpcs:getVpcs", { "filters": args.filters, "region": args.region, "tags": args.tags, }, opts); } exports.getVpcsOutput = getVpcsOutput; //# sourceMappingURL=getVpcs.js.map