1. Packages
  2. GitLab
  3. API Docs
  4. DeployKeyEnable
GitLab v6.10.0 published on Monday, Mar 25, 2024 by Pulumi

gitlab.DeployKeyEnable

Explore with Pulumi AI

gitlab logo
GitLab v6.10.0 published on Monday, Mar 25, 2024 by Pulumi

    The gitlab.DeployKeyEnable resource allows to enable an already existing deploy key (see gitlab.DeployKey resource) for a specific project.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    // A repo to host the deployment key
    const parentProject = new gitlab.Project("parentProject", {});
    // A second repo to use the deployment key from the parent project
    const fooProject = new gitlab.Project("fooProject", {});
    // Upload a deployment key for the parent repo
    const parentDeployKey = new gitlab.DeployKey("parentDeployKey", {
        project: parentProject.id,
        title: "Example deploy key",
        key: "ssh-ed25519 AAAA...",
    });
    // Enable the deployment key on the second repo
    const fooDeployKeyEnable = new gitlab.DeployKeyEnable("fooDeployKeyEnable", {
        project: fooProject.id,
        keyId: parentDeployKey.deployKeyId,
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    # A repo to host the deployment key
    parent_project = gitlab.Project("parentProject")
    # A second repo to use the deployment key from the parent project
    foo_project = gitlab.Project("fooProject")
    # Upload a deployment key for the parent repo
    parent_deploy_key = gitlab.DeployKey("parentDeployKey",
        project=parent_project.id,
        title="Example deploy key",
        key="ssh-ed25519 AAAA...")
    # Enable the deployment key on the second repo
    foo_deploy_key_enable = gitlab.DeployKeyEnable("fooDeployKeyEnable",
        project=foo_project.id,
        key_id=parent_deploy_key.deploy_key_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gitlab/sdk/v6/go/gitlab"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// A repo to host the deployment key
    		parentProject, err := gitlab.NewProject(ctx, "parentProject", nil)
    		if err != nil {
    			return err
    		}
    		// A second repo to use the deployment key from the parent project
    		fooProject, err := gitlab.NewProject(ctx, "fooProject", nil)
    		if err != nil {
    			return err
    		}
    		// Upload a deployment key for the parent repo
    		parentDeployKey, err := gitlab.NewDeployKey(ctx, "parentDeployKey", &gitlab.DeployKeyArgs{
    			Project: parentProject.ID(),
    			Title:   pulumi.String("Example deploy key"),
    			Key:     pulumi.String("ssh-ed25519 AAAA..."),
    		})
    		if err != nil {
    			return err
    		}
    		// Enable the deployment key on the second repo
    		_, err = gitlab.NewDeployKeyEnable(ctx, "fooDeployKeyEnable", &gitlab.DeployKeyEnableArgs{
    			Project: fooProject.ID(),
    			KeyId:   parentDeployKey.DeployKeyId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        // A repo to host the deployment key
        var parentProject = new GitLab.Project("parentProject");
    
        // A second repo to use the deployment key from the parent project
        var fooProject = new GitLab.Project("fooProject");
    
        // Upload a deployment key for the parent repo
        var parentDeployKey = new GitLab.DeployKey("parentDeployKey", new()
        {
            Project = parentProject.Id,
            Title = "Example deploy key",
            Key = "ssh-ed25519 AAAA...",
        });
    
        // Enable the deployment key on the second repo
        var fooDeployKeyEnable = new GitLab.DeployKeyEnable("fooDeployKeyEnable", new()
        {
            Project = fooProject.Id,
            KeyId = parentDeployKey.DeployKeyId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.Project;
    import com.pulumi.gitlab.DeployKey;
    import com.pulumi.gitlab.DeployKeyArgs;
    import com.pulumi.gitlab.DeployKeyEnable;
    import com.pulumi.gitlab.DeployKeyEnableArgs;
    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 parentProject = new Project("parentProject");
    
            var fooProject = new Project("fooProject");
    
            var parentDeployKey = new DeployKey("parentDeployKey", DeployKeyArgs.builder()        
                .project(parentProject.id())
                .title("Example deploy key")
                .key("ssh-ed25519 AAAA...")
                .build());
    
            var fooDeployKeyEnable = new DeployKeyEnable("fooDeployKeyEnable", DeployKeyEnableArgs.builder()        
                .project(fooProject.id())
                .keyId(parentDeployKey.deployKeyId())
                .build());
    
        }
    }
    
    resources:
      # A repo to host the deployment key
      parentProject:
        type: gitlab:Project
      # A second repo to use the deployment key from the parent project
      fooProject:
        type: gitlab:Project
      # Upload a deployment key for the parent repo
      parentDeployKey:
        type: gitlab:DeployKey
        properties:
          project: ${parentProject.id}
          title: Example deploy key
          key: ssh-ed25519 AAAA...
      # Enable the deployment key on the second repo
      fooDeployKeyEnable:
        type: gitlab:DeployKeyEnable
        properties:
          project: ${fooProject.id}
          keyId: ${parentDeployKey.deployKeyId}
    

    Create DeployKeyEnable Resource

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

    Constructor syntax

    new DeployKeyEnable(name: string, args: DeployKeyEnableArgs, opts?: CustomResourceOptions);
    @overload
    def DeployKeyEnable(resource_name: str,
                        args: DeployKeyEnableArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def DeployKeyEnable(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        key_id: Optional[str] = None,
                        project: Optional[str] = None,
                        can_push: Optional[bool] = None,
                        key: Optional[str] = None,
                        title: Optional[str] = None)
    func NewDeployKeyEnable(ctx *Context, name string, args DeployKeyEnableArgs, opts ...ResourceOption) (*DeployKeyEnable, error)
    public DeployKeyEnable(string name, DeployKeyEnableArgs args, CustomResourceOptions? opts = null)
    public DeployKeyEnable(String name, DeployKeyEnableArgs args)
    public DeployKeyEnable(String name, DeployKeyEnableArgs args, CustomResourceOptions options)
    
    type: gitlab:DeployKeyEnable
    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 DeployKeyEnableArgs
    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 DeployKeyEnableArgs
    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 DeployKeyEnableArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DeployKeyEnableArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DeployKeyEnableArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var deployKeyEnableResource = new GitLab.DeployKeyEnable("deployKeyEnableResource", new()
    {
        KeyId = "string",
        Project = "string",
        CanPush = false,
        Key = "string",
        Title = "string",
    });
    
    example, err := gitlab.NewDeployKeyEnable(ctx, "deployKeyEnableResource", &gitlab.DeployKeyEnableArgs{
    	KeyId:   pulumi.String("string"),
    	Project: pulumi.String("string"),
    	CanPush: pulumi.Bool(false),
    	Key:     pulumi.String("string"),
    	Title:   pulumi.String("string"),
    })
    
    var deployKeyEnableResource = new DeployKeyEnable("deployKeyEnableResource", DeployKeyEnableArgs.builder()        
        .keyId("string")
        .project("string")
        .canPush(false)
        .key("string")
        .title("string")
        .build());
    
    deploy_key_enable_resource = gitlab.DeployKeyEnable("deployKeyEnableResource",
        key_id="string",
        project="string",
        can_push=False,
        key="string",
        title="string")
    
    const deployKeyEnableResource = new gitlab.DeployKeyEnable("deployKeyEnableResource", {
        keyId: "string",
        project: "string",
        canPush: false,
        key: "string",
        title: "string",
    });
    
    type: gitlab:DeployKeyEnable
    properties:
        canPush: false
        key: string
        keyId: string
        project: string
        title: string
    

    DeployKeyEnable Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The DeployKeyEnable resource accepts the following input properties:

    KeyId string
    The Gitlab key id for the pre-existing deploy key
    Project string
    The name or id of the project to add the deploy key to.
    CanPush bool
    Can deploy key push to the project's repository.
    Key string
    Deploy key.
    Title string
    Deploy key's title.
    KeyId string
    The Gitlab key id for the pre-existing deploy key
    Project string
    The name or id of the project to add the deploy key to.
    CanPush bool
    Can deploy key push to the project's repository.
    Key string
    Deploy key.
    Title string
    Deploy key's title.
    keyId String
    The Gitlab key id for the pre-existing deploy key
    project String
    The name or id of the project to add the deploy key to.
    canPush Boolean
    Can deploy key push to the project's repository.
    key String
    Deploy key.
    title String
    Deploy key's title.
    keyId string
    The Gitlab key id for the pre-existing deploy key
    project string
    The name or id of the project to add the deploy key to.
    canPush boolean
    Can deploy key push to the project's repository.
    key string
    Deploy key.
    title string
    Deploy key's title.
    key_id str
    The Gitlab key id for the pre-existing deploy key
    project str
    The name or id of the project to add the deploy key to.
    can_push bool
    Can deploy key push to the project's repository.
    key str
    Deploy key.
    title str
    Deploy key's title.
    keyId String
    The Gitlab key id for the pre-existing deploy key
    project String
    The name or id of the project to add the deploy key to.
    canPush Boolean
    Can deploy key push to the project's repository.
    key String
    Deploy key.
    title String
    Deploy key's title.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DeployKeyEnable 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 DeployKeyEnable Resource

    Get an existing DeployKeyEnable 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?: DeployKeyEnableState, opts?: CustomResourceOptions): DeployKeyEnable
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            can_push: Optional[bool] = None,
            key: Optional[str] = None,
            key_id: Optional[str] = None,
            project: Optional[str] = None,
            title: Optional[str] = None) -> DeployKeyEnable
    func GetDeployKeyEnable(ctx *Context, name string, id IDInput, state *DeployKeyEnableState, opts ...ResourceOption) (*DeployKeyEnable, error)
    public static DeployKeyEnable Get(string name, Input<string> id, DeployKeyEnableState? state, CustomResourceOptions? opts = null)
    public static DeployKeyEnable get(String name, Output<String> id, DeployKeyEnableState 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:
    CanPush bool
    Can deploy key push to the project's repository.
    Key string
    Deploy key.
    KeyId string
    The Gitlab key id for the pre-existing deploy key
    Project string
    The name or id of the project to add the deploy key to.
    Title string
    Deploy key's title.
    CanPush bool
    Can deploy key push to the project's repository.
    Key string
    Deploy key.
    KeyId string
    The Gitlab key id for the pre-existing deploy key
    Project string
    The name or id of the project to add the deploy key to.
    Title string
    Deploy key's title.
    canPush Boolean
    Can deploy key push to the project's repository.
    key String
    Deploy key.
    keyId String
    The Gitlab key id for the pre-existing deploy key
    project String
    The name or id of the project to add the deploy key to.
    title String
    Deploy key's title.
    canPush boolean
    Can deploy key push to the project's repository.
    key string
    Deploy key.
    keyId string
    The Gitlab key id for the pre-existing deploy key
    project string
    The name or id of the project to add the deploy key to.
    title string
    Deploy key's title.
    can_push bool
    Can deploy key push to the project's repository.
    key str
    Deploy key.
    key_id str
    The Gitlab key id for the pre-existing deploy key
    project str
    The name or id of the project to add the deploy key to.
    title str
    Deploy key's title.
    canPush Boolean
    Can deploy key push to the project's repository.
    key String
    Deploy key.
    keyId String
    The Gitlab key id for the pre-existing deploy key
    project String
    The name or id of the project to add the deploy key to.
    title String
    Deploy key's title.

    Import

    GitLab enabled deploy keys can be imported using an id made up of {project_id}:{deploy_key_id}, e.g.

    project_id can be whatever the [get single project api][get_single_project] takes for

    its :id value, so for example:

    $ pulumi import gitlab:index/deployKeyEnable:DeployKeyEnable example 12345:67890
    
    $ pulumi import gitlab:index/deployKeyEnable:DeployKeyEnable example richardc/example:67890
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    GitLab v6.10.0 published on Monday, Mar 25, 2024 by Pulumi