title: "getVpc" title_tag: "huaweicloud.Vpc.getVpc" meta_desc: "Documentation for the huaweicloud.Vpc.getVpc function with examples, input properties, output properties, and supporting types." layout: api no_edit_this_page: true


Provides details about a specific VPC.

## Example Usage
using System.Collections.Generic;
using Pulumi;
using Huaweicloud = Pulumi.Huaweicloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var vpcName = config.RequireObject<dynamic>("vpcName");
    var vpc = Huaweicloud.Vpc.GetVpc.Invoke(new()
    {
        Name = vpcName,
    });

});
package main

import (
    "github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
    "github.com/pulumi/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        cfg := config.New(ctx, "")
        vpcName := cfg.RequireObject("vpcName")
        _, err := Vpc.GetVpc(ctx, &vpc.GetVpcArgs{
            Name: pulumi.StringRef(vpcName),
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.huaweicloud.Vpc.VpcFunctions;
import com.pulumi.huaweicloud.Iec.inputs.GetVpcArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var config = ctx.config();
        final var vpcName = config.get("vpcName");
        final var vpc = VpcFunctions.getVpc(GetVpcArgs.builder()
            .name(vpcName)
            .build());

    }
}
import pulumi
import pulumi_huaweicloud as huaweicloud

config = pulumi.Config()
vpc_name = config.require_object("vpcName")
vpc = huaweicloud.Vpc.get_vpc(name=vpc_name)
import * as pulumi from "@pulumi/pulumi";
import * as huaweicloud from "@pulumi/huaweicloud";

const config = new pulumi.Config();
const vpcName = config.requireObject("vpcName");
const vpc = huaweicloud.Vpc.getVpc({
    name: vpcName,
});
configuration:
  vpcName:
    type: dynamic
variables:
  vpc:
    Fn::Invoke:
      Function: huaweicloud:Vpc:getVpc
      Arguments:
        name: ${vpcName}

Using getVpc {#using}

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: Optional[str] = None,
            enterprise_project_id: Optional[str] = None,
            id: Optional[str] = None,
            name: Optional[str] = None,
            region: Optional[str] = None,
            status: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> GetVpcResult
def get_vpc_output(cidr: Optional[pulumi.Input[str]] = None,
            enterprise_project_id: Optional[pulumi.Input[str]] = None,
            id: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            region: Optional[pulumi.Input[str]] = None,
            status: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetVpcResult]
func GetVpc(ctx *Context, args *GetVpcArgs, opts ...InvokeOption) (*GetVpcResult, error)
func GetVpcOutput(ctx *Context, args *GetVpcOutputArgs, opts ...InvokeOption) GetVpcResultOutput

> Note: This function is named GetVpc 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: huaweicloud:Vpc/getVpc:getVpc
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Cidr string

Specifies the cidr block of the desired VPC.

EnterpriseProjectId string
Id string

Specifies the id of the VPC to retrieve.

Name string

Specifies an unique name for the VPC. The value is a string of no more than 64 characters and can contain digits, letters, underscores (_), and hyphens (-).

Region string

Specifies the region in which to obtain the VPC. If omitted, the provider-level region will be used.

Status string

Specifies the current status of the desired VPC. The value can be CREATING, OK or ERROR.

Cidr string

Specifies the cidr block of the desired VPC.

EnterpriseProjectId string
Id string

Specifies the id of the VPC to retrieve.

Name string

Specifies an unique name for the VPC. The value is a string of no more than 64 characters and can contain digits, letters, underscores (_), and hyphens (-).

Region string

Specifies the region in which to obtain the VPC. If omitted, the provider-level region will be used.

Status string

Specifies the current status of the desired VPC. The value can be CREATING, OK or ERROR.

cidr String

Specifies the cidr block of the desired VPC.

enterpriseProjectId String
id String

Specifies the id of the VPC to retrieve.

name String

Specifies an unique name for the VPC. The value is a string of no more than 64 characters and can contain digits, letters, underscores (_), and hyphens (-).

region String

Specifies the region in which to obtain the VPC. If omitted, the provider-level region will be used.

status String

Specifies the current status of the desired VPC. The value can be CREATING, OK or ERROR.

cidr string

Specifies the cidr block of the desired VPC.

enterpriseProjectId string
id string

Specifies the id of the VPC to retrieve.

name string

Specifies an unique name for the VPC. The value is a string of no more than 64 characters and can contain digits, letters, underscores (_), and hyphens (-).

region string

Specifies the region in which to obtain the VPC. If omitted, the provider-level region will be used.

status string

Specifies the current status of the desired VPC. The value can be CREATING, OK or ERROR.

cidr str

Specifies the cidr block of the desired VPC.

enterprise_project_id str
id str

Specifies the id of the VPC to retrieve.

name str

Specifies an unique name for the VPC. The value is a string of no more than 64 characters and can contain digits, letters, underscores (_), and hyphens (-).

region str

Specifies the region in which to obtain the VPC. If omitted, the provider-level region will be used.

status str

Specifies the current status of the desired VPC. The value can be CREATING, OK or ERROR.

cidr String

Specifies the cidr block of the desired VPC.

enterpriseProjectId String
id String

Specifies the id of the VPC to retrieve.

name String

Specifies an unique name for the VPC. The value is a string of no more than 64 characters and can contain digits, letters, underscores (_), and hyphens (-).

region String

Specifies the region in which to obtain the VPC. If omitted, the provider-level region will be used.

status String

Specifies the current status of the desired VPC. The value can be CREATING, OK or ERROR.

getVpc Result {#result}

The following output properties are available:

Cidr string
Description string

The supplementary information about the VPC. The value is a string of no more than 255 characters and cannot contain angle brackets (< or >).

EnterpriseProjectId string
Id string
Name string
Region string
Routes List<GetVpcRoute>

Deprecated:

use huaweicloud_vpc_route_table data source to get all routes

Status string
Tags Dictionary<string, string>

The key/value pairs to associate with the VPC.

Cidr string
Description string

The supplementary information about the VPC. The value is a string of no more than 255 characters and cannot contain angle brackets (< or >).

EnterpriseProjectId string
Id string
Name string
Region string
Routes []GetVpcRoute

Deprecated:

use huaweicloud_vpc_route_table data source to get all routes

Status string
Tags map[string]string

The key/value pairs to associate with the VPC.

cidr String
description String

The supplementary information about the VPC. The value is a string of no more than 255 characters and cannot contain angle brackets (< or >).

enterpriseProjectId String
id String
name String
region String
routes List<GetRoute>

Deprecated:

use huaweicloud_vpc_route_table data source to get all routes

status String
tags Map<String,String>

The key/value pairs to associate with the VPC.

cidr string
description string

The supplementary information about the VPC. The value is a string of no more than 255 characters and cannot contain angle brackets (< or >).

enterpriseProjectId string
id string
name string
region string
routes GetVpcRoute[]

Deprecated:

use huaweicloud_vpc_route_table data source to get all routes

status string
tags {[key: string]: string}

The key/value pairs to associate with the VPC.

cidr str
description str

The supplementary information about the VPC. The value is a string of no more than 255 characters and cannot contain angle brackets (< or >).

enterprise_project_id str
id str
name str
region str
routes GetVpcRoute]

Deprecated:

use huaweicloud_vpc_route_table data source to get all routes

status str
tags Mapping[str, str]

The key/value pairs to associate with the VPC.

cidr String
description String

The supplementary information about the VPC. The value is a string of no more than 255 characters and cannot contain angle brackets (< or >).

enterpriseProjectId String
id String
name String
region String
routes List<Property Map>

Deprecated:

use huaweicloud_vpc_route_table data source to get all routes

status String
tags Map<String>

The key/value pairs to associate with the VPC.

Supporting Types

GetVpcRoute

Destination string
Nexthop string
Destination string
Nexthop string
destination String
nexthop String
destination string
nexthop string
destination String
nexthop String

Package Details

Repository
https://github.com/huaweicloud/pulumi-huaweicloud
License
Apache-2.0
Notes

This Pulumi package is based on the huaweicloud Terraform Provider.