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
Coming soon!
Coming soon!
Coming soon!
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const vpcId = config.require("vpcId");
const selected = pulumi.output(aws.ec2.getVpc({
id: vpcId,
}, { async: true }));
const example = new aws.ec2.Subnet("example", {
availabilityZone: "us-west-2a",
cidrBlock: selected.apply(selected => (() => {
throw "tf2pulumi error: NYI: call to cidrsubnet";
return (() => { throw "NYI: call to cidrsubnet"; })();
})()),
vpcId: selected.id,
});Using GetVpc
function getVpc(args: GetVpcArgs, opts?: InvokeOptions): Promise<GetVpcResult>function get_vpc(cidr_block=None, default=None, dhcp_options_id=None, filters=None, id=None, state=None, tags=None, opts=None)func LookupVpc(ctx *Context, args *LookupVpcArgs, opts ...InvokeOption) (*LookupVpcResult, error)Note: This function is named
LookupVpcin the Go SDK.
public static class GetVpc {
public static Task<GetVpcResult> InvokeAsync(GetVpcArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Cidr
Block string The cidr block of the desired VPC.
- Default bool
Boolean constraint on whether the desired VPC is the default VPC for the region.
- Dhcp
Options stringId The DHCP options id of the desired VPC.
- Filters
List<Get
Vpc Filter Args> Custom filter block as described below.
- Id string
The id of the specific VPC to retrieve.
- State string
The current state of the desired VPC. Can be either
"pending"or"available".- Dictionary<string, string>
A map of tags, each pair of which must exactly match a pair on the desired VPC.
- Cidr
Block string The cidr block of the desired VPC.
- Default bool
Boolean constraint on whether the desired VPC is the default VPC for the region.
- Dhcp
Options stringId The DHCP options id of the desired VPC.
- Filters
[]Get
Vpc Filter Custom filter block as described below.
- Id string
The id of the specific VPC to retrieve.
- State string
The current state of the desired VPC. Can be either
"pending"or"available".- map[string]string
A map of tags, each pair of which must exactly match a pair on the desired VPC.
- cidr
Block string The cidr block of the desired VPC.
- default boolean
Boolean constraint on whether the desired VPC is the default VPC for the region.
- dhcp
Options stringId The DHCP options id of the desired VPC.
- filters
Get
Vpc Filter[] Custom filter block as described below.
- id string
The id of the specific VPC to retrieve.
- state string
The current state of the desired VPC. Can be either
"pending"or"available".- {[key: string]: string}
A map of tags, each pair of which must exactly match a pair on the desired VPC.
- cidr_
block str The cidr block of the desired VPC.
- default bool
Boolean constraint on whether the desired VPC is the default VPC for the region.
- dhcp_
options_ strid The DHCP options id of the desired VPC.
- filters
List[Get
Vpc Filter] Custom filter block as described below.
- id str
The id of the specific VPC to retrieve.
- state str
The current state of the desired VPC. Can be either
"pending"or"available".- Dict[str, str]
A map of tags, each pair of which must exactly match a pair on the desired VPC.
GetVpc Result
The following output properties are available:
- Arn string
Amazon Resource Name (ARN) of VPC
- Cidr
Block string The CIDR block for the association.
- Cidr
Block List<GetAssociations Vpc Cidr Block Association> - Default bool
- Dhcp
Options stringId - Enable
Dns boolHostnames Whether or not the VPC has DNS hostname support
- Enable
Dns boolSupport Whether or not the VPC has DNS support
- Id string
- Instance
Tenancy string The allowed tenancy of instances launched into the selected VPC. May be any of
"default","dedicated", or"host".- Ipv6Association
Id string The association ID for the IPv6 CIDR block.
- Ipv6Cidr
Block string The IPv6 CIDR block.
- Main
Route stringTable Id The ID of the main route table associated with this VPC.
- Owner
Id string The ID of the AWS account that owns the VPC.
- State string
The State of the association.
- Dictionary<string, string>
- Filters
List<Get
Vpc Filter>
- Arn string
Amazon Resource Name (ARN) of VPC
- Cidr
Block string The CIDR block for the association.
- Cidr
Block []GetAssociations Vpc Cidr Block Association - Default bool
- Dhcp
Options stringId - Enable
Dns boolHostnames Whether or not the VPC has DNS hostname support
- Enable
Dns boolSupport Whether or not the VPC has DNS support
- Id string
- Instance
Tenancy string The allowed tenancy of instances launched into the selected VPC. May be any of
"default","dedicated", or"host".- Ipv6Association
Id string The association ID for the IPv6 CIDR block.
- Ipv6Cidr
Block string The IPv6 CIDR block.
- Main
Route stringTable Id The ID of the main route table associated with this VPC.
- Owner
Id string The ID of the AWS account that owns the VPC.
- State string
The State of the association.
- map[string]string
- Filters
[]Get
Vpc Filter
- arn string
Amazon Resource Name (ARN) of VPC
- cidr
Block string The CIDR block for the association.
- cidr
Block GetAssociations Vpc Cidr Block Association[] - default boolean
- dhcp
Options stringId - enable
Dns booleanHostnames Whether or not the VPC has DNS hostname support
- enable
Dns booleanSupport Whether or not the VPC has DNS support
- id string
- instance
Tenancy string The allowed tenancy of instances launched into the selected VPC. May be any of
"default","dedicated", or"host".- ipv6Association
Id string The association ID for the IPv6 CIDR block.
- ipv6Cidr
Block string The IPv6 CIDR block.
- main
Route stringTable Id The ID of the main route table associated with this VPC.
- owner
Id string The ID of the AWS account that owns the VPC.
- state string
The State of the association.
- {[key: string]: string}
- filters
Get
Vpc Filter[]
- arn str
Amazon Resource Name (ARN) of VPC
- cidr_
block str The CIDR block for the association.
- cidr_
block_ List[Getassociations Vpc Cidr Block Association] - default bool
- dhcp_
options_ strid - enable_
dns_ boolhostnames Whether or not the VPC has DNS hostname support
- enable_
dns_ boolsupport Whether or not the VPC has DNS support
- id str
- instance_
tenancy str The allowed tenancy of instances launched into the selected VPC. May be any of
"default","dedicated", or"host".- ipv6_
association_ strid The association ID for the IPv6 CIDR block.
- ipv6_
cidr_ strblock The IPv6 CIDR block.
- main_
route_ strtable_ id The ID of the main route table associated with this VPC.
- owner_
id str The ID of the AWS account that owns the VPC.
- state str
The State of the association.
- Dict[str, str]
- filters
List[Get
Vpc Filter]
Supporting Types
GetVpcCidrBlockAssociation
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- association_
id str The association ID for the the IPv4 CIDR block.
- cidr_
block str The cidr block of the desired VPC.
- state str
The current state of the desired VPC. Can be either
"pending"or"available".
GetVpcFilter
- Name string
The name of the field to filter by, as defined by the underlying AWS API.
- Values List<string>
Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
- Name string
The name of the field to filter by, as defined by the underlying AWS API.
- Values []string
Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
- name string
The name of the field to filter by, as defined by the underlying AWS API.
- values string[]
Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
- name str
The name of the field to filter by, as defined by the underlying AWS API.
- values List[str]
Set of values that are accepted for the given field. A VPC will be selected if any one of the given values matches.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.