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

PlanResourceChange GCP test failures #2079

Closed
5 tasks done
VenelinMartinov opened this issue Jun 12, 2024 · 8 comments
Closed
5 tasks done

PlanResourceChange GCP test failures #2079

VenelinMartinov opened this issue Jun 12, 2024 · 8 comments
Assignees
Labels
kind/engineering Work that is not visible to an external user resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Jun 12, 2024

Describe what happened

#2073

After rerunning, a lot of the issues look like the known differences around unknowns discovered in pulumi/pulumi-terraform-bridge#2054

The ones which are not that are:

  • TestAccLoadbalancer - diff in compute:InstanceGroup instances
  • TestAccWebserverNode - diff in compute:Firewall allows
  • TestAccWebserverPy - also compute:Firewall allows
  • TestLabelsCombinationsGo addressed by Fix overfitting label tests #2072
  • TestNodePoolGpuAcceleratorPanic

Sample program

Log output

Affected Resource(s)

No response

Output of pulumi about

Additional context

No response

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).

@VenelinMartinov VenelinMartinov added the kind/engineering Work that is not visible to an external user label Jun 12, 2024
@VenelinMartinov VenelinMartinov self-assigned this Jun 12, 2024
@VenelinMartinov VenelinMartinov changed the title PlanResourceChange test failures PlanResourceChange GCP test failures Jun 12, 2024
@VenelinMartinov
Copy link
Contributor Author

VenelinMartinov commented Jun 12, 2024

The instances diff seems like it must be present upstream - the READ returns a different value to what's created:

Read
{
    "method": "/pulumirpc.ResourceProvider/Read",
    "request": {
        "id": "projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
        "urn": "urn:pulumi:p-it-venelins-m-loadbalanc-8cf5219c::loadbalancer::gcp:compute/instanceGroup:InstanceGroup::video-resources",
        "properties": {
            "__meta": "{\"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0\":{\"create\":360000000000,\"delete\":360000000000,\"update\":360000000000},\"schema_version\":\"2\"}",
            "description": "",
            "id": "projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
            "instances": [
                "https://www.googleapis.com/compute/v1/projects/pulumi-development/zones/us-west1-a/instances/video-compute-d90a9d6"
            ],
            "name": "video-resources-5f21209",
            "namedPorts": [
                {
                    "name": "http",
                    "port": 80
                }
            ],
            "network": "https://www.googleapis.com/compute/beta/projects/pulumi-development/global/networks/default-network-1b6bdf9",
            "project": "pulumi-development",
            "selfLink": "https://www.googleapis.com/compute/beta/projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
            "size": 1,
            "zone": "us-west1-a"
        },
        "inputs": {
            "__defaults": [
                "name"
            ],
            "instances": [
                "https://www.googleapis.com/compute/v1/projects/pulumi-development/zones/us-west1-a/instances/video-compute-d90a9d6"
            ],
            "name": "video-resources-5f21209",
            "namedPorts": [
                {
                    "__defaults": [],
                    "name": "http",
                    "port": 80
                }
            ],
            "project": "pulumi-development",
            "zone": "us-west1-a"
        }
    },
    "response": {
        "id": "projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
        "properties": {
            "__meta": "{\"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0\":{\"create\":360000000000,\"delete\":360000000000,\"update\":360000000000},\"schema_version\":\"2\"}",
            "description": "",
            "id": "projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
            "instances": [
                "https://www.googleapis.com/compute/beta/projects/pulumi-development/zones/us-west1-a/instances/video-compute-d90a9d6"
            ],
            "name": "video-resources-5f21209",
            "namedPorts": [
                {
                    "name": "http",
                    "port": 80
                }
            ],
            "network": "https://www.googleapis.com/compute/beta/projects/pulumi-development/global/networks/default-network-1b6bdf9",
            "project": "pulumi-development",
            "selfLink": "https://www.googleapis.com/compute/beta/projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
            "size": 1,
            "zone": "us-west1-a"
        },
        "inputs": {
            "__defaults": [
                "name"
            ],
            "instances": [
                "https://www.googleapis.com/compute/beta/projects/pulumi-development/zones/us-west1-a/instances/video-compute-d90a9d6"
            ],
            "name": "video-resources-5f21209",
            "namedPorts": [
                {
                    "__defaults": [],
                    "name": "http",
                    "port": 80
                }
            ],
            "project": "pulumi-development",
            "zone": "us-west1-a"
        }
    },
    "metadata": {
        "kind": "resource",
        "mode": "client",
        "name": "gcp"
    }
}
Create
{
    "method": "/pulumirpc.ResourceProvider/Create",
    "request": {
        "urn": "urn:pulumi:p-it-venelins-m-loadbalanc-8cf5219c::loadbalancer::gcp:compute/instanceGroup:InstanceGroup::video-resources",
        "properties": {
            "__defaults": [
                "name"
            ],
            "instances": [
                "https://www.googleapis.com/compute/v1/projects/pulumi-development/zones/us-west1-a/instances/video-compute-d90a9d6"
            ],
            "name": "video-resources-5f21209",
            "namedPorts": [
                {
                    "__defaults": [],
                    "name": "http",
                    "port": 80
                }
            ],
            "project": "pulumi-development",
            "zone": "us-west1-a"
        }
    },
    "response": {
        "id": "projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
        "properties": {
            "__meta": "{\"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0\":{\"create\":360000000000,\"delete\":360000000000,\"update\":360000000000},\"schema_version\":\"2\"}",
            "description": "",
            "id": "projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
            "instances": [
                "https://www.googleapis.com/compute/v1/projects/pulumi-development/zones/us-west1-a/instances/video-compute-d90a9d6"
            ],
            "name": "video-resources-5f21209",
            "namedPorts": [
                {
                    "name": "http",
                    "port": 80
                }
            ],
            "network": "https://www.googleapis.com/compute/beta/projects/pulumi-development/global/networks/default-network-1b6bdf9",
            "project": "pulumi-development",
            "selfLink": "https://www.googleapis.com/compute/beta/projects/pulumi-development/zones/us-west1-a/instanceGroups/video-resources-5f21209",
            "size": 1,
            "zone": "us-west1-a"
        }
    },
    "metadata": {
        "kind": "resource",
        "mode": "client",
        "name": "gcp"
    }
}

I don't actually see why the diff is produced, the values look pretty identical.

@VenelinMartinov
Copy link
Contributor Author

VenelinMartinov commented Jun 12, 2024

Firewall read:

{
    "method": "/pulumirpc.ResourceProvider/Read",
    "request": {
        "id": "projects/pulumi-development/global/firewalls/ts-firewall-533c1d7",
        "urn": "urn:pulumi:p-it-venelins-m-webserver-69654475::webserver::gcp:compute/firewall:Firewall::ts-firewall",
        "properties": {
            "__meta": "{\"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0\":{\"create\":1200000000000,\"delete\":1200000000000,\"update\":1200000000000},\"schema_version\":\"1\"}",
            "allows": [
                {
                    "ports": [
                        "22",
                        "80"
                    ],
                    "protocol": "tcp"
                },
                {
                    "ports": [],
                    "protocol": "icmp"
                }
            ],
            "creationTimestamp": "2024-06-12T08:05:44.631-07:00",
            "denies": [],
            "description": "",
            "destinationRanges": [],
            "direction": "INGRESS",
            "disabled": false,
            "enableLogging": null,
            "id": "projects/pulumi-development/global/firewalls/ts-firewall-533c1d7",
            "logConfig": null,
            "name": "ts-firewall-533c1d7",
            "network": "https://www.googleapis.com/compute/v1/projects/pulumi-development/global/networks/ts-network-71f2225",
            "priority": 1000,
            "project": "pulumi-development",
            "selfLink": "https://www.googleapis.com/compute/v1/projects/pulumi-development/global/firewalls/ts-firewall-533c1d7",
            "sourceRanges": null,
            "sourceServiceAccounts": null,
            "sourceTags": [
                "foo"
            ],
            "targetServiceAccounts": null,
            "targetTags": null
        },
        "inputs": {
            "__defaults": [
                "name",
                "priority"
            ],
            "allows": [
                {
                    "__defaults": [],
                    "protocol": "icmp"
                },
                {
                    "__defaults": [],
                    "ports": [
                        "22",
                        "80"
                    ],
                    "protocol": "tcp"
                }
            ],
            "name": "ts-firewall-533c1d7",
            "network": "https://www.googleapis.com/compute/v1/projects/pulumi-development/global/networks/ts-network-71f2225",
            "priority": 1000,
            "project": "pulumi-development",
            "sourceTags": [
                "foo"
            ]
        }
    },
    "response": {
        "id": "projects/pulumi-development/global/firewalls/ts-firewall-533c1d7",
        "properties": {
            "__meta": "{\"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0\":{\"create\":1200000000000,\"delete\":1200000000000,\"update\":1200000000000},\"schema_version\":\"1\"}",
            "allows": [
                {
                    "ports": [
                        "22",
                        "80"
                    ],
                    "protocol": "tcp"
                },
                {
                    "ports": null,
                    "protocol": "icmp"
                }
            ],
            "creationTimestamp": "2024-06-12T08:05:44.631-07:00",
            "denies": [],
            "description": "",
            "destinationRanges": [],
            "direction": "INGRESS",
            "disabled": false,
            "enableLogging": null,
            "id": "projects/pulumi-development/global/firewalls/ts-firewall-533c1d7",
            "logConfig": null,
            "name": "ts-firewall-533c1d7",
            "network": "https://www.googleapis.com/compute/v1/projects/pulumi-development/global/networks/ts-network-71f2225",
            "priority": 1000,
            "project": "pulumi-development",
            "selfLink": "https://www.googleapis.com/compute/v1/projects/pulumi-development/global/firewalls/ts-firewall-533c1d7",
            "sourceRanges": null,
            "sourceServiceAccounts": null,
            "sourceTags": [
                "foo"
            ],
            "targetServiceAccounts": null,
            "targetTags": null
        },
        "inputs": {
            "__defaults": [
                "name",
                "priority"
            ],
            "allows": [
                {
                    "__defaults": [],
                    "protocol": "tcp"
                },
                {
                    "__defaults": [],
                    "ports": null,
                    "protocol": "icmp"
                }
            ],
            "name": "ts-firewall-533c1d7",
            "network": "https://www.googleapis.com/compute/v1/projects/pulumi-development/global/networks/ts-network-71f2225",
            "priority": 1000,
            "project": "pulumi-development",
            "sourceTags": [
                "foo"
            ]
        }
    },
    "metadata": {
        "kind": "resource",
        "mode": "client",
        "name": "gcp"
    }
}

The ports property inside the ICMP obj is changed from [] to null

This is caused by pulumi/pulumi-terraform-bridge#2065

Without that the diff matches TF.

@VenelinMartinov
Copy link
Contributor Author

TestNodePoolGpuAcceleratorPanic is the test overfitting on secondary properties. Also various values showing up in the output as unknown, unlike before.

@VenelinMartinov
Copy link
Contributor Author

The firewall issue is fixed by the latest iteration of pulumi/pulumi-terraform-bridge#2065

@VenelinMartinov
Copy link
Contributor Author

All the above failures are now fine but there's a new one related to effectiveLabels and pulumiLabels: pulumi/pulumi-terraform-bridge#1962 (comment)

@VenelinMartinov
Copy link
Contributor Author

Running the GCP labels example in TF:

provider "google" {
  region       = "us-central1"
}

resource "google_storage_bucket" "bucket" {
  name     = "example-bucket123123223"
  location = "US"
  labels = {
    x = ""
    y = "val"
  }
}

The x = "" is returned as an unknown from preview - it is resolved as missing only after applying. I believe we flag up the diff in the length of the effectiveLabels - before resolving the unknown they seem to be of len 2 but they are really len 1:

In plannedState: "effective_labels":cty.MapVal(map[string]cty.Value{"x":cty.UnknownVal(cty.String), "y":cty.StringVal("s")})

In priorState: "effective_labels":cty.MapVal(map[string]cty.Value{"y":cty.StringVal("s")})

The PlannedDiff: "effective_labels.%":*terraform.ResourceAttrDiff{Old:"1", New:"2", NewComputed:false, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}, "effective_labels.x":*terraform.ResourceAttrDiff{Old:"", New:"", NewComputed:true, NewRemoved:false, NewExtra:interface {}(nil), RequiresNew:false, Sensitive:false, Type:0x0}

I believe the Old and New for the property here is likely the length.

@VenelinMartinov
Copy link
Contributor Author

VenelinMartinov commented Jun 24, 2024

Note that TF does not produce such a diff with terraform plan -refresh-only. I'll add some debugging there to see if they ignore the length of the element there as a diff.

Actually because of the new refresh, we essentially run the equivalent of terraform plan -refresh=true during refresh.

Running that in TF does produce a permadiff in this case:

terraform plan
google_storage_bucket.bucket: Refreshing state... [id=example-bucket123123223]

Terraform used the selected providers to generate the following
execution plan. Resource actions are indicated with the following
symbols:
  ~ update in-place

Terraform will perform the following actions:

  # google_storage_bucket.bucket will be updated in-place
  ~ resource "google_storage_bucket" "bucket" {
      ~ effective_labels            = {
          + "x" = (known after apply)
            # (1 unchanged element hidden)
        }
        id                          = "example-bucket123123223"
        name                        = "example-bucket123123223"
      ~ terraform_labels            = {
          + "x" = (known after apply)
            # (1 unchanged element hidden)
        }
        # (14 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so
Terraform can't guarantee to take exactly these actions if you
run "terraform apply" now.

As x is unknown at preview time here. I'll fix the GCP tests and mark this as intended.

@VenelinMartinov VenelinMartinov added the resolution/fixed This issue was fixed label Jun 24, 2024
@VenelinMartinov
Copy link
Contributor Author

opened #2104 for the labels failing tests, which was the last failing test here - closing this as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/engineering Work that is not visible to an external user resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

1 participant