1. Packages
  2. Github Provider
  3. API Docs
  4. Membership
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

github.Membership

Explore with Pulumi AI

github logo
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

    Provides a GitHub membership resource.

    This resource allows you to add/remove users from your organization. When applied, an invitation will be sent to the user to become part of the organization. When destroyed, either the invitation will be cancelled or the user will be removed.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    // Add a user to the organization
    const membershipForSomeUser = new github.Membership("membership_for_some_user", {
        username: "SomeUser",
        role: "member",
    });
    
    import pulumi
    import pulumi_github as github
    
    # Add a user to the organization
    membership_for_some_user = github.Membership("membership_for_some_user",
        username="SomeUser",
        role="member")
    
    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 {
    		// Add a user to the organization
    		_, err := github.NewMembership(ctx, "membership_for_some_user", &github.MembershipArgs{
    			Username: pulumi.String("SomeUser"),
    			Role:     pulumi.String("member"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        // Add a user to the organization
        var membershipForSomeUser = new Github.Membership("membership_for_some_user", new()
        {
            Username = "SomeUser",
            Role = "member",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.Membership;
    import com.pulumi.github.MembershipArgs;
    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) {
            // Add a user to the organization
            var membershipForSomeUser = new Membership("membershipForSomeUser", MembershipArgs.builder()
                .username("SomeUser")
                .role("member")
                .build());
    
        }
    }
    
    resources:
      # Add a user to the organization
      membershipForSomeUser:
        type: github:Membership
        name: membership_for_some_user
        properties:
          username: SomeUser
          role: member
    

    Create Membership Resource

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

    Constructor syntax

    new Membership(name: string, args: MembershipArgs, opts?: CustomResourceOptions);
    @overload
    def Membership(resource_name: str,
                   args: MembershipArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def Membership(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   username: Optional[str] = None,
                   downgrade_on_destroy: Optional[bool] = None,
                   role: Optional[str] = None)
    func NewMembership(ctx *Context, name string, args MembershipArgs, opts ...ResourceOption) (*Membership, error)
    public Membership(string name, MembershipArgs args, CustomResourceOptions? opts = null)
    public Membership(String name, MembershipArgs args)
    public Membership(String name, MembershipArgs args, CustomResourceOptions options)
    
    type: github:Membership
    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 MembershipArgs
    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 MembershipArgs
    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 MembershipArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MembershipArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MembershipArgs
    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 membershipResource = new Github.Membership("membershipResource", new()
    {
        Username = "string",
        DowngradeOnDestroy = false,
        Role = "string",
    });
    
    example, err := github.NewMembership(ctx, "membershipResource", &github.MembershipArgs{
    	Username:           pulumi.String("string"),
    	DowngradeOnDestroy: pulumi.Bool(false),
    	Role:               pulumi.String("string"),
    })
    
    var membershipResource = new Membership("membershipResource", MembershipArgs.builder()
        .username("string")
        .downgradeOnDestroy(false)
        .role("string")
        .build());
    
    membership_resource = github.Membership("membershipResource",
        username="string",
        downgrade_on_destroy=False,
        role="string")
    
    const membershipResource = new github.Membership("membershipResource", {
        username: "string",
        downgradeOnDestroy: false,
        role: "string",
    });
    
    type: github:Membership
    properties:
        downgradeOnDestroy: false
        role: string
        username: string
    

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

    Username string
    The user to add to the organization.
    DowngradeOnDestroy bool
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    Role string
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    Username string
    The user to add to the organization.
    DowngradeOnDestroy bool
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    Role string
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username String
    The user to add to the organization.
    downgradeOnDestroy Boolean
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    role String
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username string
    The user to add to the organization.
    downgradeOnDestroy boolean
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    role string
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username str
    The user to add to the organization.
    downgrade_on_destroy bool
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    role str
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username String
    The user to add to the organization.
    downgradeOnDestroy Boolean
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    role String
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.

    Outputs

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

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

    Look up Existing Membership Resource

    Get an existing Membership 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?: MembershipState, opts?: CustomResourceOptions): Membership
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            downgrade_on_destroy: Optional[bool] = None,
            etag: Optional[str] = None,
            role: Optional[str] = None,
            username: Optional[str] = None) -> Membership
    func GetMembership(ctx *Context, name string, id IDInput, state *MembershipState, opts ...ResourceOption) (*Membership, error)
    public static Membership Get(string name, Input<string> id, MembershipState? state, CustomResourceOptions? opts = null)
    public static Membership get(String name, Output<String> id, MembershipState 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:
    DowngradeOnDestroy bool
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    Etag string
    Role string
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    Username string
    The user to add to the organization.
    DowngradeOnDestroy bool
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    Etag string
    Role string
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    Username string
    The user to add to the organization.
    downgradeOnDestroy Boolean
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    etag String
    role String
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username String
    The user to add to the organization.
    downgradeOnDestroy boolean
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    etag string
    role string
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username string
    The user to add to the organization.
    downgrade_on_destroy bool
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    etag str
    role str
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username str
    The user to add to the organization.
    downgradeOnDestroy Boolean
    Defaults to false. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'.
    etag String
    role String
    The role of the user within the organization. Must be one of member or admin. Defaults to member. admin role represents the owner role available via GitHub UI.
    username String
    The user to add to the organization.

    Import

    GitHub Membership can be imported using an ID made up of organization:username, e.g.

    $ pulumi import github:index/membership:Membership member hashicorp:someuser
    

    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
    GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi