straight-cat-8703305/23/2023, 12:14 AM
resource option: The docs state that:
The resulting Pulumi program, after the import is complete, will faithfully generate the same desired state as your existing infrastructure’s actual state.
Because of this, all properties need to be fully specified. If you forget to specify a property, or that property’s value is incorrect, you’ll first receive a warning during preview, and then an error during the actual import update.But that isn’t matching the behavior that I’m seeing with regards to unspecified properties.
resource by specifying the
option, and I can leave off the majority of the options and still have the preview portion of
succeed with no warning. I can see in the
of the preview that the unspecified fields are properly being pulled in from the imported resource (e.g, the nodepools on the cluster). Three specific questions: 1. If I go through with
, can I guarantee that it will not modify any of the existing resources as long as
is in place? 2. If I then remove the
option with those unspecified options unchanged, would it then modify the resources and (e.g.) delete the nodepools that are present on the cluster? 3. After the initial
has been run to import the resource, do I have to remove the
command? a. We are swapping from manually-managed to pulumi-managed infrastructure gradually, so allowing the two to coexist might be nice, especially if the answer to 2. is ‘yes’
little-cartoon-1056905/23/2023, 1:45 AM
ambitious-father-6874605/23/2023, 6:33 AM
CLI command, which might be easier than trying to do it via code. It's what I usually do. Pulumi imports just change the state file, not the resources themselves.
salmon-gold-7470905/23/2023, 3:36 PM
ambitious-father-6874605/23/2023, 3:39 PM
straight-cat-8703305/23/2023, 5:54 PM
Generally, the correct thing to do is to update your code to match the actual configuration (which is why there are warnings and errors, as documented), import, then remove the import option.I did not get any warnings on the preview, which is at the heart of my question. I’m hesitant to go through with the
operation, because I am not confident it will run without modifying the state on the server — especially because removing (most) fields does not affect whether an warning is raised.
Does anyone use theI did attempt to use that — for gcp/python I got some warnings about the fields that were set in the imported definitions being incompatible with one another. Right now I am leaning towards just recreating new infrastructure with pulumi and not attempting to migrate my existing infrastructure over at all. It seems like it’s less risky if I do not want to accidentally modify the properties of the legacy infrastructurecommand to generate Pulumi code as mentioned in docs?