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

Minimally reproduce AWS-2095 #1894

Closed
wants to merge 1 commit into from
Closed

Minimally reproduce AWS-2095 #1894

wants to merge 1 commit into from

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented Apr 22, 2024

When working on pulumi/pulumi-aws#2095 an interesting detailed diff issue surfaced for sets. When changing an element of a set, the diff shows lots of other elements as changed, although they are indeed unchanged. For example, connectionTimeout: 10 is shown in the detailed diff but shouldn't be.

Minimal repro in AWS:

name: cloudfront-diff
runtime: yaml
resources:
  myDistribution:
    properties:
      defaultCacheBehavior:
        forwardedValues:
          queryString: false
          cookies:
            forward: none
        targetOriginId: myS3Origin
        viewerProtocolPolicy: allow-all
        allowedMethods:
          - GET
          - HEAD
          - OPTIONS
        cachedMethods:
          - GET
          - HEAD
          - OPTIONS
      defaultRootObject: index.html
      enabled: true
      orderedCacheBehaviors: []
      origins:
        - domainName: mybucket.s3.amazonaws.com
          originId: myS3Origin
          connectionAttempts: 2 # TOGGLE THIS
          connectionTimeout: 10
      restrictions:
        geoRestriction:
          restrictionType: none
      viewerCertificate:
        cloudfrontDefaultCertificate: true
      staging: false
    type: aws:cloudfront:Distribution

To reproduce do an up, change connectionAttempts, do a preview.

Extracted this to a minimal repro in the bridge in this PR.

Debugging this test case

        ~r0: map[string]github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim.ResourceAttrDiff [
                "origin.918255712.domain_name": {
                        Old: "",
                        New: "mybucket.s3.amazonaws.com",
                        NewComputed: false,
                        NewRemoved: false,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.918255712.origin_id": {
                        Old: "",
                        New: "myS3Origin",
                        NewComputed: false,
                        NewRemoved: false,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.918255712.connection_timeout": {
                        Old: "",
                        New: "10",
                        NewComputed: false,
                        NewRemoved: false,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.918255712.origin_access_control_id": {
                        Old: "",
                        New: "",
                        NewComputed: false,
                        NewRemoved: false,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.918255712.connection_attempts": {
                        Old: "",
                        New: "2",
                        NewComputed: false,
                        NewRemoved: false,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.2429318100.connection_attempts": {
                        Old: "3",
                        New: "0",
                        NewComputed: false,
                        NewRemoved: true,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.2429318100.connection_timeout": {
                        Old: "10",
                        New: "0",
                        NewComputed: false,
                        NewRemoved: true,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.918255712.origin_path": {
                        Old: "",
                        New: "",
                        NewComputed: false,
                        NewRemoved: false,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.2429318100.origin_access_control_id": {
                        Old: "",
                        New: "",
                        NewComputed: false,
                        NewRemoved: true,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.2429318100.origin_id": {
                        Old: "myS3Origin",
                        New: "",
                        NewComputed: false,
                        NewRemoved: true,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.2429318100.origin_path": {
                        Old: "",
                        New: "",
                        NewComputed: false,
                        NewRemoved: true,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
                "origin.2429318100.domain_name": {
                        Old: "mybucket.s3.amazonaws.com",
                        New: "",
                        NewComputed: false,
                        NewRemoved: true,
                        NewExtra: interface {} nil,
                        RequiresNew: false,
                        Sensitive: false,
                        Type: DiffAttrUnknown (0),}, 
        ]

@t0yv0
Copy link
Member Author

t0yv0 commented Apr 22, 2024

So from TF POV the set hash has changed, so it thinks that connection_timeout 10 is removed but connection timeout 10 is added. When translating to Pulumi, there is only one element in the set, so this makes Pulumi incorrectly show a "10 => 10" display diff.

Copy link

codecov bot commented Apr 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.02%. Comparing base (94c1de4) to head (49cc41b).
Report is 465 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1894      +/-   ##
==========================================
- Coverage   60.02%   60.02%   -0.01%     
==========================================
  Files         327      327              
  Lines       43994    43994              
==========================================
- Hits        26407    26406       -1     
+ Misses      16096    16095       -1     
- Partials     1491     1493       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iwahbe
Copy link
Member

iwahbe commented Dec 3, 2024

If this is something you are interested in merging, please re-open the PR and we can get the test in.

@iwahbe iwahbe closed this Dec 3, 2024
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.

2 participants