Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes refresh of resources with unchanged assets #1671

Merged
merged 1 commit into from
Feb 2, 2024

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Feb 2, 2024

Fixes #1595, pulumi/pulumi-aws#3548

Before this change, refreshing an unchanged resource which used an Asset or an Archive resulted in polluting Pulumi state with a machine-local filename.

The simplest example this is tested on is:

    const exampleBucketObject = new aws.s3.BucketObject("exampleBucketObject", {
        key: "someobject",
        bucket: bucket.id,
        source: new pulumi.asset.FileAsset(inFile),
    });

After this change this example refreshes correctly with no changes detected.

Unfortunately this change by itself is insufficient to guarantee that these resources refresh correctly when Pulumi-tracked state is out of date with respect to the cloud state, and further work is required to make this correct for individual resources in each provider. For the example above, the upstream provider for BucketObject does not implement fetching contents of the object upon Read into a temporary file. Therefore refreshing the object in this situation updates the "etag" property but does not guide the user to the need of reconciling the FileAsset with the updated cloud state.

Before this change, refreshing an unchanged resource which used an Asset or an Archive resulted in
polluting Pulumi state with a machine-local filename.

The simplest example this is tested on is:

    const exampleBucketObject = new aws.s3.BucketObject("exampleBucketObject", {
        key: "someobject",
        bucket: bucket.id,
        source: new pulumi.asset.FileAsset(inFile),
    });

After this change this example refreshes correctly with no changes detected.

Unfortunately this change by itself is insufficient to guarantee that these resources refresh
correctly when Pulumi-tracked state is out of date with respect to the cloud state, and further work
is required to make this correct for individual resources in each provider. For the example above,
the upstream provider for BucketObject does not implement fetching contents of the object upon Read
into a temporary file. Therefore refreshing the object in this situation updates the "etag" property
but does not guide the user to the need of reconciling the FileAsset with the updated cloud state.
@t0yv0 t0yv0 requested review from iwahbe and a team February 2, 2024 22:07
Copy link
Contributor

@VenelinMartinov VenelinMartinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@t0yv0 t0yv0 merged commit 41b7f99 into master Feb 2, 2024
7 checks passed
@t0yv0 t0yv0 deleted the t0yv0/fix-read-archives-handling branch February 2, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refresh pollutes state for programs that use Assets and Archives
2 participants