Try AWS Native preview for resources not in the classic version.
aws.ec2.getVpc
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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.
Using getVpc
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getVpc(args: GetVpcArgs, opts?: InvokeOptions): Promise<GetVpcResult>
function getVpcOutput(args: GetVpcOutputArgs, opts?: InvokeOptions): Output<GetVpcResult>
def get_vpc(cidr_block: Optional[str] = None,
default: Optional[bool] = None,
dhcp_options_id: Optional[str] = None,
filters: Optional[Sequence[GetVpcFilter]] = None,
id: Optional[str] = None,
state: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetVpcResult
def get_vpc_output(cidr_block: Optional[pulumi.Input[str]] = None,
default: Optional[pulumi.Input[bool]] = None,
dhcp_options_id: Optional[pulumi.Input[str]] = None,
filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcFilterArgs]]]] = None,
id: Optional[pulumi.Input[str]] = None,
state: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetVpcResult]
func LookupVpc(ctx *Context, args *LookupVpcArgs, opts ...InvokeOption) (*LookupVpcResult, error)
func LookupVpcOutput(ctx *Context, args *LookupVpcOutputArgs, opts ...InvokeOption) LookupVpcResultOutput
> Note: This function is named LookupVpc
in the Go SDK.
public static class GetVpc
{
public static Task<GetVpcResult> InvokeAsync(GetVpcArgs args, InvokeOptions? opts = null)
public static Output<GetVpcResult> Invoke(GetVpcInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetVpcResult> getVpc(GetVpcArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:ec2/getVpc:getVpc
arguments:
# arguments dictionary
The following arguments are supported:
- Cidr
Block string 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 DHCP options id of the desired VPC.
- Filters
List<Get
Vpc Filter> Custom filter block as described below.
- Id string
ID of the specific VPC to retrieve.
- State string
Current state of the desired VPC. Can be either
"pending"
or"available"
.- Dictionary<string, string>
Map of tags, each pair of which must exactly match a pair on the desired VPC.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:
- Cidr
Block string 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 DHCP options id of the desired VPC.
- Filters
[]Get
Vpc Filter Custom filter block as described below.
- Id string
ID of the specific VPC to retrieve.
- State string
Current state of the desired VPC. Can be either
"pending"
or"available"
.- map[string]string
Map of tags, each pair of which must exactly match a pair on the desired VPC.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:
- cidr
Block String 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 DHCP options id of the desired VPC.
- filters
List<Get
Vpc Filter> Custom filter block as described below.
- id String
ID of the specific VPC to retrieve.
- state String
Current state of the desired VPC. Can be either
"pending"
or"available"
.- Map<String,String>
Map of tags, each pair of which must exactly match a pair on the desired VPC.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:
- cidr
Block string 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 DHCP options id of the desired VPC.
- filters
Get
Vpc Filter[] Custom filter block as described below.
- id string
ID of the specific VPC to retrieve.
- state string
Current state of the desired VPC. Can be either
"pending"
or"available"
.- {[key: string]: string}
Map of tags, each pair of which must exactly match a pair on the desired VPC.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:
- cidr_
block str 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 DHCP options id of the desired VPC.
- filters
Sequence[Get
Vpc Filter] Custom filter block as described below.
- id str
ID of the specific VPC to retrieve.
- state str
Current state of the desired VPC. Can be either
"pending"
or"available"
.- Mapping[str, str]
Map of tags, each pair of which must exactly match a pair on the desired VPC.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:
- cidr
Block String 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 DHCP options id of the desired VPC.
- filters List<Property Map>
Custom filter block as described below.
- id String
ID of the specific VPC to retrieve.
- state String
Current state of the desired VPC. Can be either
"pending"
or"available"
.- Map<String>
Map of tags, each pair of which must exactly match a pair on the desired VPC.
More complex filters can be expressed using one or more
filter
sub-blocks, which take the following arguments:
getVpc Result
The following output properties are available:
- Arn string
ARN of VPC
- Cidr
Block string 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
- Enable
Network boolAddress Usage Metrics Whether Network Address Usage metrics are enabled for your VPC
- Id string
- Instance
Tenancy string Allowed tenancy of instances launched into the selected VPC. May be any of
"default"
,"dedicated"
, or"host"
.- Ipv6Association
Id string Association ID for the IPv6 CIDR block.
- Ipv6Cidr
Block string IPv6 CIDR block.
- Main
Route stringTable Id ID of the main route table associated with this VPC.
- Owner
Id string ID of the AWS account that owns the VPC.
- State string
State of the association.
- Dictionary<string, string>
- Filters
List<Get
Vpc Filter>
- Arn string
ARN of VPC
- Cidr
Block string 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
- Enable
Network boolAddress Usage Metrics Whether Network Address Usage metrics are enabled for your VPC
- Id string
- Instance
Tenancy string Allowed tenancy of instances launched into the selected VPC. May be any of
"default"
,"dedicated"
, or"host"
.- Ipv6Association
Id string Association ID for the IPv6 CIDR block.
- Ipv6Cidr
Block string IPv6 CIDR block.
- Main
Route stringTable Id ID of the main route table associated with this VPC.
- Owner
Id string ID of the AWS account that owns the VPC.
- State string
State of the association.
- map[string]string
- Filters
[]Get
Vpc Filter
- arn String
ARN of VPC
- cidr
Block String CIDR block for the association.
- cidr
Block List<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
- enable
Network BooleanAddress Usage Metrics Whether Network Address Usage metrics are enabled for your VPC
- id String
- instance
Tenancy String Allowed tenancy of instances launched into the selected VPC. May be any of
"default"
,"dedicated"
, or"host"
.- ipv6Association
Id String Association ID for the IPv6 CIDR block.
- ipv6Cidr
Block String IPv6 CIDR block.
- main
Route StringTable Id ID of the main route table associated with this VPC.
- owner
Id String ID of the AWS account that owns the VPC.
- state String
State of the association.
- Map<String,String>
- filters
List<Get
Vpc Filter>
- arn string
ARN of VPC
- cidr
Block string 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
- enable
Network booleanAddress Usage Metrics Whether Network Address Usage metrics are enabled for your VPC
- id string
- instance
Tenancy string Allowed tenancy of instances launched into the selected VPC. May be any of
"default"
,"dedicated"
, or"host"
.- ipv6Association
Id string Association ID for the IPv6 CIDR block.
- ipv6Cidr
Block string IPv6 CIDR block.
- main
Route stringTable Id ID of the main route table associated with this VPC.
- owner
Id string ID of the AWS account that owns the VPC.
- state string
State of the association.
- {[key: string]: string}
- filters
Get
Vpc Filter[]
- arn str
ARN of VPC
- cidr_
block str CIDR block for the association.
- cidr_
block_ Sequence[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
- enable_
network_ booladdress_ usage_ metrics Whether Network Address Usage metrics are enabled for your VPC
- id str
- instance_
tenancy str Allowed tenancy of instances launched into the selected VPC. May be any of
"default"
,"dedicated"
, or"host"
.- ipv6_
association_ strid Association ID for the IPv6 CIDR block.
- ipv6_
cidr_ strblock IPv6 CIDR block.
- main_
route_ strtable_ id ID of the main route table associated with this VPC.
- owner_
id str ID of the AWS account that owns the VPC.
- state str
State of the association.
- Mapping[str, str]
- filters
Sequence[Get
Vpc Filter]
- arn String
ARN of VPC
- cidr
Block String CIDR block for the association.
- cidr
Block List<Property Map>Associations - 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
- enable
Network BooleanAddress Usage Metrics Whether Network Address Usage metrics are enabled for your VPC
- id String
- instance
Tenancy String Allowed tenancy of instances launched into the selected VPC. May be any of
"default"
,"dedicated"
, or"host"
.- ipv6Association
Id String Association ID for the IPv6 CIDR block.
- ipv6Cidr
Block String IPv6 CIDR block.
- main
Route StringTable Id ID of the main route table associated with this VPC.
- owner
Id String ID of the AWS account that owns the VPC.
- state String
State of the association.
- Map<String>
- filters List<Property Map>
Supporting Types
GetVpcCidrBlockAssociation
- Association
Id string Association ID for the IPv4 CIDR block.
- Cidr
Block string Cidr block of the desired VPC.
- State string
Current state of the desired VPC. Can be either
"pending"
or"available"
.
- Association
Id string Association ID for the IPv4 CIDR block.
- Cidr
Block string Cidr block of the desired VPC.
- State string
Current state of the desired VPC. Can be either
"pending"
or"available"
.
- association
Id String Association ID for the IPv4 CIDR block.
- cidr
Block String Cidr block of the desired VPC.
- state String
Current state of the desired VPC. Can be either
"pending"
or"available"
.
- association
Id string Association ID for the IPv4 CIDR block.
- cidr
Block string Cidr block of the desired VPC.
- state string
Current state of the desired VPC. Can be either
"pending"
or"available"
.
- association_
id str Association ID for the IPv4 CIDR block.
- cidr_
block str Cidr block of the desired VPC.
- state str
Current state of the desired VPC. Can be either
"pending"
or"available"
.
- association
Id String Association ID for the IPv4 CIDR block.
- cidr
Block String Cidr block of the desired VPC.
- state String
Current state of the desired VPC. Can be either
"pending"
or"available"
.
GetVpcFilter
- Name string
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
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
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
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
Name of the field to filter by, as defined by the underlying AWS API.
- values Sequence[str]
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
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.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.