1. Packages
  2. Sonarqube Provider
  3. API Docs
  4. Project
sonarqube 0.16.14 published on Monday, Apr 14, 2025 by jdamata

sonarqube.Project

Explore with Pulumi AI

Provides a Sonarqube Project resource. This can be used to create and manage Sonarqube Project.

Example Usage

Example: create a project

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

const main = new sonarqube.Project("main", {
    project: "my_project",
    visibility: "public",
});
Copy
import pulumi
import pulumi_sonarqube as sonarqube

main = sonarqube.Project("main",
    project="my_project",
    visibility="public")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/sonarqube/sonarqube"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sonarqube.NewProject(ctx, "main", &sonarqube.ProjectArgs{
			Project:    pulumi.String("my_project"),
			Visibility: pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;

return await Deployment.RunAsync(() => 
{
    var main = new Sonarqube.Project("main", new()
    {
        Project = "my_project",
        Visibility = "public",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.Project;
import com.pulumi.sonarqube.ProjectArgs;
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 main = new Project("main", ProjectArgs.builder()
            .project("my_project")
            .visibility("public")
            .build());

    }
}
Copy
resources:
  main:
    type: sonarqube:Project
    properties:
      project: my_project
      visibility: public
Copy

Example: a project with associated settings

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

const main = new sonarqube.Project("main", {
    project: "my_project",
    settings: [{
        key: "sonar.demo",
        value: "sonarqube@example.org",
    }],
    visibility: "public",
});
Copy
import pulumi
import pulumi_sonarqube as sonarqube

main = sonarqube.Project("main",
    project="my_project",
    settings=[{
        "key": "sonar.demo",
        "value": "sonarqube@example.org",
    }],
    visibility="public")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/sonarqube/sonarqube"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := sonarqube.NewProject(ctx, "main", &sonarqube.ProjectArgs{
			Project: pulumi.String("my_project"),
			Settings: sonarqube.ProjectSettingArray{
				&sonarqube.ProjectSettingArgs{
					Key:   pulumi.String("sonar.demo"),
					Value: pulumi.String("sonarqube@example.org"),
				},
			},
			Visibility: pulumi.String("public"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Sonarqube = Pulumi.Sonarqube;

return await Deployment.RunAsync(() => 
{
    var main = new Sonarqube.Project("main", new()
    {
        Project = "my_project",
        Settings = new[]
        {
            new Sonarqube.Inputs.ProjectSettingArgs
            {
                Key = "sonar.demo",
                Value = "sonarqube@example.org",
            },
        },
        Visibility = "public",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.sonarqube.Project;
import com.pulumi.sonarqube.ProjectArgs;
import com.pulumi.sonarqube.inputs.ProjectSettingArgs;
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 main = new Project("main", ProjectArgs.builder()
            .project("my_project")
            .settings(ProjectSettingArgs.builder()
                .key("sonar.demo")
                .value("sonarqube@example.org")
                .build())
            .visibility("public")
            .build());

    }
}
Copy
resources:
  main:
    type: sonarqube:Project
    properties:
      project: my_project
      settings:
        - key: sonar.demo
          value: sonarqube@example.org
      visibility: public
Copy

Create Project Resource

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

Constructor syntax

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

@overload
def Project(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            project: Optional[str] = None,
            name: Optional[str] = None,
            project_id: Optional[str] = None,
            settings: Optional[Sequence[ProjectSettingArgs]] = None,
            tags: Optional[Sequence[str]] = None,
            visibility: Optional[str] = None)
func NewProject(ctx *Context, name string, args ProjectArgs, opts ...ResourceOption) (*Project, error)
public Project(string name, ProjectArgs args, CustomResourceOptions? opts = null)
public Project(String name, ProjectArgs args)
public Project(String name, ProjectArgs args, CustomResourceOptions options)
type: sonarqube:Project
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. ProjectArgs
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. ProjectArgs
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. ProjectArgs
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. ProjectArgs
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. ProjectArgs
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 projectResource = new Sonarqube.Project("projectResource", new()
{
    Project = "string",
    Name = "string",
    ProjectId = "string",
    Settings = new[]
    {
        new Sonarqube.Inputs.ProjectSettingArgs
        {
            Key = "string",
            FieldValues = new[]
            {
                
                {
                    { "string", "string" },
                },
            },
            Value = "string",
            Values = new[]
            {
                "string",
            },
        },
    },
    Tags = new[]
    {
        "string",
    },
    Visibility = "string",
});
Copy
example, err := sonarqube.NewProject(ctx, "projectResource", &sonarqube.ProjectArgs{
	Project:   pulumi.String("string"),
	Name:      pulumi.String("string"),
	ProjectId: pulumi.String("string"),
	Settings: sonarqube.ProjectSettingArray{
		&sonarqube.ProjectSettingArgs{
			Key: pulumi.String("string"),
			FieldValues: pulumi.StringMapArray{
				pulumi.StringMap{
					"string": pulumi.String("string"),
				},
			},
			Value: pulumi.String("string"),
			Values: pulumi.StringArray{
				pulumi.String("string"),
			},
		},
	},
	Tags: pulumi.StringArray{
		pulumi.String("string"),
	},
	Visibility: pulumi.String("string"),
})
Copy
var projectResource = new Project("projectResource", ProjectArgs.builder()
    .project("string")
    .name("string")
    .projectId("string")
    .settings(ProjectSettingArgs.builder()
        .key("string")
        .fieldValues(Map.of("string", "string"))
        .value("string")
        .values("string")
        .build())
    .tags("string")
    .visibility("string")
    .build());
Copy
project_resource = sonarqube.Project("projectResource",
    project="string",
    name="string",
    project_id="string",
    settings=[{
        "key": "string",
        "field_values": [{
            "string": "string",
        }],
        "value": "string",
        "values": ["string"],
    }],
    tags=["string"],
    visibility="string")
Copy
const projectResource = new sonarqube.Project("projectResource", {
    project: "string",
    name: "string",
    projectId: "string",
    settings: [{
        key: "string",
        fieldValues: [{
            string: "string",
        }],
        value: "string",
        values: ["string"],
    }],
    tags: ["string"],
    visibility: "string",
});
Copy
type: sonarqube:Project
properties:
    name: string
    project: string
    projectId: string
    settings:
        - fieldValues:
            - string: string
          key: string
          value: string
          values:
            - string
    tags:
        - string
    visibility: string
Copy

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

Project This property is required. string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
Name string
The name of the Project to create
ProjectId string
The ID of this resource.
Settings List<ProjectSetting>
A list of settings associated to the project
Tags List<string>
A list of tags to put on the project.
Visibility string
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
Project This property is required. string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
Name string
The name of the Project to create
ProjectId string
The ID of this resource.
Settings []ProjectSettingArgs
A list of settings associated to the project
Tags []string
A list of tags to put on the project.
Visibility string
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
project This property is required. String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name String
The name of the Project to create
projectId String
The ID of this resource.
settings List<ProjectSetting>
A list of settings associated to the project
tags List<String>
A list of tags to put on the project.
visibility String
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
project This property is required. string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name string
The name of the Project to create
projectId string
The ID of this resource.
settings ProjectSetting[]
A list of settings associated to the project
tags string[]
A list of tags to put on the project.
visibility string
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
project This property is required. str
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name str
The name of the Project to create
project_id str
The ID of this resource.
settings Sequence[ProjectSettingArgs]
A list of settings associated to the project
tags Sequence[str]
A list of tags to put on the project.
visibility str
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
project This property is required. String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
name String
The name of the Project to create
projectId String
The ID of this resource.
settings List<Property Map>
A list of settings associated to the project
tags List<String>
A list of tags to put on the project.
visibility String
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.

Outputs

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

Get an existing Project 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?: ProjectState, opts?: CustomResourceOptions): Project
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        project_id: Optional[str] = None,
        settings: Optional[Sequence[ProjectSettingArgs]] = None,
        tags: Optional[Sequence[str]] = None,
        visibility: Optional[str] = None) -> Project
func GetProject(ctx *Context, name string, id IDInput, state *ProjectState, opts ...ResourceOption) (*Project, error)
public static Project Get(string name, Input<string> id, ProjectState? state, CustomResourceOptions? opts = null)
public static Project get(String name, Output<String> id, ProjectState state, CustomResourceOptions options)
resources:  _:    type: sonarqube:Project    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:
Name string
The name of the Project to create
Project string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
ProjectId string
The ID of this resource.
Settings List<ProjectSetting>
A list of settings associated to the project
Tags List<string>
A list of tags to put on the project.
Visibility string
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
Name string
The name of the Project to create
Project string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
ProjectId string
The ID of this resource.
Settings []ProjectSettingArgs
A list of settings associated to the project
Tags []string
A list of tags to put on the project.
Visibility string
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
name String
The name of the Project to create
project String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
projectId String
The ID of this resource.
settings List<ProjectSetting>
A list of settings associated to the project
tags List<String>
A list of tags to put on the project.
visibility String
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
name string
The name of the Project to create
project string
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
projectId string
The ID of this resource.
settings ProjectSetting[]
A list of settings associated to the project
tags string[]
A list of tags to put on the project.
visibility string
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
name str
The name of the Project to create
project str
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
project_id str
The ID of this resource.
settings Sequence[ProjectSettingArgs]
A list of settings associated to the project
tags Sequence[str]
A list of tags to put on the project.
visibility str
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.
name String
The name of the Project to create
project String
Key of the project. Maximum length 400. All letters, digits, dash, underscore, period or colon.
projectId String
The ID of this resource.
settings List<Property Map>
A list of settings associated to the project
tags List<String>
A list of tags to put on the project.
visibility String
Whether the created project should be visible to everyone, or only specific user/groups. If no visibility is specified, the default project visibility of the organization will be used. Valid values are public and private.

Supporting Types

ProjectSetting
, ProjectSettingArgs

Key This property is required. string
Setting key
FieldValues List<ImmutableDictionary<string, string>>
Setting field values for the supplied key
Value string
Setting a value for the supplied key
Values List<string>
Setting multi values for the supplied key
Key This property is required. string
Setting key
FieldValues []map[string]string
Setting field values for the supplied key
Value string
Setting a value for the supplied key
Values []string
Setting multi values for the supplied key
key This property is required. String
Setting key
fieldValues List<Map<String,String>>
Setting field values for the supplied key
value String
Setting a value for the supplied key
values List<String>
Setting multi values for the supplied key
key This property is required. string
Setting key
fieldValues {[key: string]: string}[]
Setting field values for the supplied key
value string
Setting a value for the supplied key
values string[]
Setting multi values for the supplied key
key This property is required. str
Setting key
field_values Sequence[Mapping[str, str]]
Setting field values for the supplied key
value str
Setting a value for the supplied key
values Sequence[str]
Setting multi values for the supplied key
key This property is required. String
Setting key
fieldValues List<Map<String>>
Setting field values for the supplied key
value String
Setting a value for the supplied key
values List<String>
Setting multi values for the supplied key

Package Details

Repository
sonarqube jdamata/terraform-provider-sonarqube
License
Notes
This Pulumi package is based on the sonarqube Terraform Provider.