Open shysank opened 1 year ago
I guess it's because computed fields defaults to metadata.labels, metadata.annotations
. Is there a way to mark a specific label as computed field?
eg. computed_fields: [metadata.labels["resourceVersion"]]
@shysank The computed_fields
attribute can only address fields that are defined by the Kubernetes OpenAPI schema and metadata.labels
is a map type in the Kubernetes schema. However, individual map elements are arbitrary and not part of the schema therefore they cannot be used in computed fields.
You can try to remove metadata.labels
from the list of computed fields by explicitly setting a value for computed_fields
, for example:
computed_fields = ["metadata.annotations"]
Let us know if that helps.
@alexsomesan Yes, thats what I'm doing right now. The problem is, since annotations are completely ignored in plan, we are missing some changes that we'd like to see. That was the motivation for my original question to have targeted keys as computed fields.
Related https://github.com/hashicorp/terraform-provider-kubernetes/issues/1568
The issue extends beyond annotations.
Terraform Version, Provider Version and Kubernetes Version
Steps to Reproduce
kubernetes_manifest
terraform resource that points to a yaml file which contains a k8s manifestkubectl edit $resource_created_in_1 => add a label
foo: bar`Expected Behavior
What should have happened? Plan should show that label
foo" bar
should be removedActual Behavior
Plan showed no changes
Is this the expected behavior?