1. Packages
  2. Lxd Provider
  3. API Docs
  4. getProject
lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd

lxd.getProject

Explore with Pulumi AI

lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd

# lxd.Project

Provides information about an existing LXD project.

Example Usage

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

const _default = lxd.getProject({
    name: "default",
});
const inst = new lxd.Instance("inst", {
    image: "ubuntu:24.04",
    project: _default.then(_default => _default.name),
});
Copy
import pulumi
import pulumi_lxd as lxd

default = lxd.get_project(name="default")
inst = lxd.Instance("inst",
    image="ubuntu:24.04",
    project=default.name)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_default, err := lxd.LookupProject(ctx, &lxd.LookupProjectArgs{
			Name: "default",
		}, nil)
		if err != nil {
			return err
		}
		_, err = lxd.NewInstance(ctx, "inst", &lxd.InstanceArgs{
			Image:   pulumi.String("ubuntu:24.04"),
			Project: pulumi.String(_default.Name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Lxd = Pulumi.Lxd;

return await Deployment.RunAsync(() => 
{
    var @default = Lxd.GetProject.Invoke(new()
    {
        Name = "default",
    });

    var inst = new Lxd.Instance("inst", new()
    {
        Image = "ubuntu:24.04",
        Project = @default.Apply(@default => @default.Apply(getProjectResult => getProjectResult.Name)),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.lxd.LxdFunctions;
import com.pulumi.lxd.inputs.GetProjectArgs;
import com.pulumi.lxd.Instance;
import com.pulumi.lxd.InstanceArgs;
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) {
        final var default = LxdFunctions.getProject(GetProjectArgs.builder()
            .name("default")
            .build());

        var inst = new Instance("inst", InstanceArgs.builder()
            .image("ubuntu:24.04")
            .project(default_.name())
            .build());

    }
}
Copy
resources:
  inst:
    type: lxd:Instance
    properties:
      image: ubuntu:24.04
      project: ${default.name}
variables:
  default:
    fn::invoke:
      function: lxd:getProject
      arguments:
        name: default
Copy

Using getProject

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getProject(args: GetProjectArgs, opts?: InvokeOptions): Promise<GetProjectResult>
function getProjectOutput(args: GetProjectOutputArgs, opts?: InvokeOptions): Output<GetProjectResult>
Copy
def get_project(name: Optional[str] = None,
                remote: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetProjectResult
def get_project_output(name: Optional[pulumi.Input[str]] = None,
                remote: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetProjectResult]
Copy
func LookupProject(ctx *Context, args *LookupProjectArgs, opts ...InvokeOption) (*LookupProjectResult, error)
func LookupProjectOutput(ctx *Context, args *LookupProjectOutputArgs, opts ...InvokeOption) LookupProjectResultOutput
Copy

> Note: This function is named LookupProject in the Go SDK.

public static class GetProject 
{
    public static Task<GetProjectResult> InvokeAsync(GetProjectArgs args, InvokeOptions? opts = null)
    public static Output<GetProjectResult> Invoke(GetProjectInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetProjectResult> getProject(GetProjectArgs args, InvokeOptions options)
public static Output<GetProjectResult> getProject(GetProjectArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: lxd:index/getProject:getProject
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Required - Name of the project.
Remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
Name This property is required. string
Required - Name of the project.
Remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. String
Required - Name of the project.
remote String
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. string
Required - Name of the project.
remote string
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. str
Required - Name of the project.
remote str
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.
name This property is required. String
Required - Name of the project.
remote String
Optional - The remote in which the resource was created. If not provided, the provider's default remote is used.

getProject Result

The following output properties are available:

Config Dictionary<string, string>
Map of key/value pairs of project config settings.
Description string
Description of the project.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Remote string
Config map[string]string
Map of key/value pairs of project config settings.
Description string
Description of the project.
Id string
The provider-assigned unique ID for this managed resource.
Name string
Remote string
config Map<String,String>
Map of key/value pairs of project config settings.
description String
Description of the project.
id String
The provider-assigned unique ID for this managed resource.
name String
remote String
config {[key: string]: string}
Map of key/value pairs of project config settings.
description string
Description of the project.
id string
The provider-assigned unique ID for this managed resource.
name string
remote string
config Mapping[str, str]
Map of key/value pairs of project config settings.
description str
Description of the project.
id str
The provider-assigned unique ID for this managed resource.
name str
remote str
config Map<String>
Map of key/value pairs of project config settings.
description String
Description of the project.
id String
The provider-assigned unique ID for this managed resource.
name String
remote String

Package Details

Repository
lxd terraform-lxd/terraform-provider-lxd
License
Notes
This Pulumi package is based on the lxd Terraform Provider.
lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd