The gitlab.ProjectIssueLink resource allows to manage the lifecycle of project issue links.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
// Create a project
const example = new gitlab.Project("example", {
name: "example",
description: "An example project",
visibilityLevel: "public",
});
// Create source issue
const source = new gitlab.ProjectIssue("source", {
project: example.id,
title: "Source Issue",
});
// Create target issue
const target = new gitlab.ProjectIssue("target", {
project: example.id,
title: "Target Issue",
});
// Link issues with "relates_to" link type (default)
const relatesTo = new gitlab.ProjectIssueLink("relates_to", {
project: example.id,
issueIid: source.iid,
targetProjectId: example.id,
targetIssueIid: target.iid,
linkType: "relates_to",
});
// Cross-project linking example
const otherProject = new gitlab.Project("other_project", {
name: "other_project",
description: "Another project for cross-project linking",
});
const crossTarget = new gitlab.ProjectIssue("cross_target", {
project: otherProject.id,
title: "Cross-Project Target Issue",
});
const crossProjectRelatesTo = new gitlab.ProjectIssueLink("cross_project_relates_to", {
project: example.id,
issueIid: source.iid,
targetProjectId: otherProject.id,
targetIssueIid: crossTarget.iid,
linkType: "relates_to",
});
import pulumi
import pulumi_gitlab as gitlab
# Create a project
example = gitlab.Project("example",
name="example",
description="An example project",
visibility_level="public")
# Create source issue
source = gitlab.ProjectIssue("source",
project=example.id,
title="Source Issue")
# Create target issue
target = gitlab.ProjectIssue("target",
project=example.id,
title="Target Issue")
# Link issues with "relates_to" link type (default)
relates_to = gitlab.ProjectIssueLink("relates_to",
project=example.id,
issue_iid=source.iid,
target_project_id=example.id,
target_issue_iid=target.iid,
link_type="relates_to")
# Cross-project linking example
other_project = gitlab.Project("other_project",
name="other_project",
description="Another project for cross-project linking")
cross_target = gitlab.ProjectIssue("cross_target",
project=other_project.id,
title="Cross-Project Target Issue")
cross_project_relates_to = gitlab.ProjectIssueLink("cross_project_relates_to",
project=example.id,
issue_iid=source.iid,
target_project_id=other_project.id,
target_issue_iid=cross_target.iid,
link_type="relates_to")
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v9/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a project
example, err := gitlab.NewProject(ctx, "example", &gitlab.ProjectArgs{
Name: pulumi.String("example"),
Description: pulumi.String("An example project"),
VisibilityLevel: pulumi.String("public"),
})
if err != nil {
return err
}
// Create source issue
source, err := gitlab.NewProjectIssue(ctx, "source", &gitlab.ProjectIssueArgs{
Project: example.ID(),
Title: pulumi.String("Source Issue"),
})
if err != nil {
return err
}
// Create target issue
target, err := gitlab.NewProjectIssue(ctx, "target", &gitlab.ProjectIssueArgs{
Project: example.ID(),
Title: pulumi.String("Target Issue"),
})
if err != nil {
return err
}
// Link issues with "relates_to" link type (default)
_, err = gitlab.NewProjectIssueLink(ctx, "relates_to", &gitlab.ProjectIssueLinkArgs{
Project: example.ID(),
IssueIid: source.Iid,
TargetProjectId: example.ID(),
TargetIssueIid: target.Iid,
LinkType: pulumi.String("relates_to"),
})
if err != nil {
return err
}
// Cross-project linking example
otherProject, err := gitlab.NewProject(ctx, "other_project", &gitlab.ProjectArgs{
Name: pulumi.String("other_project"),
Description: pulumi.String("Another project for cross-project linking"),
})
if err != nil {
return err
}
crossTarget, err := gitlab.NewProjectIssue(ctx, "cross_target", &gitlab.ProjectIssueArgs{
Project: otherProject.ID(),
Title: pulumi.String("Cross-Project Target Issue"),
})
if err != nil {
return err
}
_, err = gitlab.NewProjectIssueLink(ctx, "cross_project_relates_to", &gitlab.ProjectIssueLinkArgs{
Project: example.ID(),
IssueIid: source.Iid,
TargetProjectId: otherProject.ID(),
TargetIssueIid: crossTarget.Iid,
LinkType: pulumi.String("relates_to"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
// Create a project
var example = new GitLab.Project("example", new()
{
Name = "example",
Description = "An example project",
VisibilityLevel = "public",
});
// Create source issue
var source = new GitLab.ProjectIssue("source", new()
{
Project = example.Id,
Title = "Source Issue",
});
// Create target issue
var target = new GitLab.ProjectIssue("target", new()
{
Project = example.Id,
Title = "Target Issue",
});
// Link issues with "relates_to" link type (default)
var relatesTo = new GitLab.ProjectIssueLink("relates_to", new()
{
Project = example.Id,
IssueIid = source.Iid,
TargetProjectId = example.Id,
TargetIssueIid = target.Iid,
LinkType = "relates_to",
});
// Cross-project linking example
var otherProject = new GitLab.Project("other_project", new()
{
Name = "other_project",
Description = "Another project for cross-project linking",
});
var crossTarget = new GitLab.ProjectIssue("cross_target", new()
{
Project = otherProject.Id,
Title = "Cross-Project Target Issue",
});
var crossProjectRelatesTo = new GitLab.ProjectIssueLink("cross_project_relates_to", new()
{
Project = example.Id,
IssueIid = source.Iid,
TargetProjectId = otherProject.Id,
TargetIssueIid = crossTarget.Iid,
LinkType = "relates_to",
});
});
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.ProjectArgs;
import com.pulumi.gitlab.ProjectIssue;
import com.pulumi.gitlab.ProjectIssueArgs;
import com.pulumi.gitlab.ProjectIssueLink;
import com.pulumi.gitlab.ProjectIssueLinkArgs;
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) {
// Create a project
var example = new Project("example", ProjectArgs.builder()
.name("example")
.description("An example project")
.visibilityLevel("public")
.build());
// Create source issue
var source = new ProjectIssue("source", ProjectIssueArgs.builder()
.project(example.id())
.title("Source Issue")
.build());
// Create target issue
var target = new ProjectIssue("target", ProjectIssueArgs.builder()
.project(example.id())
.title("Target Issue")
.build());
// Link issues with "relates_to" link type (default)
var relatesTo = new ProjectIssueLink("relatesTo", ProjectIssueLinkArgs.builder()
.project(example.id())
.issueIid(source.iid())
.targetProjectId(example.id())
.targetIssueIid(target.iid())
.linkType("relates_to")
.build());
// Cross-project linking example
var otherProject = new Project("otherProject", ProjectArgs.builder()
.name("other_project")
.description("Another project for cross-project linking")
.build());
var crossTarget = new ProjectIssue("crossTarget", ProjectIssueArgs.builder()
.project(otherProject.id())
.title("Cross-Project Target Issue")
.build());
var crossProjectRelatesTo = new ProjectIssueLink("crossProjectRelatesTo", ProjectIssueLinkArgs.builder()
.project(example.id())
.issueIid(source.iid())
.targetProjectId(otherProject.id())
.targetIssueIid(crossTarget.iid())
.linkType("relates_to")
.build());
}
}
resources:
# Create a project
example:
type: gitlab:Project
properties:
name: example
description: An example project
visibilityLevel: public
# Create source issue
source:
type: gitlab:ProjectIssue
properties:
project: ${example.id}
title: Source Issue
# Create target issue
target:
type: gitlab:ProjectIssue
properties:
project: ${example.id}
title: Target Issue
# Link issues with "relates_to" link type (default)
relatesTo:
type: gitlab:ProjectIssueLink
name: relates_to
properties:
project: ${example.id}
issueIid: ${source.iid}
targetProjectId: ${example.id}
targetIssueIid: ${target.iid}
linkType: relates_to
# Cross-project linking example
otherProject:
type: gitlab:Project
name: other_project
properties:
name: other_project
description: Another project for cross-project linking
crossTarget:
type: gitlab:ProjectIssue
name: cross_target
properties:
project: ${otherProject.id}
title: Cross-Project Target Issue
crossProjectRelatesTo:
type: gitlab:ProjectIssueLink
name: cross_project_relates_to
properties:
project: ${example.id}
issueIid: ${source.iid}
targetProjectId: ${otherProject.id}
targetIssueIid: ${crossTarget.iid}
linkType: relates_to
Create ProjectIssueLink Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectIssueLink(name: string, args: ProjectIssueLinkArgs, opts?: CustomResourceOptions);@overload
def ProjectIssueLink(resource_name: str,
args: ProjectIssueLinkArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectIssueLink(resource_name: str,
opts: Optional[ResourceOptions] = None,
issue_iid: Optional[int] = None,
link_type: Optional[str] = None,
project: Optional[str] = None,
target_issue_iid: Optional[int] = None,
target_project_id: Optional[str] = None)func NewProjectIssueLink(ctx *Context, name string, args ProjectIssueLinkArgs, opts ...ResourceOption) (*ProjectIssueLink, error)public ProjectIssueLink(string name, ProjectIssueLinkArgs args, CustomResourceOptions? opts = null)
public ProjectIssueLink(String name, ProjectIssueLinkArgs args)
public ProjectIssueLink(String name, ProjectIssueLinkArgs args, CustomResourceOptions options)
type: gitlab:ProjectIssueLink
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 ProjectIssueLinkArgs
- 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 ProjectIssueLinkArgs
- 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 ProjectIssueLinkArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectIssueLinkArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectIssueLinkArgs
- 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 projectIssueLinkResource = new GitLab.ProjectIssueLink("projectIssueLinkResource", new()
{
IssueIid = 0,
LinkType = "string",
Project = "string",
TargetIssueIid = 0,
TargetProjectId = "string",
});
example, err := gitlab.NewProjectIssueLink(ctx, "projectIssueLinkResource", &gitlab.ProjectIssueLinkArgs{
IssueIid: pulumi.Int(0),
LinkType: pulumi.String("string"),
Project: pulumi.String("string"),
TargetIssueIid: pulumi.Int(0),
TargetProjectId: pulumi.String("string"),
})
var projectIssueLinkResource = new ProjectIssueLink("projectIssueLinkResource", ProjectIssueLinkArgs.builder()
.issueIid(0)
.linkType("string")
.project("string")
.targetIssueIid(0)
.targetProjectId("string")
.build());
project_issue_link_resource = gitlab.ProjectIssueLink("projectIssueLinkResource",
issue_iid=0,
link_type="string",
project="string",
target_issue_iid=0,
target_project_id="string")
const projectIssueLinkResource = new gitlab.ProjectIssueLink("projectIssueLinkResource", {
issueIid: 0,
linkType: "string",
project: "string",
targetIssueIid: 0,
targetProjectId: "string",
});
type: gitlab:ProjectIssueLink
properties:
issueIid: 0
linkType: string
project: string
targetIssueIid: 0
targetProjectId: string
ProjectIssueLink 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 ProjectIssueLink resource accepts the following input properties:
- Issue
Iid int - The internal ID of a project's issue.
- Link
Type string - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - Project string
- The ID or URL-encoded path of the project.
- Target
Issue intIid - The internal ID of the target issue.
- Target
Project stringId - The ID or URL-encoded path of the target project.
- Issue
Iid int - The internal ID of a project's issue.
- Link
Type string - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - Project string
- The ID or URL-encoded path of the project.
- Target
Issue intIid - The internal ID of the target issue.
- Target
Project stringId - The ID or URL-encoded path of the target project.
- issue
Iid Integer - The internal ID of a project's issue.
- link
Type String - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project String
- The ID or URL-encoded path of the project.
- target
Issue IntegerIid - The internal ID of the target issue.
- target
Project StringId - The ID or URL-encoded path of the target project.
- issue
Iid number - The internal ID of a project's issue.
- link
Type string - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project string
- The ID or URL-encoded path of the project.
- target
Issue numberIid - The internal ID of the target issue.
- target
Project stringId - The ID or URL-encoded path of the target project.
- issue_
iid int - The internal ID of a project's issue.
- link_
type str - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project str
- The ID or URL-encoded path of the project.
- target_
issue_ intiid - The internal ID of the target issue.
- target_
project_ strid - The ID or URL-encoded path of the target project.
- issue
Iid Number - The internal ID of a project's issue.
- link
Type String - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project String
- The ID or URL-encoded path of the project.
- target
Issue NumberIid - The internal ID of the target issue.
- target
Project StringId - The ID or URL-encoded path of the target project.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectIssueLink resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Issue
Link intId - ID of an issue relationship.
- Id string
- The provider-assigned unique ID for this managed resource.
- Issue
Link intId - ID of an issue relationship.
- id String
- The provider-assigned unique ID for this managed resource.
- issue
Link IntegerId - ID of an issue relationship.
- id string
- The provider-assigned unique ID for this managed resource.
- issue
Link numberId - ID of an issue relationship.
- id str
- The provider-assigned unique ID for this managed resource.
- issue_
link_ intid - ID of an issue relationship.
- id String
- The provider-assigned unique ID for this managed resource.
- issue
Link NumberId - ID of an issue relationship.
Look up Existing ProjectIssueLink Resource
Get an existing ProjectIssueLink 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?: ProjectIssueLinkState, opts?: CustomResourceOptions): ProjectIssueLink@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
issue_iid: Optional[int] = None,
issue_link_id: Optional[int] = None,
link_type: Optional[str] = None,
project: Optional[str] = None,
target_issue_iid: Optional[int] = None,
target_project_id: Optional[str] = None) -> ProjectIssueLinkfunc GetProjectIssueLink(ctx *Context, name string, id IDInput, state *ProjectIssueLinkState, opts ...ResourceOption) (*ProjectIssueLink, error)public static ProjectIssueLink Get(string name, Input<string> id, ProjectIssueLinkState? state, CustomResourceOptions? opts = null)public static ProjectIssueLink get(String name, Output<String> id, ProjectIssueLinkState state, CustomResourceOptions options)resources: _: type: gitlab:ProjectIssueLink 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.
- Issue
Iid int - The internal ID of a project's issue.
- Issue
Link intId - ID of an issue relationship.
- Link
Type string - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - Project string
- The ID or URL-encoded path of the project.
- Target
Issue intIid - The internal ID of the target issue.
- Target
Project stringId - The ID or URL-encoded path of the target project.
- Issue
Iid int - The internal ID of a project's issue.
- Issue
Link intId - ID of an issue relationship.
- Link
Type string - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - Project string
- The ID or URL-encoded path of the project.
- Target
Issue intIid - The internal ID of the target issue.
- Target
Project stringId - The ID or URL-encoded path of the target project.
- issue
Iid Integer - The internal ID of a project's issue.
- issue
Link IntegerId - ID of an issue relationship.
- link
Type String - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project String
- The ID or URL-encoded path of the project.
- target
Issue IntegerIid - The internal ID of the target issue.
- target
Project StringId - The ID or URL-encoded path of the target project.
- issue
Iid number - The internal ID of a project's issue.
- issue
Link numberId - ID of an issue relationship.
- link
Type string - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project string
- The ID or URL-encoded path of the project.
- target
Issue numberIid - The internal ID of the target issue.
- target
Project stringId - The ID or URL-encoded path of the target project.
- issue_
iid int - The internal ID of a project's issue.
- issue_
link_ intid - ID of an issue relationship.
- link_
type str - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project str
- The ID or URL-encoded path of the project.
- target_
issue_ intiid - The internal ID of the target issue.
- target_
project_ strid - The ID or URL-encoded path of the target project.
- issue
Iid Number - The internal ID of a project's issue.
- issue
Link NumberId - ID of an issue relationship.
- link
Type String - Type of the relationship. Valid values are
relates_to,blocks,is_blocked_by. - project String
- The ID or URL-encoded path of the project.
- target
Issue NumberIid - The internal ID of the target issue.
- target
Project StringId - The ID or URL-encoded path of the target project.
Import
Starting in Terraform v1.5.0, you can use an import block to import gitlab_project_issue_link. For example:
terraform
import {
to = gitlab_project_issue_link.example
id = “see CLI command below for ID”
}
Importing using the CLI is supported with the following syntax:
You can import this resource with an id made up of {project-id}:{source-issue-iid}:{target-issue-iid}, e.g.
$ pulumi import gitlab:index/projectIssueLink:ProjectIssueLink example 42:1001:1002
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
gitlabTerraform Provider.
