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:
- additionalSecretOutputs: specify properties that must be encrypted as secrets.
- aliases: specify aliases for this resource, so that renaming or refactoring doesn’t replace it.
- customTimeouts: override the default retry/timeout behavior for resource provisioning. The default value varies by resource.
- deleteBeforeReplace: override the default create-before-delete behavior when replacing a resource.
- deletedWith: If set, the provider’s Delete method will not be called for this resource if the specified resource is being deleted as well.
- replaceWith: If set, the resource will be replaced if one of the specified resources is replaced.
- dependsOn: specify additional explicit dependencies in addition to the ones in the dependency graph.
- hideDiffs: compact the display of diffs for specified properties in CLI output without affecting update behavior.
- hooks: specify a set of resource hooks that will be executed at specific points in the resource lifecycle.
- ignoreChanges: declare that changes to certain properties should be ignored during a diff.
- import: bring an existing cloud resource into Pulumi.
- parent: establish a parent/child relationship between resources.
- protect: prevent accidental deletion of a resource by marking it as protected.
- provider: pass an explicitly configured provider, instead of using the default global provider.
- providers: pass a set of explicitly configured providers. These are used if provider is not given, and are passed to child resources.
- replaceOnChanges: declare that changes to certain properties should be treated as forcing a replacement.
- retainOnDelete: if true the resource will be retained in the backing cloud provider during a Pulumi delete operation.
- transformations: dynamically transform a resource’s properties on the fly. Prefer
transformsif possible.transformationswill be deprecated in the future in favor oftransforms. - transforms: dynamically transform a resource’s properties on the fly.
- version: pass a provider plugin version that should be used when operating on a resource.
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).
| Resource option | Applies to components? | Notes |
|---|---|---|
| additionalSecretOutputs | No | Components don’t have provider-managed outputs |
| aliases | Yes | Works for renaming or refactoring components |
| customTimeouts | No | Components don’t have provider operations to time out |
| deleteBeforeReplace | No | Components are not replaced by providers |
| deletedWith | Yes | Controls deletion behavior |
| dependsOn | Yes | Creates explicit dependencies on the component |
| hideDiffs | No | Components don’t have provider-generated diffs |
| hooks | No | Components don’t have provider lifecycle events |
| ignoreChanges | No | Components don’t have provider-managed inputs. The component implementation may choose to propagate this to children. |
| import | No | Components cannot be imported from cloud providers |
| parent | Yes | Establishes parent-child relationships |
| protect | Yes | Protects the component from deletion |
| provider | No | Use providers instead for component resources |
| providers | Yes | Pass providers to use for child resources |
| replaceOnChanges | No | Components are not replaced by providers |
| replaceWith | No | Components are not replaced by providers |
| retainOnDelete | No | Components don’t have cloud resources to retain |
| transformations | Yes | Transform child resources within the component |
| transforms | Yes | Transform child resources within the component |
| version | No | Components don’t use provider plugins |
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.
