1 month ago
    hi, I am importing an EC2 instance (using
    pulumi import
    ) and then pasting the code into my file, and when I try to run
    pulumi up
    again using the same code, Pulumi claims that there is a diff in the user data when the strings are the same?
    Type                 Name        Plan       Info
         pulumi:pulumi:Stack  test-dev
     ~   └─ aws:ec2:Instance  api         update     [diff: ~userData]
        ~ 1 to update
        1 unchanged
    Do you want to perform this update? details
      pulumi:pulumi:Stack: (same)
        ~ aws:ec2/instance:Instance: (update) 🔒
          ~ userData: "85de5fdec580fbc6617d9b2bfbddbae346a45ef4" => "85de5fdec580fbc6617d9b2bfbddbae346a45ef4"


    1 month ago
    That may be because it can't tell what's in the new user data because it's generated in an apply, or similar. If that's the case, then it'll report a diff during preview, but (assuming tha there really is no difference) the diff will be 0 during up, and the instance won't be recreated.
    If you want to test this, you can removed all EC2 write privileges from the creds that Pulumi is using, then run
    pulumi up
    . The user data will be fully generated and you'll be able to tell if the user data really has change, and you're also protected from accidentally destroying the instance in the case where the user data has changed.