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

github.UserGpgKey

Explore with Pulumi AI

Provides a GitHub user’s GPG key resource.

This resource allows you to add/remove GPG keys from your user account.

Example Usage

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

const example = new github.UserGpgKey("example", {armoredPublicKey: `-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----`});
Copy
import pulumi
import pulumi_github as github

example = github.UserGpgKey("example", armored_public_key="""-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----""")
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 {
		_, err := github.NewUserGpgKey(ctx, "example", &github.UserGpgKeyArgs{
			ArmoredPublicKey: pulumi.String("-----BEGIN PGP PUBLIC KEY BLOCK-----\n...\n-----END PGP PUBLIC KEY BLOCK-----"),
		})
		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 example = new Github.UserGpgKey("example", new()
    {
        ArmoredPublicKey = @"-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.UserGpgKey;
import com.pulumi.github.UserGpgKeyArgs;
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 example = new UserGpgKey("example", UserGpgKeyArgs.builder()
            .armoredPublicKey("""
-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----            """)
            .build());

    }
}
Copy
resources:
  example:
    type: github:UserGpgKey
    properties:
      armoredPublicKey: |-
        -----BEGIN PGP PUBLIC KEY BLOCK-----
        ...
        -----END PGP PUBLIC KEY BLOCK-----        
Copy

Create UserGpgKey Resource

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

Constructor syntax

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

@overload
def UserGpgKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               armored_public_key: Optional[str] = None)
func NewUserGpgKey(ctx *Context, name string, args UserGpgKeyArgs, opts ...ResourceOption) (*UserGpgKey, error)
public UserGpgKey(string name, UserGpgKeyArgs args, CustomResourceOptions? opts = null)
public UserGpgKey(String name, UserGpgKeyArgs args)
public UserGpgKey(String name, UserGpgKeyArgs args, CustomResourceOptions options)
type: github:UserGpgKey
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. UserGpgKeyArgs
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. UserGpgKeyArgs
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. UserGpgKeyArgs
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. UserGpgKeyArgs
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. UserGpgKeyArgs
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 userGpgKeyResource = new Github.UserGpgKey("userGpgKeyResource", new()
{
    ArmoredPublicKey = "string",
});
Copy
example, err := github.NewUserGpgKey(ctx, "userGpgKeyResource", &github.UserGpgKeyArgs{
	ArmoredPublicKey: pulumi.String("string"),
})
Copy
var userGpgKeyResource = new UserGpgKey("userGpgKeyResource", UserGpgKeyArgs.builder()
    .armoredPublicKey("string")
    .build());
Copy
user_gpg_key_resource = github.UserGpgKey("userGpgKeyResource", armored_public_key="string")
Copy
const userGpgKeyResource = new github.UserGpgKey("userGpgKeyResource", {armoredPublicKey: "string"});
Copy
type: github:UserGpgKey
properties:
    armoredPublicKey: string
Copy

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

ArmoredPublicKey
This property is required.
Changes to this property will trigger replacement.
string
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
ArmoredPublicKey
This property is required.
Changes to this property will trigger replacement.
string
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
armoredPublicKey
This property is required.
Changes to this property will trigger replacement.
String
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
armoredPublicKey
This property is required.
Changes to this property will trigger replacement.
string
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
armored_public_key
This property is required.
Changes to this property will trigger replacement.
str
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
armoredPublicKey
This property is required.
Changes to this property will trigger replacement.
String
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.

Outputs

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

Etag string
Id string
The provider-assigned unique ID for this managed resource.
KeyId string
The key ID of the GPG key, e.g. 3262EFF25BA0D270
Etag string
Id string
The provider-assigned unique ID for this managed resource.
KeyId string
The key ID of the GPG key, e.g. 3262EFF25BA0D270
etag String
id String
The provider-assigned unique ID for this managed resource.
keyId String
The key ID of the GPG key, e.g. 3262EFF25BA0D270
etag string
id string
The provider-assigned unique ID for this managed resource.
keyId string
The key ID of the GPG key, e.g. 3262EFF25BA0D270
etag str
id str
The provider-assigned unique ID for this managed resource.
key_id str
The key ID of the GPG key, e.g. 3262EFF25BA0D270
etag String
id String
The provider-assigned unique ID for this managed resource.
keyId String
The key ID of the GPG key, e.g. 3262EFF25BA0D270

Look up Existing UserGpgKey Resource

Get an existing UserGpgKey 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?: UserGpgKeyState, opts?: CustomResourceOptions): UserGpgKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        armored_public_key: Optional[str] = None,
        etag: Optional[str] = None,
        key_id: Optional[str] = None) -> UserGpgKey
func GetUserGpgKey(ctx *Context, name string, id IDInput, state *UserGpgKeyState, opts ...ResourceOption) (*UserGpgKey, error)
public static UserGpgKey Get(string name, Input<string> id, UserGpgKeyState? state, CustomResourceOptions? opts = null)
public static UserGpgKey get(String name, Output<String> id, UserGpgKeyState state, CustomResourceOptions options)
resources:  _:    type: github:UserGpgKey    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:
ArmoredPublicKey Changes to this property will trigger replacement. string
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
Etag string
KeyId string
The key ID of the GPG key, e.g. 3262EFF25BA0D270
ArmoredPublicKey Changes to this property will trigger replacement. string
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
Etag string
KeyId string
The key ID of the GPG key, e.g. 3262EFF25BA0D270
armoredPublicKey Changes to this property will trigger replacement. String
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
etag String
keyId String
The key ID of the GPG key, e.g. 3262EFF25BA0D270
armoredPublicKey Changes to this property will trigger replacement. string
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
etag string
keyId string
The key ID of the GPG key, e.g. 3262EFF25BA0D270
armored_public_key Changes to this property will trigger replacement. str
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
etag str
key_id str
The key ID of the GPG key, e.g. 3262EFF25BA0D270
armoredPublicKey Changes to this property will trigger replacement. String
Your public GPG key, generated in ASCII-armored format. See Generating a new GPG key for help on creating a GPG key.
etag String
keyId String
The key ID of the GPG key, e.g. 3262EFF25BA0D270

Import

GPG keys are not importable due to the fact that API

does not return previously uploaded GPG key.

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.