1. Packages
  2. Packages
  3. Github Provider
  4. API Docs
  5. CodespacesUserSecret
Viewing docs for GitHub v6.13.1
published on Wednesday, Apr 29, 2026 by Pulumi
github logo
Viewing docs for GitHub v6.13.1
published on Wednesday, Apr 29, 2026 by Pulumi

    This resource allows you to create and manage GitHub Codespaces secrets within your GitHub user. You must have write access to a repository to use this resource.

    Secret values are encrypted using the Go ‘/crypto/box’ module which is interoperable with libsodium. Libsodium is used by GitHub to decrypt secret values.

    For the purposes of security, the contents of the plaintextValue field have been marked as sensitive to Terraform, but it is important to note that this does not hide it from state files. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the encryptedValue using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction.

    Create CodespacesUserSecret Resource

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

    Constructor syntax

    new CodespacesUserSecret(name: string, args: CodespacesUserSecretArgs, opts?: CustomResourceOptions);
    @overload
    def CodespacesUserSecret(resource_name: str,
                             args: CodespacesUserSecretArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def CodespacesUserSecret(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             secret_name: Optional[str] = None,
                             encrypted_value: Optional[str] = None,
                             plaintext_value: Optional[str] = None,
                             selected_repository_ids: Optional[Sequence[int]] = None)
    func NewCodespacesUserSecret(ctx *Context, name string, args CodespacesUserSecretArgs, opts ...ResourceOption) (*CodespacesUserSecret, error)
    public CodespacesUserSecret(string name, CodespacesUserSecretArgs args, CustomResourceOptions? opts = null)
    public CodespacesUserSecret(String name, CodespacesUserSecretArgs args)
    public CodespacesUserSecret(String name, CodespacesUserSecretArgs args, CustomResourceOptions options)
    
    type: github:CodespacesUserSecret
    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 CodespacesUserSecretArgs
    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 CodespacesUserSecretArgs
    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 CodespacesUserSecretArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CodespacesUserSecretArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CodespacesUserSecretArgs
    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 codespacesUserSecretResource = new Github.CodespacesUserSecret("codespacesUserSecretResource", new()
    {
        SecretName = "string",
        EncryptedValue = "string",
        PlaintextValue = "string",
        SelectedRepositoryIds = new[]
        {
            0,
        },
    });
    
    example, err := github.NewCodespacesUserSecret(ctx, "codespacesUserSecretResource", &github.CodespacesUserSecretArgs{
    	SecretName:     pulumi.String("string"),
    	EncryptedValue: pulumi.String("string"),
    	PlaintextValue: pulumi.String("string"),
    	SelectedRepositoryIds: pulumi.IntArray{
    		pulumi.Int(0),
    	},
    })
    
    var codespacesUserSecretResource = new CodespacesUserSecret("codespacesUserSecretResource", CodespacesUserSecretArgs.builder()
        .secretName("string")
        .encryptedValue("string")
        .plaintextValue("string")
        .selectedRepositoryIds(0)
        .build());
    
    codespaces_user_secret_resource = github.CodespacesUserSecret("codespacesUserSecretResource",
        secret_name="string",
        encrypted_value="string",
        plaintext_value="string",
        selected_repository_ids=[0])
    
    const codespacesUserSecretResource = new github.CodespacesUserSecret("codespacesUserSecretResource", {
        secretName: "string",
        encryptedValue: "string",
        plaintextValue: "string",
        selectedRepositoryIds: [0],
    });
    
    type: github:CodespacesUserSecret
    properties:
        encryptedValue: string
        plaintextValue: string
        secretName: string
        selectedRepositoryIds:
            - 0
    

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

    SecretName string
    Name of the secret
    EncryptedValue string
    Encrypted value of the secret using the GitHub public key in Base64 format.
    PlaintextValue string
    Plaintext value of the secret to be encrypted
    SelectedRepositoryIds List<int>
    An array of repository ids that can access the user secret.
    SecretName string
    Name of the secret
    EncryptedValue string
    Encrypted value of the secret using the GitHub public key in Base64 format.
    PlaintextValue string
    Plaintext value of the secret to be encrypted
    SelectedRepositoryIds []int
    An array of repository ids that can access the user secret.
    secretName String
    Name of the secret
    encryptedValue String
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintextValue String
    Plaintext value of the secret to be encrypted
    selectedRepositoryIds List<Integer>
    An array of repository ids that can access the user secret.
    secretName string
    Name of the secret
    encryptedValue string
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintextValue string
    Plaintext value of the secret to be encrypted
    selectedRepositoryIds number[]
    An array of repository ids that can access the user secret.
    secret_name str
    Name of the secret
    encrypted_value str
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintext_value str
    Plaintext value of the secret to be encrypted
    selected_repository_ids Sequence[int]
    An array of repository ids that can access the user secret.
    secretName String
    Name of the secret
    encryptedValue String
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintextValue String
    Plaintext value of the secret to be encrypted
    selectedRepositoryIds List<Number>
    An array of repository ids that can access the user secret.

    Outputs

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

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

    Look up Existing CodespacesUserSecret Resource

    Get an existing CodespacesUserSecret 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?: CodespacesUserSecretState, opts?: CustomResourceOptions): CodespacesUserSecret
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created_at: Optional[str] = None,
            encrypted_value: Optional[str] = None,
            plaintext_value: Optional[str] = None,
            secret_name: Optional[str] = None,
            selected_repository_ids: Optional[Sequence[int]] = None,
            updated_at: Optional[str] = None) -> CodespacesUserSecret
    func GetCodespacesUserSecret(ctx *Context, name string, id IDInput, state *CodespacesUserSecretState, opts ...ResourceOption) (*CodespacesUserSecret, error)
    public static CodespacesUserSecret Get(string name, Input<string> id, CodespacesUserSecretState? state, CustomResourceOptions? opts = null)
    public static CodespacesUserSecret get(String name, Output<String> id, CodespacesUserSecretState state, CustomResourceOptions options)
    resources:  _:    type: github:CodespacesUserSecret    get:      id: ${id}
    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 codespacesSecret creation.
    EncryptedValue string
    Encrypted value of the secret using the GitHub public key in Base64 format.
    PlaintextValue string
    Plaintext value of the secret to be encrypted
    SecretName string
    Name of the secret
    SelectedRepositoryIds List<int>
    An array of repository ids that can access the user secret.
    UpdatedAt string
    Date of codespacesSecret update.
    CreatedAt string
    Date of codespacesSecret creation.
    EncryptedValue string
    Encrypted value of the secret using the GitHub public key in Base64 format.
    PlaintextValue string
    Plaintext value of the secret to be encrypted
    SecretName string
    Name of the secret
    SelectedRepositoryIds []int
    An array of repository ids that can access the user secret.
    UpdatedAt string
    Date of codespacesSecret update.
    createdAt String
    Date of codespacesSecret creation.
    encryptedValue String
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintextValue String
    Plaintext value of the secret to be encrypted
    secretName String
    Name of the secret
    selectedRepositoryIds List<Integer>
    An array of repository ids that can access the user secret.
    updatedAt String
    Date of codespacesSecret update.
    createdAt string
    Date of codespacesSecret creation.
    encryptedValue string
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintextValue string
    Plaintext value of the secret to be encrypted
    secretName string
    Name of the secret
    selectedRepositoryIds number[]
    An array of repository ids that can access the user secret.
    updatedAt string
    Date of codespacesSecret update.
    created_at str
    Date of codespacesSecret creation.
    encrypted_value str
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintext_value str
    Plaintext value of the secret to be encrypted
    secret_name str
    Name of the secret
    selected_repository_ids Sequence[int]
    An array of repository ids that can access the user secret.
    updated_at str
    Date of codespacesSecret update.
    createdAt String
    Date of codespacesSecret creation.
    encryptedValue String
    Encrypted value of the secret using the GitHub public key in Base64 format.
    plaintextValue String
    Plaintext value of the secret to be encrypted
    secretName String
    Name of the secret
    selectedRepositoryIds List<Number>
    An array of repository ids that can access the user secret.
    updatedAt String
    Date of codespacesSecret update.

    Import

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

    $ pulumi import github:index/codespacesUserSecret:CodespacesUserSecret test_secret test_secret_name
    

    NOTE: the implementation is limited in that it won’t fetch the value of the plaintextValue or encryptedValue fields when importing. You may need to ignore changes for these as a workaround.

    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
    Viewing docs for GitHub v6.13.1
    published on Wednesday, Apr 29, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.