Resources

Resources represent the fundamental units that make up your cloud infrastructure, such as a compute instance, a storage bucket, or a Kubernetes cluster.

All infrastructure resources are described by one of two subclasses of the Resource class. These two subclasses are:

  • CustomResource: A custom resource is a cloud resource managed by a resource provider such as AWS, Microsoft Azure, Google Cloud or Kubernetes.
  • ComponentResource: A component resource is a logical grouping of other resources that creates a larger, higher-level abstraction that encapsulates its implementation details.

A resource’s desired state is declared by constructing an instance of the resource:

let res = new Resource(name, args, options);
let res = new Resource(name, args, options);
res = Resource(name, args, options)
res, err := NewResource(ctx, name, args, opt1, opt2)
var res = new Resource(name, args, options);
var res = new Resource(name, args, options);
resources:
  res:
    type: the:resource:Type
    properties: ...args
    options: ...options

All resources have a required name argument, which must be unique across resources of the same kind in a stack. This logical name influences the physical name assigned by your infrastructure’s cloud provider. Pulumi auto-names physical resources by default, so the physical name and the logical name may differ. This auto-naming behavior can be overridden, if required.

The args argument is an object with a set of named property input values that are used to initialize the resource. These can be normal raw values—such as strings, integers, lists, and maps—or outputs from other resources. Each resource has a number of named input properties that control the behavior of the resulting infrastructure. To determine what arguments a resource supports, refer to that resource’s API documentation in the Registry.

The options argument is optional, but lets you control certain aspects of the resource. For example, you can show explicit dependencies, use a custom provider configuration, or import an existing infrastructure.

Resource Details

The following topics provide more details on the core concepts for working with resources in Pulumi:

Resource Names

Learn how Pulumi projects are organized and configured.

Resource Options

Learn how to use resource options to modify the way that resources are managed by Pulumi.

Components

Learn how to create and deploy stacks.

Providers

Learn more about how to use and manage resources in your program.

Dynamic Providers

Learn how Pulumi stores state and manages concurrency.

Getter Functions

Learn how to configure stacks for different deployment scenarios.