1. Packages
  2. GitHub
  3. API Docs
  4. ActionsOrganizationVariable
GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi

github.ActionsOrganizationVariable

Explore with Pulumi AI

github logo
GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi

    This resource allows you to create and manage GitHub Actions variables within your GitHub organization. You must have write access to a repository to use this resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const exampleVariable = new github.ActionsOrganizationVariable("exampleVariable", {
        value: "example_variable_value",
        variableName: "example_variable_name",
        visibility: "private",
    });
    
    import pulumi
    import pulumi_github as github
    
    example_variable = github.ActionsOrganizationVariable("exampleVariable",
        value="example_variable_value",
        variable_name="example_variable_name",
        visibility="private")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := github.NewActionsOrganizationVariable(ctx, "exampleVariable", &github.ActionsOrganizationVariableArgs{
    			Value:        pulumi.String("example_variable_value"),
    			VariableName: pulumi.String("example_variable_name"),
    			Visibility:   pulumi.String("private"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleVariable = new Github.ActionsOrganizationVariable("exampleVariable", new()
        {
            Value = "example_variable_value",
            VariableName = "example_variable_name",
            Visibility = "private",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.ActionsOrganizationVariable;
    import com.pulumi.github.ActionsOrganizationVariableArgs;
    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) {
            var exampleVariable = new ActionsOrganizationVariable("exampleVariable", ActionsOrganizationVariableArgs.builder()        
                .value("example_variable_value")
                .variableName("example_variable_name")
                .visibility("private")
                .build());
    
        }
    }
    
    resources:
      exampleVariable:
        type: github:ActionsOrganizationVariable
        properties:
          value: example_variable_value
          variableName: example_variable_name
          visibility: private
    
    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const repo = github.getRepository({
        fullName: "my-org/repo",
    });
    const exampleVariable = new github.ActionsOrganizationVariable("exampleVariable", {
        variableName: "example_variable_name",
        visibility: "selected",
        value: "example_variable_value",
        selectedRepositoryIds: [repo.then(repo => repo.repoId)],
    });
    
    import pulumi
    import pulumi_github as github
    
    repo = github.get_repository(full_name="my-org/repo")
    example_variable = github.ActionsOrganizationVariable("exampleVariable",
        variable_name="example_variable_name",
        visibility="selected",
        value="example_variable_value",
        selected_repository_ids=[repo.repo_id])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		repo, err := github.LookupRepository(ctx, &github.LookupRepositoryArgs{
    			FullName: pulumi.StringRef("my-org/repo"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = github.NewActionsOrganizationVariable(ctx, "exampleVariable", &github.ActionsOrganizationVariableArgs{
    			VariableName: pulumi.String("example_variable_name"),
    			Visibility:   pulumi.String("selected"),
    			Value:        pulumi.String("example_variable_value"),
    			SelectedRepositoryIds: pulumi.IntArray{
    				*pulumi.Int(repo.RepoId),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var repo = Github.GetRepository.Invoke(new()
        {
            FullName = "my-org/repo",
        });
    
        var exampleVariable = new Github.ActionsOrganizationVariable("exampleVariable", new()
        {
            VariableName = "example_variable_name",
            Visibility = "selected",
            Value = "example_variable_value",
            SelectedRepositoryIds = new[]
            {
                repo.Apply(getRepositoryResult => getRepositoryResult.RepoId),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.GithubFunctions;
    import com.pulumi.github.inputs.GetRepositoryArgs;
    import com.pulumi.github.ActionsOrganizationVariable;
    import com.pulumi.github.ActionsOrganizationVariableArgs;
    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 repo = GithubFunctions.getRepository(GetRepositoryArgs.builder()
                .fullName("my-org/repo")
                .build());
    
            var exampleVariable = new ActionsOrganizationVariable("exampleVariable", ActionsOrganizationVariableArgs.builder()        
                .variableName("example_variable_name")
                .visibility("selected")
                .value("example_variable_value")
                .selectedRepositoryIds(repo.applyValue(getRepositoryResult -> getRepositoryResult.repoId()))
                .build());
    
        }
    }
    
    resources:
      exampleVariable:
        type: github:ActionsOrganizationVariable
        properties:
          variableName: example_variable_name
          visibility: selected
          value: example_variable_value
          selectedRepositoryIds:
            - ${repo.repoId}
    variables:
      repo:
        fn::invoke:
          Function: github:getRepository
          Arguments:
            fullName: my-org/repo
    

    Create ActionsOrganizationVariable Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ActionsOrganizationVariable(name: string, args: ActionsOrganizationVariableArgs, opts?: CustomResourceOptions);
    @overload
    def ActionsOrganizationVariable(resource_name: str,
                                    args: ActionsOrganizationVariableArgs,
                                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def ActionsOrganizationVariable(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    value: Optional[str] = None,
                                    variable_name: Optional[str] = None,
                                    visibility: Optional[str] = None,
                                    selected_repository_ids: Optional[Sequence[int]] = None)
    func NewActionsOrganizationVariable(ctx *Context, name string, args ActionsOrganizationVariableArgs, opts ...ResourceOption) (*ActionsOrganizationVariable, error)
    public ActionsOrganizationVariable(string name, ActionsOrganizationVariableArgs args, CustomResourceOptions? opts = null)
    public ActionsOrganizationVariable(String name, ActionsOrganizationVariableArgs args)
    public ActionsOrganizationVariable(String name, ActionsOrganizationVariableArgs args, CustomResourceOptions options)
    
    type: github:ActionsOrganizationVariable
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ActionsOrganizationVariableArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var actionsOrganizationVariableResource = new Github.ActionsOrganizationVariable("actionsOrganizationVariableResource", new()
    {
        Value = "string",
        VariableName = "string",
        Visibility = "string",
        SelectedRepositoryIds = new[]
        {
            0,
        },
    });
    
    example, err := github.NewActionsOrganizationVariable(ctx, "actionsOrganizationVariableResource", &github.ActionsOrganizationVariableArgs{
    	Value:        pulumi.String("string"),
    	VariableName: pulumi.String("string"),
    	Visibility:   pulumi.String("string"),
    	SelectedRepositoryIds: pulumi.IntArray{
    		pulumi.Int(0),
    	},
    })
    
    var actionsOrganizationVariableResource = new ActionsOrganizationVariable("actionsOrganizationVariableResource", ActionsOrganizationVariableArgs.builder()        
        .value("string")
        .variableName("string")
        .visibility("string")
        .selectedRepositoryIds(0)
        .build());
    
    actions_organization_variable_resource = github.ActionsOrganizationVariable("actionsOrganizationVariableResource",
        value="string",
        variable_name="string",
        visibility="string",
        selected_repository_ids=[0])
    
    const actionsOrganizationVariableResource = new github.ActionsOrganizationVariable("actionsOrganizationVariableResource", {
        value: "string",
        variableName: "string",
        visibility: "string",
        selectedRepositoryIds: [0],
    });
    
    type: github:ActionsOrganizationVariable
    properties:
        selectedRepositoryIds:
            - 0
        value: string
        variableName: string
        visibility: string
    

    ActionsOrganizationVariable Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ActionsOrganizationVariable resource accepts the following input properties:

    Value string
    Value of the variable
    VariableName string
    Name of the variable
    Visibility string
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    SelectedRepositoryIds List<int>
    An array of repository ids that can access the organization variable.
    Value string
    Value of the variable
    VariableName string
    Name of the variable
    Visibility string
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    SelectedRepositoryIds []int
    An array of repository ids that can access the organization variable.
    value String
    Value of the variable
    variableName String
    Name of the variable
    visibility String
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    selectedRepositoryIds List<Integer>
    An array of repository ids that can access the organization variable.
    value string
    Value of the variable
    variableName string
    Name of the variable
    visibility string
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    selectedRepositoryIds number[]
    An array of repository ids that can access the organization variable.
    value str
    Value of the variable
    variable_name str
    Name of the variable
    visibility str
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    selected_repository_ids Sequence[int]
    An array of repository ids that can access the organization variable.
    value String
    Value of the variable
    variableName String
    Name of the variable
    visibility String
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    selectedRepositoryIds List<Number>
    An array of repository ids that can access the organization variable.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ActionsOrganizationVariable resource produces the following output properties:

    CreatedAt string
    Date of actions_variable creation.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    Date of actions_variable update.
    CreatedAt string
    Date of actions_variable creation.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdatedAt string
    Date of actions_variable update.
    createdAt String
    Date of actions_variable creation.
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    Date of actions_variable update.
    createdAt string
    Date of actions_variable creation.
    id string
    The provider-assigned unique ID for this managed resource.
    updatedAt string
    Date of actions_variable update.
    created_at str
    Date of actions_variable creation.
    id str
    The provider-assigned unique ID for this managed resource.
    updated_at str
    Date of actions_variable update.
    createdAt String
    Date of actions_variable creation.
    id String
    The provider-assigned unique ID for this managed resource.
    updatedAt String
    Date of actions_variable update.

    Look up Existing ActionsOrganizationVariable Resource

    Get an existing ActionsOrganizationVariable resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ActionsOrganizationVariableState, opts?: CustomResourceOptions): ActionsOrganizationVariable
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            selected_repository_ids: Optional[Sequence[int]] = None,
            updated_at: Optional[str] = None,
            value: Optional[str] = None,
            variable_name: Optional[str] = None,
            visibility: Optional[str] = None) -> ActionsOrganizationVariable
    func GetActionsOrganizationVariable(ctx *Context, name string, id IDInput, state *ActionsOrganizationVariableState, opts ...ResourceOption) (*ActionsOrganizationVariable, error)
    public static ActionsOrganizationVariable Get(string name, Input<string> id, ActionsOrganizationVariableState? state, CustomResourceOptions? opts = null)
    public static ActionsOrganizationVariable get(String name, Output<String> id, ActionsOrganizationVariableState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreatedAt string
    Date of actions_variable creation.
    SelectedRepositoryIds List<int>
    An array of repository ids that can access the organization variable.
    UpdatedAt string
    Date of actions_variable update.
    Value string
    Value of the variable
    VariableName string
    Name of the variable
    Visibility string
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    CreatedAt string
    Date of actions_variable creation.
    SelectedRepositoryIds []int
    An array of repository ids that can access the organization variable.
    UpdatedAt string
    Date of actions_variable update.
    Value string
    Value of the variable
    VariableName string
    Name of the variable
    Visibility string
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    createdAt String
    Date of actions_variable creation.
    selectedRepositoryIds List<Integer>
    An array of repository ids that can access the organization variable.
    updatedAt String
    Date of actions_variable update.
    value String
    Value of the variable
    variableName String
    Name of the variable
    visibility String
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    createdAt string
    Date of actions_variable creation.
    selectedRepositoryIds number[]
    An array of repository ids that can access the organization variable.
    updatedAt string
    Date of actions_variable update.
    value string
    Value of the variable
    variableName string
    Name of the variable
    visibility string
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    created_at str
    Date of actions_variable creation.
    selected_repository_ids Sequence[int]
    An array of repository ids that can access the organization variable.
    updated_at str
    Date of actions_variable update.
    value str
    Value of the variable
    variable_name str
    Name of the variable
    visibility str
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.
    createdAt String
    Date of actions_variable creation.
    selectedRepositoryIds List<Number>
    An array of repository ids that can access the organization variable.
    updatedAt String
    Date of actions_variable update.
    value String
    Value of the variable
    variableName String
    Name of the variable
    visibility String
    Configures the access that repositories have to the organization variable. Must be one of all, private, selected. selected_repository_ids is required if set to selected.

    Import

    This resource can be imported using an ID made up of the variable name:

    $ pulumi import github:index/actionsOrganizationVariable:ActionsOrganizationVariable test_variable test_variable_name
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi