github.ActionsEnvironmentVariable
Explore with Pulumi AI
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
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const exampleVariable = new github.ActionsEnvironmentVariable("example_variable", {
environment: "example_environment",
variableName: "example_variable_name",
value: "example_variable_value",
});
import pulumi
import pulumi_github as github
example_variable = github.ActionsEnvironmentVariable("example_variable",
environment="example_environment",
variable_name="example_variable_name",
value="example_variable_value")
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.NewActionsEnvironmentVariable(ctx, "example_variable", &github.ActionsEnvironmentVariableArgs{
Environment: pulumi.String("example_environment"),
VariableName: pulumi.String("example_variable_name"),
Value: pulumi.String("example_variable_value"),
})
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.ActionsEnvironmentVariable("example_variable", new()
{
Environment = "example_environment",
VariableName = "example_variable_name",
Value = "example_variable_value",
});
});
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")
.variableName("example_variable_name")
.value("example_variable_value")
.build());
}
}
resources:
exampleVariable:
type: github:ActionsEnvironmentVariable
name: example_variable
properties:
environment: example_environment
variableName: 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("repo_environment", {
repository: repo.then(repo => repo.name),
environment: "example_environment",
});
const exampleVariable = new github.ActionsEnvironmentVariable("example_variable", {
repository: repo.then(repo => repo.name),
environment: repoEnvironment.environment,
variableName: "example_variable_name",
value: "example_variable_value",
});
import pulumi
import pulumi_github as github
repo = github.get_repository(full_name="my-org/repo")
repo_environment = github.RepositoryEnvironment("repo_environment",
repository=repo.name,
environment="example_environment")
example_variable = github.ActionsEnvironmentVariable("example_variable",
repository=repo.name,
environment=repo_environment.environment,
variable_name="example_variable_name",
value="example_variable_value")
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
}
repoEnvironment, err := github.NewRepositoryEnvironment(ctx, "repo_environment", &github.RepositoryEnvironmentArgs{
Repository: pulumi.String(repo.Name),
Environment: pulumi.String("example_environment"),
})
if err != nil {
return err
}
_, err = github.NewActionsEnvironmentVariable(ctx, "example_variable", &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
})
}
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("repo_environment", new()
{
Repository = repo.Apply(getRepositoryResult => getRepositoryResult.Name),
Environment = "example_environment",
});
var exampleVariable = new Github.ActionsEnvironmentVariable("example_variable", new()
{
Repository = repo.Apply(getRepositoryResult => getRepositoryResult.Name),
Environment = repoEnvironment.Environment,
VariableName = "example_variable_name",
Value = "example_variable_value",
});
});
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());
}
}
resources:
repoEnvironment:
type: github:RepositoryEnvironment
name: repo_environment
properties:
repository: ${repo.name}
environment: example_environment
exampleVariable:
type: github:ActionsEnvironmentVariable
name: example_variable
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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ActionsEnvironmentVariable(name: string, args: ActionsEnvironmentVariableArgs, opts?: CustomResourceOptions);
@overload
def ActionsEnvironmentVariable(resource_name: str,
args: ActionsEnvironmentVariableArgs,
opts: Optional[ResourceOptions] = None)
@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)
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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var actionsEnvironmentVariableResource = new Github.ActionsEnvironmentVariable("actionsEnvironmentVariableResource", new()
{
Environment = "string",
Repository = "string",
Value = "string",
VariableName = "string",
});
example, err := github.NewActionsEnvironmentVariable(ctx, "actionsEnvironmentVariableResource", &github.ActionsEnvironmentVariableArgs{
Environment: pulumi.String("string"),
Repository: pulumi.String("string"),
Value: pulumi.String("string"),
VariableName: pulumi.String("string"),
})
var actionsEnvironmentVariableResource = new ActionsEnvironmentVariable("actionsEnvironmentVariableResource", ActionsEnvironmentVariableArgs.builder()
.environment("string")
.repository("string")
.value("string")
.variableName("string")
.build());
actions_environment_variable_resource = github.ActionsEnvironmentVariable("actionsEnvironmentVariableResource",
environment="string",
repository="string",
value="string",
variable_name="string")
const actionsEnvironmentVariableResource = new github.ActionsEnvironmentVariable("actionsEnvironmentVariableResource", {
environment: "string",
repository: "string",
value: "string",
variableName: "string",
});
type: github:ActionsEnvironmentVariable
properties:
environment: string
repository: string
value: string
variableName: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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
- Variable
Name string - Name of the variable.
- Environment string
- Name of the environment.
- Repository string
- Name of the repository.
- Value string
- Value of the variable
- Variable
Name string - Name of the variable.
- environment String
- Name of the environment.
- repository String
- Name of the repository.
- value String
- Value of the variable
- variable
Name String - Name of the variable.
- environment string
- Name of the environment.
- repository string
- Name of the repository.
- value string
- Value of the variable
- variable
Name 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
- variable
Name String - Name of the variable.
Outputs
All input properties are implicitly available as output properties. Additionally, the ActionsEnvironmentVariable resource produces the following output properties:
- 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.
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.
- Created
At string - Date of actions_environment_secret creation.
- Environment string
- Name of the environment.
- Repository string
- Name of the repository.
- Updated
At string - Date of actions_environment_secret update.
- Value string
- Value of the variable
- Variable
Name string - Name of the variable.
- Created
At string - Date of actions_environment_secret creation.
- Environment string
- Name of the environment.
- Repository string
- Name of the repository.
- Updated
At string - Date of actions_environment_secret update.
- Value string
- Value of the variable
- Variable
Name string - Name of the variable.
- created
At String - Date of actions_environment_secret creation.
- environment String
- Name of the environment.
- repository String
- Name of the repository.
- updated
At String - Date of actions_environment_secret update.
- value String
- Value of the variable
- variable
Name String - Name of the variable.
- created
At string - Date of actions_environment_secret creation.
- environment string
- Name of the environment.
- repository string
- Name of the repository.
- updated
At string - Date of actions_environment_secret update.
- value string
- Value of the variable
- variable
Name 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.
- created
At String - Date of actions_environment_secret creation.
- environment String
- Name of the environment.
- repository String
- Name of the repository.
- updated
At String - Date of actions_environment_secret update.
- value String
- Value of the variable
- variable
Name 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
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.