From 73cf48388530adb5e1ab1d3389915660ef8d5fd6 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Mon, 17 Nov 2025 10:42:21 +0100 Subject: [PATCH 1/2] Correct docs in `import` with Diff The behavior of import changed with https://github.com/pulumi/pulumi/pull/19339, and our docs should reflect the current behavior. --- .../iac/concepts/resources/options/import.md | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/content/docs/iac/concepts/resources/options/import.md b/content/docs/iac/concepts/resources/options/import.md index fd8b47fcb5c0..8b123376ce84 100644 --- a/content/docs/iac/concepts/resources/options/import.md +++ b/content/docs/iac/concepts/resources/options/import.md @@ -43,9 +43,11 @@ let server = new aws.ec2.Instance("web-server", { {{% /choosable %}} {{% choosable language python %}} -```python -# IMPORTANT: Python appends an underscore (`import_`) to avoid conflicting with the keyword. +{{% notes type="info" %}} +Python appends an underscore (`import_`) to avoid conflicting with the keyword. +{{% /notes %}} +```python import pulumi_aws as aws group = aws.ec2.SecurityGroup('web-sg', @@ -194,8 +196,26 @@ resources: For this to work, your Pulumi stack must be configured correctly. In this example, it’s important that the AWS region is correct. -If the resource’s arguments differ from the imported state, the import will fail. You will receive this message: `warning: inputs to import do not match the existing resource; importing this resource will fail`. Select “details” in the `pulumi up` preview to learn what the differences are. If you try to proceed without correcting the inconsistencies, you will see this message: `error: inputs to import do not match the existing resource`. To fix these errors, make sure that your program computes a state that completely matches the resource to be imported. +If the resource’s arguments differ from the imported state, the import will succeed and then the resource will be modified to reflect the inputs in your Pulumi program. + +```console +$ pulumi preview +Previewing update (dev) + +View in Browser (Ctrl+O): https://app.pulumi.com/pulumi/dev-yaml/dev/previews/40504f08-05da-43f7-86dd-9baa812bb9ff + +Loading policy packs... + + Type Name Plan Info + pulumi:pulumi:Stack dev-yaml-dev + ~ └─ aws:s3:Bucket bImport update [diff: ~tags,tagsAll] + +Resources: + ~ 1 to update + = 1 to import + 2 changes. 2 unchanged +``` -Because of auto-naming, it is common to run into this error when you import a resource’s name property. Unless you explicitly specify a name, Pulumi will auto-generate one, which is guaranteed not to match, because it will have a random hex suffix. To fix this problem, explicitly specify the resource’s name or disable auto-naming [as described here](/docs/iac/concepts/resources/names/#autonaming-configuration). Note that, in the example for the EC2 security group, the name was specified by passing `web-sg-62a569b` as the resource’s name property. +Because of auto-naming, it is common to run into this import-update when you import a resource’s name property. Unless you explicitly specify a name, Pulumi will auto-generate one, which is guaranteed not to match, because it will have a random hex suffix. To fix this problem, explicitly specify the resource’s name or disable auto-naming [as described here](/docs/iac/concepts/resources/names/#autonaming-configuration). Note that, in the example for the EC2 security group, the name was specified by passing `web-sg-62a569b` as the resource’s name property. Once a resource is successfully imported, remove the `import` option because Pulumi is now managing the resource. From c56e459eaaaca2ec9aaf92f3715c9f84e2884dca Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 09:48:20 +0000 Subject: [PATCH 2/2] Apply documentation review suggestions - Improve grammar in line 199 by adding comma after 'succeed' - Replace 'import-update' terminology with clearer phrasing on line 220 - Change code block language tag from console to bash on line 201 Co-authored-by: Ian Wahbe --- content/docs/iac/concepts/resources/options/import.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/docs/iac/concepts/resources/options/import.md b/content/docs/iac/concepts/resources/options/import.md index 8b123376ce84..62dad8c1aafe 100644 --- a/content/docs/iac/concepts/resources/options/import.md +++ b/content/docs/iac/concepts/resources/options/import.md @@ -196,9 +196,9 @@ resources: For this to work, your Pulumi stack must be configured correctly. In this example, it’s important that the AWS region is correct. -If the resource’s arguments differ from the imported state, the import will succeed and then the resource will be modified to reflect the inputs in your Pulumi program. +If the resource's arguments differ from the imported state, the import will succeed, and the resource will then be modified to reflect the inputs in your Pulumi program. -```console +```bash $ pulumi preview Previewing update (dev) @@ -216,6 +216,6 @@ Resources: 2 changes. 2 unchanged ``` -Because of auto-naming, it is common to run into this import-update when you import a resource’s name property. Unless you explicitly specify a name, Pulumi will auto-generate one, which is guaranteed not to match, because it will have a random hex suffix. To fix this problem, explicitly specify the resource’s name or disable auto-naming [as described here](/docs/iac/concepts/resources/names/#autonaming-configuration). Note that, in the example for the EC2 security group, the name was specified by passing `web-sg-62a569b` as the resource’s name property. +Because of auto-naming, it is common to see this update during import when you import a resource's name property. Unless you explicitly specify a name, Pulumi will auto-generate one, which is guaranteed not to match, because it will have a random hex suffix. To fix this problem, explicitly specify the resource's name or disable auto-naming [as described here](/docs/iac/concepts/resources/names/#autonaming-configuration). Note that, in the example for the EC2 security group, the name was specified by passing `web-sg-62a569b` as the resource's name property. Once a resource is successfully imported, remove the `import` option because Pulumi is now managing the resource.