1. Packages
  2. Vultr
  3. API Docs
  4. getVpc
Vultr v2.21.0 published on Wednesday, Jun 19, 2024 by dirien

vultr.getVpc

Explore with Pulumi AI

vultr logo
Vultr v2.21.0 published on Wednesday, Jun 19, 2024 by dirien

    Get information about a Vultr VPC.

    Example Usage

    Get the information for a VPC by description:

    import * as pulumi from "@pulumi/pulumi";
    import * as vultr from "@pulumi/vultr";
    
    const myVpc = vultr.getVpc({
        filters: [{
            name: "description",
            values: ["my-vpc-description"],
        }],
    });
    
    import pulumi
    import pulumi_vultr as vultr
    
    my_vpc = vultr.get_vpc(filters=[vultr.GetVpcFilterArgs(
        name="description",
        values=["my-vpc-description"],
    )])
    
    package main
    
    import (
    	"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vultr.LookupVpc(ctx, &vultr.LookupVpcArgs{
    			Filters: []vultr.GetVpcFilter{
    				{
    					Name: "description",
    					Values: []string{
    						"my-vpc-description",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vultr = Pulumi.Vultr;
    
    return await Deployment.RunAsync(() => 
    {
        var myVpc = Vultr.GetVpc.Invoke(new()
        {
            Filters = new[]
            {
                new Vultr.Inputs.GetVpcFilterInputArgs
                {
                    Name = "description",
                    Values = new[]
                    {
                        "my-vpc-description",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vultr.VultrFunctions;
    import com.pulumi.vultr.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 myVpc = VultrFunctions.getVpc(GetVpcArgs.builder()
                .filters(GetVpcFilterArgs.builder()
                    .name("description")
                    .values("my-vpc-description")
                    .build())
                .build());
    
        }
    }
    
    variables:
      myVpc:
        fn::invoke:
          Function: vultr:getVpc
          Arguments:
            filters:
              - name: description
                values:
                  - my-vpc-description
    

    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(filters: Optional[Sequence[GetVpcFilter]] = None,
                opts: Optional[InvokeOptions] = None) -> GetVpcResult
    def get_vpc_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcFilterArgs]]]] = 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: vultr:index/getVpc:getVpc
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<ediri.Vultr.Inputs.GetVpcFilter>
    Query parameters for finding VPCs.
    Filters []GetVpcFilter
    Query parameters for finding VPCs.
    filters List<GetVpcFilter>
    Query parameters for finding VPCs.
    filters GetVpcFilter[]
    Query parameters for finding VPCs.
    filters Sequence[GetVpcFilter]
    Query parameters for finding VPCs.
    filters List<Property Map>
    Query parameters for finding VPCs.

    getVpc Result

    The following output properties are available:

    DateCreated string
    The date the VPC was added to your Vultr account.
    Description string
    The VPC's description.
    Id string
    The provider-assigned unique ID for this managed resource.
    Region string
    The ID of the region that the VPC is in.
    V4Subnet string
    The IPv4 network address. For example: 10.1.1.0.
    V4SubnetMask int
    The number of bits for the netmask in CIDR notation. Example: 20
    Filters List<ediri.Vultr.Outputs.GetVpcFilter>
    DateCreated string
    The date the VPC was added to your Vultr account.
    Description string
    The VPC's description.
    Id string
    The provider-assigned unique ID for this managed resource.
    Region string
    The ID of the region that the VPC is in.
    V4Subnet string
    The IPv4 network address. For example: 10.1.1.0.
    V4SubnetMask int
    The number of bits for the netmask in CIDR notation. Example: 20
    Filters []GetVpcFilter
    dateCreated String
    The date the VPC was added to your Vultr account.
    description String
    The VPC's description.
    id String
    The provider-assigned unique ID for this managed resource.
    region String
    The ID of the region that the VPC is in.
    v4Subnet String
    The IPv4 network address. For example: 10.1.1.0.
    v4SubnetMask Integer
    The number of bits for the netmask in CIDR notation. Example: 20
    filters List<GetVpcFilter>
    dateCreated string
    The date the VPC was added to your Vultr account.
    description string
    The VPC's description.
    id string
    The provider-assigned unique ID for this managed resource.
    region string
    The ID of the region that the VPC is in.
    v4Subnet string
    The IPv4 network address. For example: 10.1.1.0.
    v4SubnetMask number
    The number of bits for the netmask in CIDR notation. Example: 20
    filters GetVpcFilter[]
    date_created str
    The date the VPC was added to your Vultr account.
    description str
    The VPC's description.
    id str
    The provider-assigned unique ID for this managed resource.
    region str
    The ID of the region that the VPC is in.
    v4_subnet str
    The IPv4 network address. For example: 10.1.1.0.
    v4_subnet_mask int
    The number of bits for the netmask in CIDR notation. Example: 20
    filters Sequence[GetVpcFilter]
    dateCreated String
    The date the VPC was added to your Vultr account.
    description String
    The VPC's description.
    id String
    The provider-assigned unique ID for this managed resource.
    region String
    The ID of the region that the VPC is in.
    v4Subnet String
    The IPv4 network address. For example: 10.1.1.0.
    v4SubnetMask Number
    The number of bits for the netmask in CIDR notation. Example: 20
    filters List<Property Map>

    Supporting Types

    GetVpcFilter

    Name string
    Attribute name to filter with.
    Values List<string>
    One or more values filter with.
    Name string
    Attribute name to filter with.
    Values []string
    One or more values filter with.
    name String
    Attribute name to filter with.
    values List<String>
    One or more values filter with.
    name string
    Attribute name to filter with.
    values string[]
    One or more values filter with.
    name str
    Attribute name to filter with.
    values Sequence[str]
    One or more values filter with.
    name String
    Attribute name to filter with.
    values List<String>
    One or more values filter with.

    Package Details

    Repository
    vultr dirien/pulumi-vultr
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vultr Terraform Provider.
    vultr logo
    Vultr v2.21.0 published on Wednesday, Jun 19, 2024 by dirien