<p>I'm using <strong>Pulumi-Typescript</strong> to deploy infrastructure in GCP.</p>
<p>I have 1 Google Kubernetes Engine resource already deployed in my project.
To use that existing resource in Pulumi operation, I found documentation on pulumi import in which I explored about how it actually works.
By referring that document, I have added Import configuration are as follow:</p>
<pre><code>import * as gcp from &quot;@pulumi/gcp&quot;;
import * as pulumi from &quot;@pulumi/pulumi&quot;;
import * as k8s from &quot;@pulumi/kubernetes&quot;;
import * as infraJson from &quot;../parameters/infrastructure-parameters.json&quot;

export const gke = new gcp.container.Cluster(infraJson.clusterConfigs.CLUSTER_NAME,
  {
    name: infraJson.clusterConfigs.CLUSTER_NAME,
    initialNodeCount: infraJson.clusterConfigs.CLUSTER_DEFAULT_NODEPOOL_NODE_COUNT,
    removeDefaultNodePool: false,
    location: infraJson.clusterConfigs.RESOURCE_LOCATION,
    nodeConfig: {
      preemptible: false,
      machineType: infraJson.clusterConfigs.CLUSTER_MACHINE_TYPE,
      oauthScopes: [
        &quot;https://www.googleapis.com/auth/service.management.readonly&quot;,
        &quot;https://www.googleapis.com/auth/devstorage.read_only&quot;,
        &quot;https://www.googleapis.com/auth/monitoring.write&quot;,
        &quot;https://www.googleapis.com/auth/servicecontrol&quot;,
        &quot;https://www.googleapis.com/auth/logging.write&quot;,
        &quot;https://www.googleapis.com/auth/trace.append&quot;
      ]
    }
  }, {
     import: &quot;projects/myproject/locations/us-central1-c/clusters/test-cluster&quot;
  });
</code></pre>
<p>But, When I run command &quot;<strong>Pulumi up</strong>&quot; it shows me warning:</p>
<pre><code>gcp:container:Cluster (test-cluster):
    warning: previously-imported resources that still specify an ID may not be replaced; please remove the `import` declaration from your program.
</code></pre>
<p>I searched everywhere about how to do it in GCP, but not found anything.</p>
<p>If anyone knows how to do it, Please help me with this issue..!
Thank you...!</p>

<p>The only place in the Pulumi code base containing that warning is here:</p>
<p><a href="https://github.com/pulumi/pulumi/blob/272c4643b20d40113689475fd2f9fe3134e6d431/pkg/resource/deploy/step_generator.go#L540-L551" rel="nofollow noreferrer">https://github.com/pulumi/pulumi/blob/272c4643b20d40113689475fd2f9fe3134e6d431/pkg/resource/deploy/step_generator.go#L540-L551</a></p>
<p>What I understand from this code is this: you specified an ID of an existing cluster to import, as part of Pulumi code describing to &quot;to be&quot; situation of your cluster. But your existing cluster configuration differs from the description of your cluster config in the code. This leads to Pulumi wanting to to replace your cluster, but it is prevented by your <code>import</code> option, hence the warning.</p>
<p>Please run <code>pulumi preview --diff</code> and see where the config in your code differs from the actual state. Change your code to match the actual state. At that moment, <code>pulumi preview</code> should tell you there are no changes. Once you have that, you should be able to run <code>pulumi up</code> without a problem.</p>
