hashicorp / terraform-provider-kubernetes

Terraform Kubernetes provider
https://www.terraform.io/docs/providers/kubernetes/
Mozilla Public License 2.0
1.56k stars 963 forks source link

Remove ArgoCD operation field to prevent perpetual diff #2489

Closed corylevine closed 1 month ago

corylevine commented 1 month ago

Description

When using the kubernetes_manifest resource to manage an ArgoCD Application, it is possible for the status of Argo's sync operation to show up in the manifest when applying, but not during planning. This shows up under the top-level operation field, which is only present when an Argo sync operation is underway, potentially triggered by the Terraform apply.

This commit simply drops the operation field from manifests returned by the K8s API and thusly prevents it from being considered when diffing.

Acceptance tests

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

Release Note

Release note for CHANGELOG:

Prevent `operation` field in manifests from causing plan/apply diffs

References

Issue #2367

Community Note

hashicorp-cla-app[bot] commented 1 month ago

CLA assistant check
All committers have signed the CLA.

hashicorp-cla-app[bot] commented 1 month ago

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

alexsomesan commented 1 month ago

Whatever is causing the issue with the operation attribute of ArgoCD's Application CR will likely cause similar issues in similar conditions on other resources. We need to understand the root cause of it and address it generically.

This approach is not the way forward for this issue, because it introduces special handling of a specific CR (not even a core K8s resource). We designed the kubernetes_manifest resource with the express intent of handling all K8s object types through the same codepath and logic. We strive to keep it along that path and address issues in a generic manner.

Closing this, let's go back to the conversation in #2367 and find the root cause.