1. Packages
  2. Strata Cloud Manager Provider
  3. API Docs
  4. getVariable
Strata Cloud Manager v0.4.3 published on Saturday, Nov 8, 2025 by Pulumi
scm logo
Strata Cloud Manager v0.4.3 published on Saturday, Nov 8, 2025 by Pulumi

    Variable data source

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scm from "@pulumi/scm";
    
    // Look up the "$example" variable by its name.
    const scmVariableDs = scm.getVariable({
        id: "66cbe56c-0300-4905-8455-d384978a0081",
    });
    export const variableOutputs = {
        exampleId: scmVariableDs.then(scmVariableDs => scmVariableDs.id),
        exampleName: scmVariableDs.then(scmVariableDs => scmVariableDs.name),
        exampleType: scmVariableDs.then(scmVariableDs => scmVariableDs.type),
        exampleValue: scmVariableDs.then(scmVariableDs => scmVariableDs.value),
    };
    
    import pulumi
    import pulumi_scm as scm
    
    # Look up the "$example" variable by its name.
    scm_variable_ds = scm.get_variable(id="66cbe56c-0300-4905-8455-d384978a0081")
    pulumi.export("variableOutputs", {
        "exampleId": scm_variable_ds.id,
        "exampleName": scm_variable_ds.name,
        "exampleType": scm_variable_ds.type,
        "exampleValue": scm_variable_ds.value,
    })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-scm/sdk/go/scm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Look up the "$example" variable by its name.
    		scmVariableDs, err := scm.LookupVariable(ctx, &scm.LookupVariableArgs{
    			Id: "66cbe56c-0300-4905-8455-d384978a0081",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("variableOutputs", pulumi.StringMap{
    			"exampleId":    scmVariableDs.Id,
    			"exampleName":  scmVariableDs.Name,
    			"exampleType":  scmVariableDs.Type,
    			"exampleValue": scmVariableDs.Value,
    		})
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scm = Pulumi.Scm;
    
    return await Deployment.RunAsync(() => 
    {
        // Look up the "$example" variable by its name.
        var scmVariableDs = Scm.GetVariable.Invoke(new()
        {
            Id = "66cbe56c-0300-4905-8455-d384978a0081",
        });
    
        return new Dictionary<string, object?>
        {
            ["variableOutputs"] = 
            {
                { "exampleId", scmVariableDs.Apply(getVariableResult => getVariableResult.Id) },
                { "exampleName", scmVariableDs.Apply(getVariableResult => getVariableResult.Name) },
                { "exampleType", scmVariableDs.Apply(getVariableResult => getVariableResult.Type) },
                { "exampleValue", scmVariableDs.Apply(getVariableResult => getVariableResult.Value) },
            },
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scm.ScmFunctions;
    import com.pulumi.scm.inputs.GetVariableArgs;
    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) {
            // Look up the "$example" variable by its name.
            final var scmVariableDs = ScmFunctions.getVariable(GetVariableArgs.builder()
                .id("66cbe56c-0300-4905-8455-d384978a0081")
                .build());
    
            ctx.export("variableOutputs", Map.ofEntries(
                Map.entry("exampleId", scmVariableDs.id()),
                Map.entry("exampleName", scmVariableDs.name()),
                Map.entry("exampleType", scmVariableDs.type()),
                Map.entry("exampleValue", scmVariableDs.value())
            ));
        }
    }
    
    variables:
      # Look up the "$example" variable by its name.
      scmVariableDs:
        fn::invoke:
          function: scm:getVariable
          arguments:
            id: 66cbe56c-0300-4905-8455-d384978a0081
    outputs:
      # Output the details of the found variable to verify they were read correctly.
      variableOutputs:
        exampleId: ${scmVariableDs.id}
        exampleName: ${scmVariableDs.name}
        exampleType: ${scmVariableDs.type}
        exampleValue: ${scmVariableDs.value}
    

    Using getVariable

    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 getVariable(args: GetVariableArgs, opts?: InvokeOptions): Promise<GetVariableResult>
    function getVariableOutput(args: GetVariableOutputArgs, opts?: InvokeOptions): Output<GetVariableResult>
    def get_variable(id: Optional[str] = None,
                     name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetVariableResult
    def get_variable_output(id: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetVariableResult]
    func LookupVariable(ctx *Context, args *LookupVariableArgs, opts ...InvokeOption) (*LookupVariableResult, error)
    func LookupVariableOutput(ctx *Context, args *LookupVariableOutputArgs, opts ...InvokeOption) LookupVariableResultOutput

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

    public static class GetVariable 
    {
        public static Task<GetVariableResult> InvokeAsync(GetVariableArgs args, InvokeOptions? opts = null)
        public static Output<GetVariableResult> Invoke(GetVariableInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVariableResult> getVariable(GetVariableArgs args, InvokeOptions options)
    public static Output<GetVariableResult> getVariable(GetVariableArgs args, InvokeOptions options)
    
    fn::invoke:
      function: scm:index/getVariable:getVariable
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    UUID of the variable
    Name string
    The name of the variable
    Id string
    UUID of the variable
    Name string
    The name of the variable
    id String
    UUID of the variable
    name String
    The name of the variable
    id string
    UUID of the variable
    name string
    The name of the variable
    id str
    UUID of the variable
    name str
    The name of the variable
    id String
    UUID of the variable
    name String
    The name of the variable

    getVariable Result

    The following output properties are available:

    Description string
    The description of the variable
    Device string
    The device in which the resource is defined
    Folder string
    The folder in which the resource is defined
    Id string
    UUID of the variable
    Name string
    The name of the variable
    Overridden bool
    Is the variable overridden?
    Snippet string
    The snippet in which the resource is defined
    Tfid string
    Type string
    The variable type
    Value string
    The value of the variable
    Description string
    The description of the variable
    Device string
    The device in which the resource is defined
    Folder string
    The folder in which the resource is defined
    Id string
    UUID of the variable
    Name string
    The name of the variable
    Overridden bool
    Is the variable overridden?
    Snippet string
    The snippet in which the resource is defined
    Tfid string
    Type string
    The variable type
    Value string
    The value of the variable
    description String
    The description of the variable
    device String
    The device in which the resource is defined
    folder String
    The folder in which the resource is defined
    id String
    UUID of the variable
    name String
    The name of the variable
    overridden Boolean
    Is the variable overridden?
    snippet String
    The snippet in which the resource is defined
    tfid String
    type String
    The variable type
    value String
    The value of the variable
    description string
    The description of the variable
    device string
    The device in which the resource is defined
    folder string
    The folder in which the resource is defined
    id string
    UUID of the variable
    name string
    The name of the variable
    overridden boolean
    Is the variable overridden?
    snippet string
    The snippet in which the resource is defined
    tfid string
    type string
    The variable type
    value string
    The value of the variable
    description str
    The description of the variable
    device str
    The device in which the resource is defined
    folder str
    The folder in which the resource is defined
    id str
    UUID of the variable
    name str
    The name of the variable
    overridden bool
    Is the variable overridden?
    snippet str
    The snippet in which the resource is defined
    tfid str
    type str
    The variable type
    value str
    The value of the variable
    description String
    The description of the variable
    device String
    The device in which the resource is defined
    folder String
    The folder in which the resource is defined
    id String
    UUID of the variable
    name String
    The name of the variable
    overridden Boolean
    Is the variable overridden?
    snippet String
    The snippet in which the resource is defined
    tfid String
    type String
    The variable type
    value String
    The value of the variable

    Package Details

    Repository
    scm pulumi/pulumi-scm
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scm Terraform Provider.
    scm logo
    Strata Cloud Manager v0.4.3 published on Saturday, Nov 8, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate