pulumi / pulumi-gcp

A Google Cloud Platform (GCP) Pulumi resource package, providing multi-language access to GCP
Apache License 2.0
178 stars 52 forks source link

Added/removed accessConfigs after inital instance creation do not get recognized #1252

Open tferazzi opened 11 months ago

tferazzi commented 11 months ago

What happened?

Deploying an instance with a public IP initially and removing it afterwards does not get recognized by pulumi.

Example

Deploying an instance with a public IP like this:

new gcp.compute.Instance('my-instance-name', {
    name: 'my-instance-name',
    zone: 'europe-west4-a',
    machineType: 'f1-micro',
    networkInterfaces: [
      {
        subnetwork: args.subnetworkId,
        accessConfigs: [
          {
            networkTier: 'PREMIUM',
          },
        ],
      },
    ],
    bootDisk: {
      initializeParams: {
        image: 'ubuntu-2204-jammy-v20230727',
      },
    },
  });

And then removing the accessConfigs block like this:

new gcp.compute.Instance('my-instance-name', {
    name: 'my-instance-name',
    zone: 'europe-west4-a',
    machineType: 'f1-micro',
    networkInterfaces: [
      {
        subnetwork: args.subnetworkId,
        // accessConfigs: [
        //   {
        //     networkTier: 'PREMIUM',
        //   },
        // ],
      },
    ],
    bootDisk: {
      initializeParams: {
        image: 'ubuntu-2204-jammy-v20230727',
      },
    },
  });

And doing pulumi up again, results in no update/change of the instance.

Output of pulumi about

CLI
Version      3.88.0
Go Version   go1.21.2
Go Compiler  gc

Plugins
NAME    VERSION
nodejs  unknown

Host
OS       darwin
Version  13.6
Arch     arm64

Additional context

This also does not work the other way round:

  1. Instance without public IP address
  2. Add accessConfigs block to networkInterfaces
  3. pulumi up -> results in no changes

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

mikhailshilkov commented 10 months ago

I can repro this issue locally, here is a full program:

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

new gcp.compute.Instance('my-instance-name', {
    name: 'my-instance-name',
    zone: 'europe-west4-a',
    machineType: 'f1-micro',
    networkInterfaces: [
      {
        network: "default",
        accessConfigs: [
          {
            networkTier: 'PREMIUM',
          },
        ],
      },
    ],
    bootDisk: {
      initializeParams: {
        image: 'ubuntu-2204-jammy-v20230727',
      },
    },
  });

cc @t0yv0 on another diff issue.