digitalocean.ProjectResources
Explore with Pulumi AI
Assign resources to a DigitalOcean Project. This is useful if you need to assign resources managed via this provider to a DigitalOcean Project managed outside of the provider.
The following resource types can be associated with a project:
- App Platform Apps
- Database Clusters
- Domains
- Droplets
- Floating IPs
- Kubernetes Clusters
- Load Balancers
- Spaces Buckets
- Volumes
Example Usage
The following example assigns a droplet to a Project managed outside of the provider:
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const playground = digitalocean.getProject({
name: "playground",
});
const foobar = new digitalocean.Droplet("foobar", {
name: "example",
size: digitalocean.DropletSlug.DropletS1VCPU1GB,
image: "ubuntu-22-04-x64",
region: digitalocean.Region.NYC3,
});
const barfoo = new digitalocean.ProjectResources("barfoo", {
project: playground.then(playground => playground.id),
resources: [foobar.dropletUrn],
});
import pulumi
import pulumi_digitalocean as digitalocean
playground = digitalocean.get_project(name="playground")
foobar = digitalocean.Droplet("foobar",
name="example",
size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
image="ubuntu-22-04-x64",
region=digitalocean.Region.NYC3)
barfoo = digitalocean.ProjectResources("barfoo",
project=playground.id,
resources=[foobar.droplet_urn])
package main
import (
"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
playground, err := digitalocean.LookupProject(ctx, &digitalocean.LookupProjectArgs{
Name: pulumi.StringRef("playground"),
}, nil)
if err != nil {
return err
}
foobar, err := digitalocean.NewDroplet(ctx, "foobar", &digitalocean.DropletArgs{
Name: pulumi.String("example"),
Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
Image: pulumi.String("ubuntu-22-04-x64"),
Region: pulumi.String(digitalocean.RegionNYC3),
})
if err != nil {
return err
}
_, err = digitalocean.NewProjectResources(ctx, "barfoo", &digitalocean.ProjectResourcesArgs{
Project: pulumi.String(playground.Id),
Resources: pulumi.StringArray{
foobar.DropletUrn,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var playground = DigitalOcean.GetProject.Invoke(new()
{
Name = "playground",
});
var foobar = new DigitalOcean.Droplet("foobar", new()
{
Name = "example",
Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
Image = "ubuntu-22-04-x64",
Region = DigitalOcean.Region.NYC3,
});
var barfoo = new DigitalOcean.ProjectResources("barfoo", new()
{
Project = playground.Apply(getProjectResult => getProjectResult.Id),
Resources = new[]
{
foobar.DropletUrn,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetProjectArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import com.pulumi.digitalocean.ProjectResources;
import com.pulumi.digitalocean.ProjectResourcesArgs;
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 playground = DigitaloceanFunctions.getProject(GetProjectArgs.builder()
.name("playground")
.build());
var foobar = new Droplet("foobar", DropletArgs.builder()
.name("example")
.size("s-1vcpu-1gb")
.image("ubuntu-22-04-x64")
.region("nyc3")
.build());
var barfoo = new ProjectResources("barfoo", ProjectResourcesArgs.builder()
.project(playground.applyValue(getProjectResult -> getProjectResult.id()))
.resources(foobar.dropletUrn())
.build());
}
}
resources:
foobar:
type: digitalocean:Droplet
properties:
name: example
size: s-1vcpu-1gb
image: ubuntu-22-04-x64
region: nyc3
barfoo:
type: digitalocean:ProjectResources
properties:
project: ${playground.id}
resources:
- ${foobar.dropletUrn}
variables:
playground:
fn::invoke:
Function: digitalocean:getProject
Arguments:
name: playground
Create ProjectResources Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectResources(name: string, args: ProjectResourcesArgs, opts?: CustomResourceOptions);
@overload
def ProjectResources(resource_name: str,
args: ProjectResourcesArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectResources(resource_name: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = None,
resources: Optional[Sequence[str]] = None)
func NewProjectResources(ctx *Context, name string, args ProjectResourcesArgs, opts ...ResourceOption) (*ProjectResources, error)
public ProjectResources(string name, ProjectResourcesArgs args, CustomResourceOptions? opts = null)
public ProjectResources(String name, ProjectResourcesArgs args)
public ProjectResources(String name, ProjectResourcesArgs args, CustomResourceOptions options)
type: digitalocean:ProjectResources
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 ProjectResourcesArgs
- 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 ProjectResourcesArgs
- 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 ProjectResourcesArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectResourcesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectResourcesArgs
- 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 projectResourcesResource = new DigitalOcean.ProjectResources("projectResourcesResource", new()
{
Project = "string",
Resources = new[]
{
"string",
},
});
example, err := digitalocean.NewProjectResources(ctx, "projectResourcesResource", &digitalocean.ProjectResourcesArgs{
Project: pulumi.String("string"),
Resources: pulumi.StringArray{
pulumi.String("string"),
},
})
var projectResourcesResource = new ProjectResources("projectResourcesResource", ProjectResourcesArgs.builder()
.project("string")
.resources("string")
.build());
project_resources_resource = digitalocean.ProjectResources("projectResourcesResource",
project="string",
resources=["string"])
const projectResourcesResource = new digitalocean.ProjectResources("projectResourcesResource", {
project: "string",
resources: ["string"],
});
type: digitalocean:ProjectResources
properties:
project: string
resources:
- string
ProjectResources 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 ProjectResources resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectResources 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 ProjectResources Resource
Get an existing ProjectResources 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?: ProjectResourcesState, opts?: CustomResourceOptions): ProjectResources
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = None,
resources: Optional[Sequence[str]] = None) -> ProjectResources
func GetProjectResources(ctx *Context, name string, id IDInput, state *ProjectResourcesState, opts ...ResourceOption) (*ProjectResources, error)
public static ProjectResources Get(string name, Input<string> id, ProjectResourcesState? state, CustomResourceOptions? opts = null)
public static ProjectResources get(String name, Output<String> id, ProjectResourcesState 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.
Import
Importing this resource is not supported.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.