Resource options
All Pulumi IaC resources support a common set of options that allow you to customize how your resources are managed. Resource options allow you to do things like protect resources from being deleted, express more fine-grained control to the order in which resources are changed, or apply custom code that will allow you to change the properties of your resources.
Resource constructors accept the following resource options. Each option’s reference page describes its behavior in depth and how the Pulumi SDKs enforce which resource types it applies to.
| Resource option | Description | Applies to |
|---|---|---|
| additionalSecretOutputs | Specify output properties that must be encrypted as secrets. | Custom only |
| aliases | Specify aliases so that renaming or refactoring doesn’t replace a resource. | Custom and component |
| customTimeouts | Override the default retry/timeout behavior for resource provisioning. | Custom only |
| deleteBeforeReplace | Delete the existing resource before creating its replacement. | Custom only |
| deletedWith | Skip this resource’s delete when the named resource is also being deleted. | Custom and component |
| dependsOn | Specify explicit dependencies in addition to those in the dependency graph. | Custom and component |
| envVarMappings | Remap environment variables to custom keys for provider authentication. | Provider only |
| hideDiffs | Compact the display of diffs for specified properties in CLI output. | Custom only |
| hooks | Run custom logic at specific points in the resource lifecycle. | Custom only |
| ignoreChanges | Ignore changes to specified properties during a diff. | Custom only |
| import | Bring an existing cloud resource under Pulumi management. | Custom only |
| parent | Establish a parent/child relationship between resources. | Custom and component |
| protect | Prevent accidental deletion by marking the resource as protected. | Custom and component |
| provider | Pass an explicitly configured provider instead of the default. | Custom only |
| providers | Pass explicitly configured providers for a component’s child resources. | Component only |
| replaceOnChanges | Treat changes to specified properties as forcing a replacement. | Custom only |
| replaceWith | Replace this resource whenever one of the named resources is replaced. | Custom only |
| replacementTrigger | Force a replacement whenever a specified trigger value changes. | Custom and component |
| retainOnDelete | Retain the resource in the cloud provider when Pulumi deletes it. | Custom only |
| transformations | Dynamically transform a resource’s properties (prefer transforms). | Custom and component |
| transforms | Dynamically transform a resource’s properties on the fly. | Custom and component |
| version | Pin the provider plugin version used when operating on a resource. | Custom only |
Resource options and component resources
Not all resource options apply to component resources. Component resources are logical groupings that don’t have a backing cloud provider, so options that affect provider behavior have no effect on the component itself (though they may affect child resources). The Applies to column in the table above shows which options apply to component resources; each option’s reference page explains the behavior in detail.
protect or ignoreChanges to the child resources within a component, use the transforms option to modify child resources as they’re created.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.