-
Notifications
You must be signed in to change notification settings - Fork 53
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
Permadiff in pulumiLabels and effectiveLabels with empty labels #2372
Comments
Attempted to repro
import pulumi
import pulumi_gcp as gcp
from pulumi_gcp import storage
prov = gcp.Provider(
"my-provider",
default_labels={
"cloud": "my-cloud",
"empty_default_label": "",
},
)
# Create a GCP resource (Storage Bucket)
bucket = storage.Bucket(
"my-bucket",
location="US",
labels={
"environment": "dev",
"team": "data",
"empty": "",
},
opts=pulumi.ResourceOptions(provider=prov),
)
pulumi.export("bucket_name", bucket.url)
#! /bin/bash
set -e
rm -f grpc.json
pulumi down --yes
sed -i '' 's/7.36.0/7.35.0/g' requirements.txt
pulumi install
PULUMI_DEBUG_GRPC="grpc.json" pulumi up --yes
eval "$(pulumi stack output --shell)"
gcloud storage buckets update $bucket_name --update-labels=unmanaged=value,unmanaged_empty=
sed -i '' 's/7.35.0/7.36.0/g' requirements.txt
pulumi install
PULUMI_DEBUG_GRPC="grpc.json" pulumi up --yes
pulumi preview --diff
Note here that I have tried:
This should cover all the ways to set a label on a GCP bucket but I have been unable to reproduce the issue so far. |
A few new notes on the issue:
|
I believe I have a repro: import pulumi
from pulumi_gcp import storage
bucketOne = storage.Bucket(
"my-bucket-one",
location="US",
labels={
"environment": "dev",
"team": "data",
"empty": "",
},
)
# Create a GCP resource (Storage Bucket)
bucket = storage.Bucket(
"my-bucket",
location="US",
labels={
"environment": "dev",
"team": "data",
"empty": "",
"other_bucket": bucketOne.name,
},
)
pulumi.export("bucket_name", bucket.url) Seems like the permadiff happens if the labels contain an output. Confirmed this does not happen in 7.35 |
Simplified the repro with some help - the second resource is not necessary: import pulumi
from pulumi_gcp import storage
bucket = storage.Bucket(
"my-bucket",
location="US",
labels={
"tag": pulumi.Output.from_input("val"),
"empty": "",
},
) |
Simplified it a bit more: from pulumi_gcp import storage
bucket = storage.Bucket(
"my-bucket",
location="US",
labels={
"static": "static",
"empty": "",
},
) Looks like the output type is not necessary either - we need to have an empty label and at least one more label for the permadiff to occur. What happens is that the state has:
while the plan is:
Unfortunately this reproduces in TF too: provider "google" {
region = "us-central1"
}
resource "google_storage_bucket" "bucket" {
name = "example-bucket12312322314"
location = "US"
labels = {
"static" = "static"
"empty" = ""
}
}
run
Note that this happens under -refresh=true as well. |
Upstream issue: hashicorp/terraform-provider-google#16750 |
Built a synthetic repro for the issue here: pulumi/pulumi-terraform-bridge#2412 Ran it with and without PRC to compare the values we produce and see why non-PRC passes while PRC produces the perma-diff. Very little difference, only:
in both the |
PlanStateEdit allows a bridged provider author to correct the diff generated by the TF provider with additional information: the original Pulumi encoded inputs. This allows Pulumi to recover from information lost in the Terraform encoding. One example of this information loss is pulumi/pulumi-gcp#2372, where SDKv2's representation of an unknown value `""` is not distinguished from an actual empty string. A sister PR uses this capability to resolve pulumi/pulumi-gcp#2372.
PlanStateEdit allows a bridged provider author to correct the diff generated by the TF provider with additional information: the original Pulumi encoded inputs. This allows Pulumi to recover from information lost in the Terraform encoding. The ability to recover information from Pulumi's representation is only available outside the normal TF information flow. This is why diff customizers can't fill the role of PlanStateEdit. One example of this information loss is pulumi/pulumi-gcp#2372, where SDKv2's representation of an unknown value `""` is not distinguished from an actual empty string. A sister PR uses this capability to resolve (not this one GH) pulumi/pulumi-gcp#2372.
This PR takes advantage of pulumi/pulumi-terraform-bridge#2417 to fixup the incorrect planned state caused by empty labels. Fixes #2372
This issue has been addressed in PR #2386 and shipped in release v8.2.0. |
This fixes the empty label handling in the GCP Cluster resource. In the fix for #2372 (#2386 and pulumi/pulumi-terraform-bridge#2417) we did not know that the labels property in GCP is sometimes overloaded, ex GCP Custer. For the Cluster resource, the GCP labels are under `resource_labels`, not `labels` This PR adds the logic to the empty labels fix and adds a regression test. fixes #2395
Describe what happened
A user reported seeing a diff in effectiveLabels/pulumiLabels under 7.38
Sample program
GRPC logs:
Log output
No response
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).
The text was updated successfully, but these errors were encountered: