1. Packages
  2. Github Provider
  3. API Docs
  4. CodespacesOrganizationSecretRepositories
GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi

github.CodespacesOrganizationSecretRepositories

Explore with Pulumi AI

This resource allows you to manage repository allow list for existing GitHub Codespaces secrets within your GitHub organization.

You must have write access to an organization secret to use this resource.

This resource is only applicable when visibility of the existing organization secret has been set to selected.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const repo = github.getRepository({
    fullName: "my-org/repo",
});
const orgSecretRepos = new github.CodespacesOrganizationSecretRepositories("org_secret_repos", {
    secretName: "existing_secret_name",
    selectedRepositoryIds: [repo.then(repo => repo.repoId)],
});
Copy
import pulumi
import pulumi_github as github

repo = github.get_repository(full_name="my-org/repo")
org_secret_repos = github.CodespacesOrganizationSecretRepositories("org_secret_repos",
    secret_name="existing_secret_name",
    selected_repository_ids=[repo.repo_id])
Copy
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.NewCodespacesOrganizationSecretRepositories(ctx, "org_secret_repos", &github.CodespacesOrganizationSecretRepositoriesArgs{
			SecretName: pulumi.String("existing_secret_name"),
			SelectedRepositoryIds: pulumi.IntArray{
				pulumi.Int(repo.RepoId),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 orgSecretRepos = new Github.CodespacesOrganizationSecretRepositories("org_secret_repos", new()
    {
        SecretName = "existing_secret_name",
        SelectedRepositoryIds = new[]
        {
            repo.Apply(getRepositoryResult => getRepositoryResult.RepoId),
        },
    });

});
Copy
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.CodespacesOrganizationSecretRepositories;
import com.pulumi.github.CodespacesOrganizationSecretRepositoriesArgs;
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 orgSecretRepos = new CodespacesOrganizationSecretRepositories("orgSecretRepos", CodespacesOrganizationSecretRepositoriesArgs.builder()
            .secretName("existing_secret_name")
            .selectedRepositoryIds(repo.applyValue(getRepositoryResult -> getRepositoryResult.repoId()))
            .build());

    }
}
Copy
resources:
  orgSecretRepos:
    type: github:CodespacesOrganizationSecretRepositories
    name: org_secret_repos
    properties:
      secretName: existing_secret_name
      selectedRepositoryIds:
        - ${repo.repoId}
variables:
  repo:
    fn::invoke:
      function: github:getRepository
      arguments:
        fullName: my-org/repo
Copy

Create CodespacesOrganizationSecretRepositories Resource

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

Constructor syntax

new CodespacesOrganizationSecretRepositories(name: string, args: CodespacesOrganizationSecretRepositoriesArgs, opts?: CustomResourceOptions);
@overload
def CodespacesOrganizationSecretRepositories(resource_name: str,
                                             args: CodespacesOrganizationSecretRepositoriesArgs,
                                             opts: Optional[ResourceOptions] = None)

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

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. CodespacesOrganizationSecretRepositoriesArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. CodespacesOrganizationSecretRepositoriesArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. CodespacesOrganizationSecretRepositoriesArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. CodespacesOrganizationSecretRepositoriesArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. CodespacesOrganizationSecretRepositoriesArgs
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 codespacesOrganizationSecretRepositoriesResource = new Github.CodespacesOrganizationSecretRepositories("codespacesOrganizationSecretRepositoriesResource", new()
{
    SecretName = "string",
    SelectedRepositoryIds = new[]
    {
        0,
    },
});
Copy
example, err := github.NewCodespacesOrganizationSecretRepositories(ctx, "codespacesOrganizationSecretRepositoriesResource", &github.CodespacesOrganizationSecretRepositoriesArgs{
	SecretName: pulumi.String("string"),
	SelectedRepositoryIds: pulumi.IntArray{
		pulumi.Int(0),
	},
})
Copy
var codespacesOrganizationSecretRepositoriesResource = new CodespacesOrganizationSecretRepositories("codespacesOrganizationSecretRepositoriesResource", CodespacesOrganizationSecretRepositoriesArgs.builder()
    .secretName("string")
    .selectedRepositoryIds(0)
    .build());
Copy
codespaces_organization_secret_repositories_resource = github.CodespacesOrganizationSecretRepositories("codespacesOrganizationSecretRepositoriesResource",
    secret_name="string",
    selected_repository_ids=[0])
Copy
const codespacesOrganizationSecretRepositoriesResource = new github.CodespacesOrganizationSecretRepositories("codespacesOrganizationSecretRepositoriesResource", {
    secretName: "string",
    selectedRepositoryIds: [0],
});
Copy
type: github:CodespacesOrganizationSecretRepositories
properties:
    secretName: string
    selectedRepositoryIds:
        - 0
Copy

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

SecretName
This property is required.
Changes to this property will trigger replacement.
string
Name of the existing secret
SelectedRepositoryIds This property is required. List<int>
An array of repository ids that can access the organization secret.
SecretName
This property is required.
Changes to this property will trigger replacement.
string
Name of the existing secret
SelectedRepositoryIds This property is required. []int
An array of repository ids that can access the organization secret.
secretName
This property is required.
Changes to this property will trigger replacement.
String
Name of the existing secret
selectedRepositoryIds This property is required. List<Integer>
An array of repository ids that can access the organization secret.
secretName
This property is required.
Changes to this property will trigger replacement.
string
Name of the existing secret
selectedRepositoryIds This property is required. number[]
An array of repository ids that can access the organization secret.
secret_name
This property is required.
Changes to this property will trigger replacement.
str
Name of the existing secret
selected_repository_ids This property is required. Sequence[int]
An array of repository ids that can access the organization secret.
secretName
This property is required.
Changes to this property will trigger replacement.
String
Name of the existing secret
selectedRepositoryIds This property is required. List<Number>
An array of repository ids that can access the organization secret.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing CodespacesOrganizationSecretRepositories Resource

Get an existing CodespacesOrganizationSecretRepositories 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?: CodespacesOrganizationSecretRepositoriesState, opts?: CustomResourceOptions): CodespacesOrganizationSecretRepositories
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        secret_name: Optional[str] = None,
        selected_repository_ids: Optional[Sequence[int]] = None) -> CodespacesOrganizationSecretRepositories
func GetCodespacesOrganizationSecretRepositories(ctx *Context, name string, id IDInput, state *CodespacesOrganizationSecretRepositoriesState, opts ...ResourceOption) (*CodespacesOrganizationSecretRepositories, error)
public static CodespacesOrganizationSecretRepositories Get(string name, Input<string> id, CodespacesOrganizationSecretRepositoriesState? state, CustomResourceOptions? opts = null)
public static CodespacesOrganizationSecretRepositories get(String name, Output<String> id, CodespacesOrganizationSecretRepositoriesState state, CustomResourceOptions options)
resources:  _:    type: github:CodespacesOrganizationSecretRepositories    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
SecretName Changes to this property will trigger replacement. string
Name of the existing secret
SelectedRepositoryIds List<int>
An array of repository ids that can access the organization secret.
SecretName Changes to this property will trigger replacement. string
Name of the existing secret
SelectedRepositoryIds []int
An array of repository ids that can access the organization secret.
secretName Changes to this property will trigger replacement. String
Name of the existing secret
selectedRepositoryIds List<Integer>
An array of repository ids that can access the organization secret.
secretName Changes to this property will trigger replacement. string
Name of the existing secret
selectedRepositoryIds number[]
An array of repository ids that can access the organization secret.
secret_name Changes to this property will trigger replacement. str
Name of the existing secret
selected_repository_ids Sequence[int]
An array of repository ids that can access the organization secret.
secretName Changes to this property will trigger replacement. String
Name of the existing secret
selectedRepositoryIds List<Number>
An array of repository ids that can access the organization secret.

Import

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

$ pulumi import github:index/codespacesOrganizationSecretRepositories:CodespacesOrganizationSecretRepositories org_secret_repos existing_secret_name
Copy

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.