1. Packages
  2. GitHub
  3. API Docs
  4. ActionsEnvironmentVariable
GitHub v5.20.0 published on Saturday, Sep 30, 2023 by Pulumi

github.ActionsEnvironmentVariable

Explore with Pulumi AI

github logo
GitHub v5.20.0 published on Saturday, Sep 30, 2023 by Pulumi

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

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleVariable = new Github.ActionsEnvironmentVariable("exampleVariable", new()
        {
            Environment = "example_environment",
            Value = "example_variable_value",
            VariableName = "example_variable_name",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v5/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := github.NewActionsEnvironmentVariable(ctx, "exampleVariable", &github.ActionsEnvironmentVariableArgs{
    			Environment:  pulumi.String("example_environment"),
    			Value:        pulumi.String("example_variable_value"),
    			VariableName: pulumi.String("example_variable_name"),
    		})
    		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.github.ActionsEnvironmentVariable;
    import com.pulumi.github.ActionsEnvironmentVariableArgs;
    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 ActionsEnvironmentVariable("exampleVariable", ActionsEnvironmentVariableArgs.builder()        
                .environment("example_environment")
                .value("example_variable_value")
                .variableName("example_variable_name")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_github as github
    
    example_variable = github.ActionsEnvironmentVariable("exampleVariable",
        environment="example_environment",
        value="example_variable_value",
        variable_name="example_variable_name")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const exampleVariable = new github.ActionsEnvironmentVariable("exampleVariable", {
        environment: "example_environment",
        value: "example_variable_value",
        variableName: "example_variable_name",
    });
    
    resources:
      exampleVariable:
        type: github:ActionsEnvironmentVariable
        properties:
          environment: example_environment
          value: example_variable_value
          variableName: example_variable_name
    
    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 repoEnvironment = new Github.RepositoryEnvironment("repoEnvironment", new()
        {
            Repository = repo.Apply(getRepositoryResult => getRepositoryResult.Name),
            Environment = "example_environment",
        });
    
        var exampleVariable = new Github.ActionsEnvironmentVariable("exampleVariable", new()
        {
            Repository = repo.Apply(getRepositoryResult => getRepositoryResult.Name),
            Environment = repoEnvironment.Environment,
            VariableName = "example_variable_name",
            Value = "example_variable_value",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v5/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
    		}
    		repoEnvironment, err := github.NewRepositoryEnvironment(ctx, "repoEnvironment", &github.RepositoryEnvironmentArgs{
    			Repository:  *pulumi.String(repo.Name),
    			Environment: pulumi.String("example_environment"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewActionsEnvironmentVariable(ctx, "exampleVariable", &github.ActionsEnvironmentVariableArgs{
    			Repository:   *pulumi.String(repo.Name),
    			Environment:  repoEnvironment.Environment,
    			VariableName: pulumi.String("example_variable_name"),
    			Value:        pulumi.String("example_variable_value"),
    		})
    		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.github.GithubFunctions;
    import com.pulumi.github.inputs.GetRepositoryArgs;
    import com.pulumi.github.RepositoryEnvironment;
    import com.pulumi.github.RepositoryEnvironmentArgs;
    import com.pulumi.github.ActionsEnvironmentVariable;
    import com.pulumi.github.ActionsEnvironmentVariableArgs;
    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 repoEnvironment = new RepositoryEnvironment("repoEnvironment", RepositoryEnvironmentArgs.builder()        
                .repository(repo.applyValue(getRepositoryResult -> getRepositoryResult.name()))
                .environment("example_environment")
                .build());
    
            var exampleVariable = new ActionsEnvironmentVariable("exampleVariable", ActionsEnvironmentVariableArgs.builder()        
                .repository(repo.applyValue(getRepositoryResult -> getRepositoryResult.name()))
                .environment(repoEnvironment.environment())
                .variableName("example_variable_name")
                .value("example_variable_value")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_github as github
    
    repo = github.get_repository(full_name="my-org/repo")
    repo_environment = github.RepositoryEnvironment("repoEnvironment",
        repository=repo.name,
        environment="example_environment")
    example_variable = github.ActionsEnvironmentVariable("exampleVariable",
        repository=repo.name,
        environment=repo_environment.environment,
        variable_name="example_variable_name",
        value="example_variable_value")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const repo = github.getRepository({
        fullName: "my-org/repo",
    });
    const repoEnvironment = new github.RepositoryEnvironment("repoEnvironment", {
        repository: repo.then(repo => repo.name),
        environment: "example_environment",
    });
    const exampleVariable = new github.ActionsEnvironmentVariable("exampleVariable", {
        repository: repo.then(repo => repo.name),
        environment: repoEnvironment.environment,
        variableName: "example_variable_name",
        value: "example_variable_value",
    });
    
    resources:
      repoEnvironment:
        type: github:RepositoryEnvironment
        properties:
          repository: ${repo.name}
          environment: example_environment
      exampleVariable:
        type: github:ActionsEnvironmentVariable
        properties:
          repository: ${repo.name}
          environment: ${repoEnvironment.environment}
          variableName: example_variable_name
          value: example_variable_value
    variables:
      repo:
        fn::invoke:
          Function: github:getRepository
          Arguments:
            fullName: my-org/repo
    

    Create ActionsEnvironmentVariable Resource

    new ActionsEnvironmentVariable(name: string, args: ActionsEnvironmentVariableArgs, opts?: CustomResourceOptions);
    @overload
    def ActionsEnvironmentVariable(resource_name: str,
                                   opts: Optional[ResourceOptions] = None,
                                   environment: Optional[str] = None,
                                   repository: Optional[str] = None,
                                   value: Optional[str] = None,
                                   variable_name: Optional[str] = None)
    @overload
    def ActionsEnvironmentVariable(resource_name: str,
                                   args: ActionsEnvironmentVariableArgs,
                                   opts: Optional[ResourceOptions] = None)
    func NewActionsEnvironmentVariable(ctx *Context, name string, args ActionsEnvironmentVariableArgs, opts ...ResourceOption) (*ActionsEnvironmentVariable, error)
    public ActionsEnvironmentVariable(string name, ActionsEnvironmentVariableArgs args, CustomResourceOptions? opts = null)
    public ActionsEnvironmentVariable(String name, ActionsEnvironmentVariableArgs args)
    public ActionsEnvironmentVariable(String name, ActionsEnvironmentVariableArgs args, CustomResourceOptions options)
    
    type: github:ActionsEnvironmentVariable
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ActionsEnvironmentVariableArgs
    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 ActionsEnvironmentVariableArgs
    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 ActionsEnvironmentVariableArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ActionsEnvironmentVariableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ActionsEnvironmentVariableArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ActionsEnvironmentVariable 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 ActionsEnvironmentVariable resource accepts the following input properties:

    Environment string

    Name of the environment.

    Repository string

    Name of the repository.

    Value string

    Value of the variable

    VariableName string

    Name of the variable.

    Environment string

    Name of the environment.

    Repository string

    Name of the repository.

    Value string

    Value of the variable

    VariableName string

    Name of the variable.

    environment String

    Name of the environment.

    repository String

    Name of the repository.

    value String

    Value of the variable

    variableName String

    Name of the variable.

    environment string

    Name of the environment.

    repository string

    Name of the repository.

    value string

    Value of the variable

    variableName string

    Name of the variable.

    environment str

    Name of the environment.

    repository str

    Name of the repository.

    value str

    Value of the variable

    variable_name str

    Name of the variable.

    environment String

    Name of the environment.

    repository String

    Name of the repository.

    value String

    Value of the variable

    variableName String

    Name of the variable.

    Outputs

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

    CreatedAt string

    Date of actions_environment_secret creation.

    Id string

    The provider-assigned unique ID for this managed resource.

    UpdatedAt string

    Date of actions_environment_secret update.

    CreatedAt string

    Date of actions_environment_secret creation.

    Id string

    The provider-assigned unique ID for this managed resource.

    UpdatedAt string

    Date of actions_environment_secret update.

    createdAt String

    Date of actions_environment_secret creation.

    id String

    The provider-assigned unique ID for this managed resource.

    updatedAt String

    Date of actions_environment_secret update.

    createdAt string

    Date of actions_environment_secret creation.

    id string

    The provider-assigned unique ID for this managed resource.

    updatedAt string

    Date of actions_environment_secret update.

    created_at str

    Date of actions_environment_secret creation.

    id str

    The provider-assigned unique ID for this managed resource.

    updated_at str

    Date of actions_environment_secret update.

    createdAt String

    Date of actions_environment_secret creation.

    id String

    The provider-assigned unique ID for this managed resource.

    updatedAt String

    Date of actions_environment_secret update.

    Look up Existing ActionsEnvironmentVariable Resource

    Get an existing ActionsEnvironmentVariable 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?: ActionsEnvironmentVariableState, opts?: CustomResourceOptions): ActionsEnvironmentVariable
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            environment: Optional[str] = None,
            repository: Optional[str] = None,
            updated_at: Optional[str] = None,
            value: Optional[str] = None,
            variable_name: Optional[str] = None) -> ActionsEnvironmentVariable
    func GetActionsEnvironmentVariable(ctx *Context, name string, id IDInput, state *ActionsEnvironmentVariableState, opts ...ResourceOption) (*ActionsEnvironmentVariable, error)
    public static ActionsEnvironmentVariable Get(string name, Input<string> id, ActionsEnvironmentVariableState? state, CustomResourceOptions? opts = null)
    public static ActionsEnvironmentVariable get(String name, Output<String> id, ActionsEnvironmentVariableState 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_environment_secret creation.

    Environment string

    Name of the environment.

    Repository string

    Name of the repository.

    UpdatedAt string

    Date of actions_environment_secret update.

    Value string

    Value of the variable

    VariableName string

    Name of the variable.

    CreatedAt string

    Date of actions_environment_secret creation.

    Environment string

    Name of the environment.

    Repository string

    Name of the repository.

    UpdatedAt string

    Date of actions_environment_secret update.

    Value string

    Value of the variable

    VariableName string

    Name of the variable.

    createdAt String

    Date of actions_environment_secret creation.

    environment String

    Name of the environment.

    repository String

    Name of the repository.

    updatedAt String

    Date of actions_environment_secret update.

    value String

    Value of the variable

    variableName String

    Name of the variable.

    createdAt string

    Date of actions_environment_secret creation.

    environment string

    Name of the environment.

    repository string

    Name of the repository.

    updatedAt string

    Date of actions_environment_secret update.

    value string

    Value of the variable

    variableName string

    Name of the variable.

    created_at str

    Date of actions_environment_secret creation.

    environment str

    Name of the environment.

    repository str

    Name of the repository.

    updated_at str

    Date of actions_environment_secret update.

    value str

    Value of the variable

    variable_name str

    Name of the variable.

    createdAt String

    Date of actions_environment_secret creation.

    environment String

    Name of the environment.

    repository String

    Name of the repository.

    updatedAt String

    Date of actions_environment_secret update.

    value String

    Value of the variable

    variableName String

    Name of the variable.

    Import

    This resource can be imported using an ID made up of the repository name, environment name, and variable name:

     $ pulumi import github:index/actionsEnvironmentVariable:ActionsEnvironmentVariable test_variable myrepo:myenv:myvariable
    

    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 v5.20.0 published on Saturday, Sep 30, 2023 by Pulumi