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

Fix defaultTags to trigger downstream updates #2585

Merged
merged 6 commits into from
Jul 1, 2023
Merged

Conversation

AaronFriel
Copy link
Member

@AaronFriel AaronFriel commented Jun 29, 2023

The defaultTags input property on providers now triggers an update on downstream resources. Because of the nature of the fix in the Pulumi TF Bridge, and to limit the scope of the change, we mark only the tags_all field from TF schema as a ComputedInput, triggering new diff behavior within the bridge.

As the tags_all field is otherwise hidden as a "computed" value, we omit detailed diff information. This is a tradeoff to avoid a more invasive change with more risk.

Fixes #1655. To use a release version of TF Bridge, depends on:

Example output:

pulumi up --skip-preview
Updating (test-aws-1655)

View in Browser (Ctrl+O): https://app.pulumi.com/pulumi/simple-yaml/test-aws-1655/updates/9

     Type                     Name                       Status              Info
     pulumi:pulumi:Stack      simple-yaml-test-aws-1655
 ~   ├─ pulumi:providers:aws  aws-provider               updated (0.13s)     [diff: ~defaultTags]
 ~   ├─ aws:s3:Bucket         my-bucket                  updated (0.87s)
 ~   └─ aws:s3:BucketObject   index.html                 updated (0.24s)

Verified when adding, updating, deleting, and removing entirely the defaultTags property.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

provider/resources.go Outdated Show resolved Hide resolved
provider/resources.go Show resolved Hide resolved
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

2 similar comments
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@AaronFriel AaronFriel force-pushed the friel/1655 branch 2 times, most recently from 7210506 to 7ed21a5 Compare June 30, 2023 14:55
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

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

I have rebuild the provider on top of a custom terraform-bridge with this line removed:

 		case v.IsArray():
 			// If this value has a diff and is considered computed by Terraform, the diff will be woefully incomplete. In
 			// this case, do not recurse into the array; instead, just use the count diff for the details.
-			if d := tfDiff.Attribute(name + ".#"); d == nil || (!d.NewComputed && !isComputedInput) {
+			if d := tfDiff.Attribute(name + ".#"); d == nil || !d.NewComputed {

And the new integration test still passes.

Could we please consider removing the mystery change? Or is there an explanation, if not a repro, why is it needed?

@t0yv0
Copy link
Member

t0yv0 commented Jun 30, 2023

Needs pulumi/pulumi-terraform-bridge#1266 - I think our investigation @AaronFriel shows that the integration test is passing while the bug basically resurfaced because a critical line got dropped out of the bridge master branch due to a merge issue. 1266 gets that back and adds coverage. On this PR we also need to make sure ProgramTest checks the right thing. I understand you're working on that. Once we get both of these done this is ready to go!

The `defaultTags` input property on providers now triggers an update on
downstream resources. Because of the nature of the fix in the Pulumi TF Bridge,
and to limit the scope of the change, we mark only the `tags_all` field from TF
schema as a `ComputedInput`, triggering new diff behavior within the bridge.

As the `tags_all` field is otherwise hidden as a "computed" value, we omit
detailed diff information. This is a tradeoff to avoid a more invasive change
with more risk.

Fixes #1655.

Example output:

```
pulumi up --skip-preview
Updating (test-aws-1655)

View in Browser (Ctrl+O): https://app.pulumi.com/pulumi/simple-yaml/test-aws-1655/updates/9

     Type                     Name                       Status              Info
     pulumi:pulumi:Stack      simple-yaml-test-aws-1655
 ~   ├─ pulumi:providers:aws  aws-provider               updated (0.13s)     [diff: ~defaultTags]
 ~   ├─ aws:s3:Bucket         my-bucket                  updated (0.87s)
 ~   └─ aws:s3:BucketObject   index.html                 updated (0.24s)
```

Verified when adding, updating, deleting, and removing entirely the
`defaultTags` property.
Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

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

LGTM! But it should have a review from the providers team before going in.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

1 similar comment
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@@ -27,7 +27,7 @@ export class Provider extends pulumi.ProviderResource {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
return obj['__pulumiType'] === "pulumi:providers:" + Provider.__pulumiType;
Copy link
Contributor

Choose a reason for hiding this comment

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

👀

@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@github-actions
Copy link

github-actions bot commented Jul 1, 2023

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@AaronFriel
Copy link
Member Author

All checks have passed, confirmed via checks tab in GitHub UI. Using admin to merge

@AaronFriel AaronFriel merged commit b1af0c3 into master Jul 1, 2023
16 checks passed
@AaronFriel AaronFriel deleted the friel/1655 branch July 1, 2023 03:02
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.

unexpected behavior of defaultTags
4 participants