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 more about resource names and how to use them.
Resource Options
Learn how to use resource options to modify the way that resources are managed by Pulumi.
Components
Learn what a component resource is, how to author a new component resource, how to create child resources, and more.
Providers
Learn how a resource provider handles communications with a cloud service to create, read, update, and delete the resources you define in your Pulumi programs.
Dynamic Providers
Learn how to use dynamic providers and use cases for them.
Getter Functions
Learn how a Pulumi resource uses its `get` function to retrieve a reference to an existing instance of the resource.
Provider Functions
Learn how to use the functions included with Pulumi packages.
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.