https://pulumi.com logo
Title
a

adamant-leather-41068

03/22/2023, 12:01 AM
The docs for
gcp.compute.AttachedDisk
say:
Note: When using
gcp.compute.AttachedDisk
you must use
lifecycle.ignore_changes = ["attached_disk"]
on the
gcp.compute.Instance
resource that has the disks attached. Otherwise the two resources will fight for control of the attached disk block.
How do I do this? ie, where does this go?
o

orange-policeman-59119

03/24/2023, 10:28 AM
Hey Nick! To use
lifecycle.ignore_changes
with
gcp.compute.AttachedDisk
and
gcp.compute.Instance
, you need to add the
ignoreChanges
option to the instance resource in your Pulumi program. Here's an example in TypeScript:
typescript
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const instance = new gcp.compute.Instance("my-instance", {
    // other instance configuration options...
    attachedDisks: [
        // attached disk configuration...
    ],
}, {
    ignoreChanges: ["attachedDisks"],
});
This will ensure that any changes to the attached disks will not cause Pulumi to try to update the instance resource, avoiding the fight for control of the attached disk block.