1. Packages
  2. Packages
  3. Vcd Provider
  4. API Docs
  5. getVersion
Viewing docs for vcd 3.14.2
published on Saturday, Jul 11, 2026 by vmware
Viewing docs for vcd 3.14.2
published on Saturday, Jul 11, 2026 by vmware

    Provides a VMware Cloud Director version data source to fetch the VCD version, the maximum supported API version and perform some optional checks with version constraints.

    Supported in provider v3.12+. Requires System Administrator privileges.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vcd from "@pulumi/vcd";
    
    // This data source will assert that the VCD version is exactly 10.5.1, otherwise it will fail
    const eq1051 = vcd.getVersion({
        condition: "= 10.5.1",
        failIfNotMatch: true,
    });
    // This data source will assert that the VCD version is greater than or equal to 10.4.2, but it won't fail if it is not
    const gte1042 = vcd.getVersion({
        condition: ">= 10.4.2",
        failIfNotMatch: false,
    });
    export const isGte1042 = gte1042.then(gte1042 => gte1042.matchesCondition);
    // This data source will assert that the VCD version is less than 10.5.0
    const lt1050 = vcd.getVersion({
        condition: "< 10.5.0",
        failIfNotMatch: true,
    });
    // This data source will assert that the VCD version is 10.5.X
    const is105 = vcd.getVersion({
        condition: "~> 10.5",
        failIfNotMatch: true,
    });
    // This data source will assert that the VCD version is not 10.5.1
    const not1051 = vcd.getVersion({
        condition: "!= 10.5.1",
        failIfNotMatch: true,
    });
    
    import pulumi
    import pulumi_vcd as vcd
    
    # This data source will assert that the VCD version is exactly 10.5.1, otherwise it will fail
    eq1051 = vcd.get_version(condition="= 10.5.1",
        fail_if_not_match=True)
    # This data source will assert that the VCD version is greater than or equal to 10.4.2, but it won't fail if it is not
    gte1042 = vcd.get_version(condition=">= 10.4.2",
        fail_if_not_match=False)
    pulumi.export("isGte1042", gte1042.matches_condition)
    # This data source will assert that the VCD version is less than 10.5.0
    lt1050 = vcd.get_version(condition="< 10.5.0",
        fail_if_not_match=True)
    # This data source will assert that the VCD version is 10.5.X
    is105 = vcd.get_version(condition="~> 10.5",
        fail_if_not_match=True)
    # This data source will assert that the VCD version is not 10.5.1
    not1051 = vcd.get_version(condition="!= 10.5.1",
        fail_if_not_match=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vcd/v3/vcd"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// This data source will assert that the VCD version is exactly 10.5.1, otherwise it will fail
    		_, err := vcd.GetVersion(ctx, &vcd.GetVersionArgs{
    			Condition:      pulumi.StringRef("= 10.5.1"),
    			FailIfNotMatch: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// This data source will assert that the VCD version is greater than or equal to 10.4.2, but it won't fail if it is not
    		gte1042, err := vcd.GetVersion(ctx, &vcd.GetVersionArgs{
    			Condition:      pulumi.StringRef(">= 10.4.2"),
    			FailIfNotMatch: pulumi.BoolRef(false),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("isGte1042", gte1042.MatchesCondition)
    		// This data source will assert that the VCD version is less than 10.5.0
    		_, err = vcd.GetVersion(ctx, &vcd.GetVersionArgs{
    			Condition:      pulumi.StringRef("< 10.5.0"),
    			FailIfNotMatch: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// This data source will assert that the VCD version is 10.5.X
    		_, err = vcd.GetVersion(ctx, &vcd.GetVersionArgs{
    			Condition:      pulumi.StringRef("~> 10.5"),
    			FailIfNotMatch: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// This data source will assert that the VCD version is not 10.5.1
    		_, err = vcd.GetVersion(ctx, &vcd.GetVersionArgs{
    			Condition:      pulumi.StringRef("!= 10.5.1"),
    			FailIfNotMatch: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vcd = Pulumi.Vcd;
    
    return await Deployment.RunAsync(() => 
    {
        // This data source will assert that the VCD version is exactly 10.5.1, otherwise it will fail
        var eq1051 = Vcd.GetVersion.Invoke(new()
        {
            Condition = "= 10.5.1",
            FailIfNotMatch = true,
        });
    
        // This data source will assert that the VCD version is greater than or equal to 10.4.2, but it won't fail if it is not
        var gte1042 = Vcd.GetVersion.Invoke(new()
        {
            Condition = ">= 10.4.2",
            FailIfNotMatch = false,
        });
    
        // This data source will assert that the VCD version is less than 10.5.0
        var lt1050 = Vcd.GetVersion.Invoke(new()
        {
            Condition = "< 10.5.0",
            FailIfNotMatch = true,
        });
    
        // This data source will assert that the VCD version is 10.5.X
        var is105 = Vcd.GetVersion.Invoke(new()
        {
            Condition = "~> 10.5",
            FailIfNotMatch = true,
        });
    
        // This data source will assert that the VCD version is not 10.5.1
        var not1051 = Vcd.GetVersion.Invoke(new()
        {
            Condition = "!= 10.5.1",
            FailIfNotMatch = true,
        });
    
        return new Dictionary<string, object?>
        {
            ["isGte1042"] = gte1042.Apply(getVersionResult => getVersionResult.MatchesCondition),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vcd.VcdFunctions;
    import com.pulumi.vcd.inputs.GetVersionArgs;
    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) {
            // This data source will assert that the VCD version is exactly 10.5.1, otherwise it will fail
            final var eq1051 = VcdFunctions.getVersion(GetVersionArgs.builder()
                .condition("= 10.5.1")
                .failIfNotMatch(true)
                .build());
    
            // This data source will assert that the VCD version is greater than or equal to 10.4.2, but it won't fail if it is not
            final var gte1042 = VcdFunctions.getVersion(GetVersionArgs.builder()
                .condition(">= 10.4.2")
                .failIfNotMatch(false)
                .build());
    
            ctx.export("isGte1042", gte1042.matchesCondition());
            // This data source will assert that the VCD version is less than 10.5.0
            final var lt1050 = VcdFunctions.getVersion(GetVersionArgs.builder()
                .condition("< 10.5.0")
                .failIfNotMatch(true)
                .build());
    
            // This data source will assert that the VCD version is 10.5.X
            final var is105 = VcdFunctions.getVersion(GetVersionArgs.builder()
                .condition("~> 10.5")
                .failIfNotMatch(true)
                .build());
    
            // This data source will assert that the VCD version is not 10.5.1
            final var not1051 = VcdFunctions.getVersion(GetVersionArgs.builder()
                .condition("!= 10.5.1")
                .failIfNotMatch(true)
                .build());
    
        }
    }
    
    variables:
      # This data source will assert that the VCD version is exactly 10.5.1, otherwise it will fail
      eq1051:
        fn::invoke:
          function: vcd:getVersion
          arguments:
            condition: = 10.5.1
            failIfNotMatch: true
      # This data source will assert that the VCD version is greater than or equal to 10.4.2, but it won't fail if it is not
      gte1042:
        fn::invoke:
          function: vcd:getVersion
          arguments:
            condition: '>= 10.4.2'
            failIfNotMatch: false
      # This data source will assert that the VCD version is less than 10.5.0
      lt1050:
        fn::invoke:
          function: vcd:getVersion
          arguments:
            condition: < 10.5.0
            failIfNotMatch: true
      # This data source will assert that the VCD version is 10.5.X
      is105:
        fn::invoke:
          function: vcd:getVersion
          arguments:
            condition: ~> 10.5
            failIfNotMatch: true
      # This data source will assert that the VCD version is not 10.5.1
      not1051:
        fn::invoke:
          function: vcd:getVersion
          arguments:
            condition: '!= 10.5.1'
            failIfNotMatch: true
    outputs:
      isGte1042: ${gte1042.matchesCondition}
    
    Example coming soon!
    

    Using getVersion

    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 getVersion(args: GetVersionArgs, opts?: InvokeOptions): Promise<GetVersionResult>
    function getVersionOutput(args: GetVersionOutputArgs, opts?: InvokeOptions): Output<GetVersionResult>
    def get_version(condition: Optional[str] = None,
                    fail_if_not_match: Optional[bool] = None,
                    id: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetVersionResult
    def get_version_output(condition: pulumi.Input[Optional[str]] = None,
                    fail_if_not_match: pulumi.Input[Optional[bool]] = None,
                    id: pulumi.Input[Optional[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetVersionResult]
    func GetVersion(ctx *Context, args *GetVersionArgs, opts ...InvokeOption) (*GetVersionResult, error)
    func GetVersionOutput(ctx *Context, args *GetVersionOutputArgs, opts ...InvokeOption) GetVersionResultOutput

    > Note: This function is named GetVersion in the Go SDK.

    public static class GetVersion 
    {
        public static Task<GetVersionResult> InvokeAsync(GetVersionArgs args, InvokeOptions? opts = null)
        public static Output<GetVersionResult> Invoke(GetVersionInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVersionResult> getVersion(GetVersionArgs args, InvokeOptions options)
    public static Output<GetVersionResult> getVersion(GetVersionArgs args, InvokeOptions options)
    
    fn::invoke:
      function: vcd:index/getVersion:getVersion
      arguments:
        # arguments dictionary
    data "vcd_get_version" "name" {
        # arguments
    }

    The following arguments are supported:

    Condition string
    A version constraint to check against the VCD version
    FailIfNotMatch bool
    Required if condition is set. Throws an error if the version constraint set in condition is not met
    Id string
    Condition string
    A version constraint to check against the VCD version
    FailIfNotMatch bool
    Required if condition is set. Throws an error if the version constraint set in condition is not met
    Id string
    condition string
    A version constraint to check against the VCD version
    fail_if_not_match bool
    Required if condition is set. Throws an error if the version constraint set in condition is not met
    id string
    condition String
    A version constraint to check against the VCD version
    failIfNotMatch Boolean
    Required if condition is set. Throws an error if the version constraint set in condition is not met
    id String
    condition string
    A version constraint to check against the VCD version
    failIfNotMatch boolean
    Required if condition is set. Throws an error if the version constraint set in condition is not met
    id string
    condition str
    A version constraint to check against the VCD version
    fail_if_not_match bool
    Required if condition is set. Throws an error if the version constraint set in condition is not met
    id str
    condition String
    A version constraint to check against the VCD version
    failIfNotMatch Boolean
    Required if condition is set. Throws an error if the version constraint set in condition is not met
    id String

    getVersion Result

    The following output properties are available:

    ApiVersion string
    The maximum supported API version
    Id string
    MatchesCondition bool
    It is true if the VCD version matches the constraint set in condition
    VcdVersion string
    The VCD version
    Condition string
    FailIfNotMatch bool
    ApiVersion string
    The maximum supported API version
    Id string
    MatchesCondition bool
    It is true if the VCD version matches the constraint set in condition
    VcdVersion string
    The VCD version
    Condition string
    FailIfNotMatch bool
    api_version string
    The maximum supported API version
    id string
    matches_condition bool
    It is true if the VCD version matches the constraint set in condition
    vcd_version string
    The VCD version
    condition string
    fail_if_not_match bool
    apiVersion String
    The maximum supported API version
    id String
    matchesCondition Boolean
    It is true if the VCD version matches the constraint set in condition
    vcdVersion String
    The VCD version
    condition String
    failIfNotMatch Boolean
    apiVersion string
    The maximum supported API version
    id string
    matchesCondition boolean
    It is true if the VCD version matches the constraint set in condition
    vcdVersion string
    The VCD version
    condition string
    failIfNotMatch boolean
    api_version str
    The maximum supported API version
    id str
    matches_condition bool
    It is true if the VCD version matches the constraint set in condition
    vcd_version str
    The VCD version
    condition str
    fail_if_not_match bool
    apiVersion String
    The maximum supported API version
    id String
    matchesCondition Boolean
    It is true if the VCD version matches the constraint set in condition
    vcdVersion String
    The VCD version
    condition String
    failIfNotMatch Boolean

    Package Details

    Repository
    vcd vmware/terraform-provider-vcd
    License
    Notes
    This Pulumi package is based on the vcd Terraform Provider.
    Viewing docs for vcd 3.14.2
    published on Saturday, Jul 11, 2026 by vmware

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial