LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pulumi-import

Import existing cloud resources into Pulumi

TLDR

Import an existing resource by type, name, and cloud ID
$ pulumi import [aws:s3/bucket:Bucket] [my-bucket] [my-bucket-id]
copy
Import from a JSON file
$ pulumi import -f [resources.json]
copy
Import and write generated code to a file
$ pulumi import [type] [name] [id] -o [code.ts]
copy
Import without deletion protection
$ pulumi import --protect=false [type] [name] [id]
copy
Preview the import without performing it
$ pulumi import --preview-only [type] [name] [id]
copy
Import and skip the confirmation prompt
$ pulumi import -y [type] [name] [id]
copy
Import specific properties only
$ pulumi import --properties [prop1,prop2] [type] [name] [id]
copy

SYNOPSIS

pulumi import [options] type name id

DESCRIPTION

pulumi import imports existing cloud resources into Pulumi state and optionally generates the code needed to manage them. This is useful for adopting existing infrastructure under Pulumi management without recreating resources.The command requires the resource type (in the format `provider:module/resource:Resource`), a logical name for the resource in Pulumi, and the cloud provider's resource ID. After import, the resource appears in the stack state and future `pulumi up` operations will manage it.

PARAMETERS

-f, --file file

Import resources from a JSON file containing resource definitions.
-o, --out file
Write generated resource declaration code to the specified file.
--protect
Import resources with deletion protection enabled (default: true).
--generate-code
Generate resource declaration code for imported resources (default: true).
--parent name=urn
Parent resource name and URN in the format `name=urn`.
--provider name=urn
Provider resource name and URN in the format `name=urn`.
--properties names
Comma-separated list of property names to use for the import.
--preview-only
Only show a preview of the import without performing it.
--skip-preview
Skip the preview calculation before performing the import.
--diff
Display the operation as a rich diff showing the overall change.
-s, --stack name
Target stack to operate on.
-p, --parallel n
Allow N resource operations to run in parallel (default: 16).
-y, --yes
Automatically approve the import after preview.
-m, --message msg
Optional message for the update operation.
--from converter
Invoke a converter to import resources (e.g., from Terraform state).
--suppress-outputs
Suppress display of stack outputs (useful when they contain sensitive values).
-d, --debug
Print detailed debugging output during the operation.
-j, --json
Serialize output as JSON.

SEE ALSO

Copied to clipboard
Kai